Create E0777 error code for "invalid literal in derive"
This commit is contained in:
parent
782013564e
commit
de21c3df0e
5 changed files with 44 additions and 4 deletions
|
@ -5,7 +5,7 @@ use rustc_ast::token;
|
|||
use rustc_ast::tokenstream::{TokenStream, TokenTree};
|
||||
use rustc_ast::{self as ast, *};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_errors::{Applicability, ErrorReported};
|
||||
use rustc_errors::{struct_span_err, Applicability, ErrorReported};
|
||||
use rustc_parse::nt_to_tokenstream;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
|
@ -182,9 +182,14 @@ crate fn collect_derives(cx: &mut ExtCtxt<'_>, attrs: &mut Vec<ast::Attribute>)
|
|||
.filter_map(|nmi| match nmi {
|
||||
NestedMetaItem::Literal(lit) => {
|
||||
error_reported_filter_map = true;
|
||||
cx.struct_span_err(lit.span, "expected path to a trait, found literal")
|
||||
.help("for example, write `#[derive(Debug)]` for `Debug`")
|
||||
.emit();
|
||||
struct_span_err!(
|
||||
cx.sess,
|
||||
lit.span,
|
||||
E0777,
|
||||
"expected path to a trait, found literal",
|
||||
)
|
||||
.help("for example, write `#[derive(Debug)]` for `Debug`")
|
||||
.emit();
|
||||
None
|
||||
}
|
||||
NestedMetaItem::MetaItem(mi) => Some(mi),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue