1
Fork 0

Change error message

This commit is contained in:
Nadrieril 2024-10-08 00:14:35 +02:00
parent 4aaada42d0
commit 2ef0a8fdfd
6 changed files with 57 additions and 58 deletions

View file

@ -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

View file

@ -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 {