diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs index 226df08ff8f..422549755d1 100644 --- a/compiler/rustc_mir_build/src/check_unsafety.rs +++ b/compiler/rustc_mir_build/src/check_unsafety.rs @@ -605,7 +605,7 @@ impl UnsafeOpKind { span, UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe { span, - function: &with_no_trimmed_paths!(tcx.def_path_str(*did)), + function: with_no_trimmed_paths!(tcx.def_path_str(*did)), unsafe_not_inherited_note, }, ), @@ -696,7 +696,7 @@ impl UnsafeOpKind { span, UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe { span, - function: &with_no_trimmed_paths!(tcx.def_path_str(*function)), + function: with_no_trimmed_paths!(tcx.def_path_str(*function)), missing_target_features: DiagnosticArgValue::StrListSepByAnd( missing.iter().map(|feature| Cow::from(feature.to_string())).collect(), ), @@ -750,14 +750,14 @@ impl UnsafeOpKind { dcx.emit_err(CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed { span, unsafe_not_inherited_note, - function: &tcx.def_path_str(*did), + function: tcx.def_path_str(*did), }); } CallToUnsafeFunction(Some(did)) => { dcx.emit_err(CallToUnsafeFunctionRequiresUnsafe { span, unsafe_not_inherited_note, - function: &tcx.def_path_str(*did), + function: tcx.def_path_str(*did), }); } CallToUnsafeFunction(None) if unsafe_op_in_unsafe_fn_allowed => { @@ -875,7 +875,7 @@ impl UnsafeOpKind { ), build_target_features_count: build_enabled.len(), unsafe_not_inherited_note, - function: &tcx.def_path_str(*function), + function: tcx.def_path_str(*function), }); } CallToFunctionWith { function, missing, build_enabled } => { @@ -894,7 +894,7 @@ impl UnsafeOpKind { ), build_target_features_count: build_enabled.len(), unsafe_not_inherited_note, - function: &tcx.def_path_str(*function), + function: tcx.def_path_str(*function), }); } } diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs index 147001cabb0..3c1ba26a503 100644 --- a/compiler/rustc_mir_build/src/errors.rs +++ b/compiler/rustc_mir_build/src/errors.rs @@ -23,10 +23,10 @@ pub struct UnconditionalRecursion { #[derive(LintDiagnostic)] #[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe)] #[note] -pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe<'a> { +pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe { #[label] pub span: Span, - pub function: &'a str, + pub function: String, #[subdiagnostic] pub unsafe_not_inherited_note: Option, } @@ -123,10 +123,10 @@ pub struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe { #[derive(LintDiagnostic)] #[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe)] #[help] -pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe<'a> { +pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe { #[label] pub span: Span, - pub function: &'a str, + pub function: String, pub missing_target_features: DiagnosticArgValue, pub missing_target_features_count: usize, #[note] @@ -140,11 +140,11 @@ pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe<'a> { #[derive(Diagnostic)] #[diag(mir_build_call_to_unsafe_fn_requires_unsafe, code = E0133)] #[note] -pub struct CallToUnsafeFunctionRequiresUnsafe<'a> { +pub struct CallToUnsafeFunctionRequiresUnsafe { #[primary_span] #[label] pub span: Span, - pub function: &'a str, + pub function: String, #[subdiagnostic] pub unsafe_not_inherited_note: Option, } @@ -163,11 +163,11 @@ pub struct CallToUnsafeFunctionRequiresUnsafeNameless { #[derive(Diagnostic)] #[diag(mir_build_call_to_unsafe_fn_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)] #[note] -pub struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed<'a> { +pub struct CallToUnsafeFunctionRequiresUnsafeUnsafeOpInUnsafeFnAllowed { #[primary_span] #[label] pub span: Span, - pub function: &'a str, + pub function: String, #[subdiagnostic] pub unsafe_not_inherited_note: Option, } @@ -374,11 +374,11 @@ pub struct BorrowOfLayoutConstrainedFieldRequiresUnsafeUnsafeOpInUnsafeFnAllowed #[derive(Diagnostic)] #[diag(mir_build_call_to_fn_with_requires_unsafe, code = E0133)] #[help] -pub struct CallToFunctionWithRequiresUnsafe<'a> { +pub struct CallToFunctionWithRequiresUnsafe { #[primary_span] #[label] pub span: Span, - pub function: &'a str, + pub function: String, pub missing_target_features: DiagnosticArgValue, pub missing_target_features_count: usize, #[note] @@ -392,11 +392,11 @@ pub struct CallToFunctionWithRequiresUnsafe<'a> { #[derive(Diagnostic)] #[diag(mir_build_call_to_fn_with_requires_unsafe_unsafe_op_in_unsafe_fn_allowed, code = E0133)] #[help] -pub struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed<'a> { +pub struct CallToFunctionWithRequiresUnsafeUnsafeOpInUnsafeFnAllowed { #[primary_span] #[label] pub span: Span, - pub function: &'a str, + pub function: String, pub missing_target_features: DiagnosticArgValue, pub missing_target_features_count: usize, #[note]