diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-02-25 10:22:19 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-03-11 12:05:02 +0000 |
| commit | 43e39260f9bc02e79891b87f346b456a069967f5 (patch) | |
| tree | 32b5e0dd6c92d26b7ee09cb2e15fb8ddb427bfc1 | |
| parent | 3e4e65ee8b8c5d7a1916fd6377901416f06dca4d (diff) | |
| download | rust-43e39260f9bc02e79891b87f346b456a069967f5.tar.gz rust-43e39260f9bc02e79891b87f346b456a069967f5.zip | |
Keep items around even if builtin macros on them fail to parse
| -rw-r--r-- | compiler/rustc_expand/src/expand.rs | 4 | ||||
| -rw-r--r-- | tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs | 1 | ||||
| -rw-r--r-- | tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr | 9 |
3 files changed, 3 insertions, 11 deletions
diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index c523bcece72..87f01be26c2 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -780,8 +780,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { } } Err(err) => { - let guar = err.emit(); - fragment_kind.dummy(span, guar) + let _guar = err.emit(); + fragment_kind.expect_from_annotatables(iter::once(item)) } } } diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs index 11825dc54ee..2ca2a753e20 100644 --- a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs +++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.rs @@ -10,4 +10,3 @@ fn foo() {} #[define_opaque(Tait<()>)] //~^ ERROR: expected one of `(`, `,`, `::`, or `=`, found `<` fn main() {} -//~^ ERROR: `main` function not found diff --git a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr index 8f33f336728..96e8bc9851c 100644 --- a/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr +++ b/tests/ui/type-alias-impl-trait/define_opaques_attr/generics.stderr @@ -10,12 +10,6 @@ error: expected one of `(`, `,`, `::`, or `=`, found `<` LL | #[define_opaque(Tait<()>)] | ^ expected one of `(`, `,`, `::`, or `=` -error[E0601]: `main` function not found in crate `generics` - --> $DIR/generics.rs:12:13 - | -LL | fn main() {} - | ^ consider adding a `main` function to `$DIR/generics.rs` - error: unconstrained opaque type --> $DIR/generics.rs:3:16 | @@ -24,6 +18,5 @@ LL | type Tait<T> = impl Sized; | = note: `Tait` must be used in combination with a concrete type within the same crate -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0601`. |
