mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Remove lifetimes from some diagnostics.
Because the `&'a str` fields can be trivially converted to `String` without causing any extra allocations.
This commit is contained in:
parent
5350edb9e8
commit
45dc19785d
@ -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),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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<UnsafeNotInheritedLintNote>,
|
||||
}
|
||||
@ -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<UnsafeNotInheritedNote>,
|
||||
}
|
||||
@ -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<UnsafeNotInheritedNote>,
|
||||
}
|
||||
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user