about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/errors.rs
diff options
context:
space:
mode:
authordianne <diannes.gm@gmail.com>2025-02-05 09:05:39 -0800
committerdianne <diannes.gm@gmail.com>2025-02-05 09:05:39 -0800
commita5cc4cbe64876c339cc1fb47fb962792bc142146 (patch)
tree3dbff65039ede378d08d72613a0f77d30e46a69f /compiler/rustc_mir_build/src/errors.rs
parent767f82039c221fa609f752d2a2ea4ffd664f8138 (diff)
downloadrust-a5cc4cbe64876c339cc1fb47fb962792bc142146.tar.gz
rust-a5cc4cbe64876c339cc1fb47fb962792bc142146.zip
reword default binding mode notes
Diffstat (limited to 'compiler/rustc_mir_build/src/errors.rs')
-rw-r--r--compiler/rustc_mir_build/src/errors.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index e83901e175d..55fd42457b7 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -1128,15 +1128,9 @@ impl Subdiagnostic for Rust2024IncompatiblePatSugg {
         for (span, def_br_mutbl) in self.default_mode_labels.into_iter().rev() {
             // Don't point to a macro call site.
             if !span.from_expansion() {
-                let dbm_str = match def_br_mutbl {
-                    ty::Mutability::Not => "ref",
-                    ty::Mutability::Mut => "ref mut",
-                };
-                let note_msg = format!(
-                    "the default binding mode changed to `{dbm_str}` because this has type `{}_`",
-                    def_br_mutbl.ref_prefix_str()
-                );
-                let label_msg = format!("the default binding mode is `{dbm_str}`, introduced here");
+                let note_msg = "matching on a reference type with a non-reference pattern changes the default binding mode";
+                let label_msg =
+                    format!("this matches on type `{}_`", def_br_mutbl.ref_prefix_str());
                 let mut label = MultiSpan::from(span);
                 label.push_span_label(span, label_msg);
                 diag.span_note(label, note_msg);