A more general implementation of IntoDiagnosticArg
for Binder
(Also removes DiagArg
, as it's no longer necessary)
This commit is contained in:
parent
fd18d9a584
commit
6a05cd85ad
3 changed files with 16 additions and 26 deletions
|
@ -1146,14 +1146,6 @@ pub struct OpaqueCapturesLifetime<'tcx> {
|
|||
pub opaque_ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
pub struct DiagArg<T>(pub T);
|
||||
|
||||
impl<T: ToString> IntoDiagnosticArg for DiagArg<T> {
|
||||
fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> {
|
||||
self.0.to_string().into_diagnostic_arg()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub enum FunctionPointerSuggestion<'a> {
|
||||
#[suggestion(
|
||||
|
@ -1221,7 +1213,7 @@ pub enum FunctionPointerSuggestion<'a> {
|
|||
fn_name: String,
|
||||
#[skip_arg]
|
||||
found_sig: Binder<'a, FnSig<'a>>,
|
||||
expected_sig: DiagArg<Binder<'a, FnSig<'a>>>,
|
||||
expected_sig: Binder<'a, FnSig<'a>>,
|
||||
},
|
||||
#[suggestion(
|
||||
infer_fps_cast_both,
|
||||
|
@ -1236,7 +1228,7 @@ pub enum FunctionPointerSuggestion<'a> {
|
|||
fn_name: String,
|
||||
#[skip_arg]
|
||||
found_sig: Binder<'a, FnSig<'a>>,
|
||||
expected_sig: DiagArg<Binder<'a, FnSig<'a>>>,
|
||||
expected_sig: Binder<'a, FnSig<'a>>,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use rustc_span::{sym, BytePos, Span};
|
|||
use rustc_target::abi::FieldIdx;
|
||||
|
||||
use crate::errors::{
|
||||
ConsiderAddingAwait, DiagArg, FnConsiderCasting, FnItemsAreDistinct, FnUniqTypes,
|
||||
ConsiderAddingAwait, FnConsiderCasting, FnItemsAreDistinct, FnUniqTypes,
|
||||
FunctionPointerSuggestion, SuggestAccessingField, SuggestAsRefWhereAppropriate,
|
||||
SuggestBoxingForReturnImplTrait, SuggestRemoveSemiOrReturnBinding, SuggestTuplePatternMany,
|
||||
SuggestTuplePatternOne, TypeErrorAdditionalDiags,
|
||||
|
@ -379,14 +379,14 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
|||
span,
|
||||
fn_name,
|
||||
found_sig: *found_sig,
|
||||
expected_sig: DiagArg(*expected_sig),
|
||||
expected_sig: *expected_sig,
|
||||
}
|
||||
} else {
|
||||
FunctionPointerSuggestion::CastBoth {
|
||||
span,
|
||||
fn_name,
|
||||
found_sig: *found_sig,
|
||||
expected_sig: DiagArg(*expected_sig),
|
||||
expected_sig: *expected_sig,
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue