File tree 2 files changed +2
-6
lines changed
compiler/rustc_parse/src/parser
2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -1231,7 +1231,7 @@ impl<'a> Parser<'a> {
1231
1231
}
1232
1232
let enum_field_start_span = this. token . span ;
1233
1233
let ident = this. parse_field_ident ( "enum" , vlo) ?;
1234
- if this. token . kind == token:: Colon {
1234
+ if this. token . kind == token:: Colon && !start_span . in_derive_expansion ( ) {
1235
1235
let snapshot = this. clone ( ) ;
1236
1236
this. bump ( ) ;
1237
1237
match this. parse_ty ( ) {
@@ -1612,7 +1612,7 @@ impl<'a> Parser<'a> {
1612
1612
{
1613
1613
let snapshot = self . clone ( ) ;
1614
1614
if let Err ( err) = self . parse_ty ( ) {
1615
- if let Some ( span) = start_span {
1615
+ if let Some ( span) = start_span && !span . in_derive_expansion ( ) {
1616
1616
error. span_suggestion_verbose (
1617
1617
span,
1618
1618
"consider using `enum` instead of `struct`" ,
Original file line number Diff line number Diff line change @@ -5,10 +5,6 @@ LL | #[derive(A)]
5
5
| ^ expected `:`
6
6
|
7
7
= note: this error originates in the derive macro `A` (in Nightly builds, run with -Z macro-backtrace for more info)
8
- help: consider using `enum` instead of `struct`
9
- |
10
- LL | #[derive(enum)]
11
- | ~~~~
12
8
13
9
error: proc-macro derive produced unparseable tokens
14
10
--> $DIR/derive-bad.rs:6:10
You can’t perform that action at this time.
0 commit comments