feat: implement better error for manual impl of Fn*
traits
This commit is contained in:
parent
6a179026de
commit
a30c2c26c0
10 changed files with 143 additions and 52 deletions
|
@ -5,7 +5,7 @@ use rustc_errors::{
|
|||
error_code, Applicability, DiagnosticBuilder, ErrorGuaranteed, Handler, IntoDiagnostic,
|
||||
MultiSpan,
|
||||
};
|
||||
use rustc_macros::Diagnostic;
|
||||
use rustc_macros::{Diagnostic, Subdiagnostic};
|
||||
use rustc_middle::ty::Ty;
|
||||
use rustc_span::{symbol::Ident, Span, Symbol};
|
||||
|
||||
|
@ -129,6 +129,18 @@ pub struct AssocTypeBindingNotAllowed {
|
|||
#[primary_span]
|
||||
#[label]
|
||||
pub span: Span,
|
||||
|
||||
#[subdiagnostic]
|
||||
pub fn_trait_expansion: Option<ParenthesizedFnTraitExpansion>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
#[help(hir_analysis_parenthesized_fn_trait_expansion)]
|
||||
pub struct ParenthesizedFnTraitExpansion {
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
|
||||
pub expanded_type: String,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue