Skip to content

Commit 43e3926

Browse files
committed
Keep items around even if builtin macros on them fail to parse
1 parent 3e4e65e commit 43e3926

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

Diff for: compiler/rustc_expand/src/expand.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
780780
}
781781
}
782782
Err(err) => {
783-
let guar = err.emit();
784-
fragment_kind.dummy(span, guar)
783+
let _guar = err.emit();
784+
fragment_kind.expect_from_annotatables(iter::once(item))
785785
}
786786
}
787787
}

Diff for: tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ fn foo() {}
1010
#[define_opaque(Tait<()>)]
1111
//~^ ERROR: expected one of `(`, `,`, `::`, or `=`, found `<`
1212
fn main() {}
13-
//~^ ERROR: `main` function not found

Diff for: tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr

+1-8
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ error: expected one of `(`, `,`, `::`, or `=`, found `<`
1010
LL | #[define_opaque(Tait<()>)]
1111
| ^ expected one of `(`, `,`, `::`, or `=`
1212

13-
error[E0601]: `main` function not found in crate `generics`
14-
--> $DIR/generics.rs:12:13
15-
|
16-
LL | fn main() {}
17-
| ^ consider adding a `main` function to `$DIR/generics.rs`
18-
1913
error: unconstrained opaque type
2014
--> $DIR/generics.rs:3:16
2115
|
@@ -24,6 +18,5 @@ LL | type Tait<T> = impl Sized;
2418
|
2519
= note: `Tait` must be used in combination with a concrete type within the same crate
2620

27-
error: aborting due to 4 previous errors
21+
error: aborting due to 3 previous errors
2822

29-
For more information about this error, try `rustc --explain E0601`.

0 commit comments

Comments
 (0)