Skip to content

Commit acf1abf

Browse files
committed
Edition 2024: Make ! fallback to !
1 parent 295d4a2 commit acf1abf

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+5
-0
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ fn never_type_behavior(tcx: TyCtxt<'_>) -> (DivergingFallbackBehavior, Diverging
397397
fn default_fallback(tcx: TyCtxt<'_>) -> DivergingFallbackBehavior {
398398
use DivergingFallbackBehavior::*;
399399

400+
// Edition 2024: fallback to `!`
401+
if tcx.sess.edition().at_least_rust_2024() {
402+
return FallbackToNever;
403+
}
404+
400405
// `feature(never_type_fallback)`: fallback to `!` or `()` trying to not break stuff
401406
if tcx.features().never_type_fallback {
402407
return FallbackToNiko;

0 commit comments

Comments
 (0)