about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorNadrieril <nadrieril+git@gmail.com>2024-10-08 00:14:35 +0200
committerNadrieril <nadrieril+git@gmail.com>2024-10-08 00:23:28 +0200
commit2ef0a8fdfd5142e8a524f4dc9fff8c65d0bd7cc2 (patch)
treee749cf28ef98ab0807569e3b2040f112b8ebee25 /compiler
parent4aaada42d0b59c3294908f9996277c60d9e13917 (diff)
downloadrust-2ef0a8fdfd5142e8a524f4dc9fff8c65d0bd7cc2.tar.gz
rust-2ef0a8fdfd5142e8a524f4dc9fff8c65d0bd7cc2.zip
Change error message
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir_build/messages.ftl2
-rw-r--r--compiler/rustc_mir_build/src/thir/pattern/mod.rs7
2 files changed, 4 insertions, 5 deletions
diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl
index 1c4e9fd11cb..55149570dbc 100644
--- a/compiler/rustc_mir_build/messages.ftl
+++ b/compiler/rustc_mir_build/messages.ftl
@@ -265,7 +265,7 @@ mir_build_pointer_pattern = function pointers and raw pointers not derived from
 
 mir_build_privately_uninhabited = pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
 
-mir_build_rust_2024_incompatible_pat = the semantics of this pattern will change in edition 2024
+mir_build_rust_2024_incompatible_pat = patterns are not allowed to reset the default binding mode in edition 2024
 
 mir_build_rustc_box_attribute_error = `#[rustc_box]` attribute used incorrectly
     .attributes = no other attributes may be applied
diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
index bb02ee37733..16b7cac4e4d 100644
--- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs
+++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs
@@ -25,6 +25,7 @@ use tracing::{debug, instrument};
 
 pub(crate) use self::check_match::check_match;
 use crate::errors::*;
+use crate::fluent_generated as fluent;
 use crate::thir::util::UserAnnotatedTyHelpers;
 
 struct PatCtxt<'a, 'tcx> {
@@ -58,10 +59,8 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
     debug!("pat_from_hir({:?}) = {:?}", pat, result);
     if let Some(sugg) = pcx.rust_2024_migration_suggestion {
         if sugg.is_hard_error {
-            let mut err = tcx.dcx().struct_span_err(
-                pat.span,
-                "patterns are not allowed to reset the default binding mode in rust 2024",
-            );
+            let mut err =
+                tcx.dcx().struct_span_err(pat.span, fluent::mir_build_rust_2024_incompatible_pat);
             err.subdiagnostic(sugg);
             err.emit();
         } else {