errors: implement IntoDiagnosticArg
for &T
Implement `IntoDiagnosticArg` for `&'a T` when `T` implements `IntoDiagnosticArg` and `Clone`. Makes it easier to write diagnostic structs that borrow something which implements `IntoDiagnosticArg`. Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
parent
59cc5e5d59
commit
f7b42102e6
3 changed files with 13 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
use rustc_errors::{IntoDiagnosticArg, MultiSpan};
|
||||
use rustc_errors::MultiSpan;
|
||||
use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::{GenericArg, Ty};
|
||||
use rustc_span::Span;
|
||||
|
@ -128,18 +128,6 @@ pub(crate) enum LifetimeReturnCategoryErr<'a> {
|
|||
},
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for &RegionName {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
||||
format!("{}", self).into_diagnostic_arg()
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoDiagnosticArg for RegionName {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
||||
format!("{}", self).into_diagnostic_arg()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum RequireStaticErr {
|
||||
#[note(borrowck_used_impl_require_static)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue