Remove the lifetime from DiagnosticArgValue
.
Because it's almost always static. This makes `impl IntoDiagnosticArg for DiagnosticArgValue` trivial, which is nice. There are a few diagnostics constructed in `compiler/rustc_mir_build/src/check_unsafety.rs` and `compiler/rustc_mir_transform/src/errors.rs` that now need symbols converted to `String` with `to_string` instead of `&str` with `as_str`, but that' no big deal, and worth it for the simplifications elsewhere.
This commit is contained in:
parent
fb4bca04fa
commit
5350edb9e8
38 changed files with 113 additions and 116 deletions
|
@ -147,7 +147,7 @@ impl<'a> CopyPath<'a> {
|
|||
struct DebugArgPath<'a>(pub &'a Path);
|
||||
|
||||
impl IntoDiagnosticArg for DebugArgPath<'_> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue {
|
||||
DiagnosticArgValue::Str(Cow::Owned(format!("{:?}", self.0)))
|
||||
}
|
||||
}
|
||||
|
@ -974,7 +974,7 @@ pub enum ExpectedPointerMutability {
|
|||
}
|
||||
|
||||
impl IntoDiagnosticArg for ExpectedPointerMutability {
|
||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue<'static> {
|
||||
fn into_diagnostic_arg(self) -> DiagnosticArgValue {
|
||||
match self {
|
||||
ExpectedPointerMutability::Mut => DiagnosticArgValue::Str(Cow::Borrowed("*mut")),
|
||||
ExpectedPointerMutability::Not => DiagnosticArgValue::Str(Cow::Borrowed("*_")),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue