about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
index 2a2c4ac10b2..10d832f9726 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs
@@ -392,6 +392,11 @@ fn never_type_behavior(tcx: TyCtxt<'_>) -> (DivergingFallbackBehavior, Diverging
 fn default_fallback(tcx: TyCtxt<'_>) -> DivergingFallbackBehavior {
     use DivergingFallbackBehavior::*;
 
+    // Edition 2024: fallback to `!`
+    if tcx.sess.edition().at_least_rust_2024() {
+        return FallbackToNever;
+    }
+
     // `feature(never_type_fallback)`: fallback to `!` or `()` trying to not break stuff
     if tcx.features().never_type_fallback {
         return FallbackToNiko;