Improve diagnostic for E0178 (bad +
in type)
Namely, use a more sensical primary span. Don't pretty-print AST nodes for the diagnostic message. Why: * It's lossy (e.g., it doesn't replicate trailing `+`s in trait objects. * It's prone to leak error nodes (printed as `(/*ERROR*/)`) since the LHS can easily represent recovered code (e.g., `fn(i32?) + T`).
This commit is contained in:
parent
8887af72a0
commit
6242335fdb
14 changed files with 51 additions and 52 deletions
|
@ -30,7 +30,6 @@ pub(crate) struct AmbiguousPlus {
|
|||
#[derive(Diagnostic)]
|
||||
#[diag(parse_maybe_recover_from_bad_type_plus, code = E0178)]
|
||||
pub(crate) struct BadTypePlus {
|
||||
pub ty: String,
|
||||
#[primary_span]
|
||||
pub span: Span,
|
||||
#[subdiagnostic]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue