Keep items around even if builtin macros on them fail to parse

This commit is contained in:
Oli Scherer 2025-02-25 10:22:19 +00:00
parent 3e4e65ee8b
commit 43e39260f9
3 changed files with 3 additions and 11 deletions

View file

@ -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))
}
}
}

View file

@ -10,4 +10,3 @@ fn foo() {}
#[define_opaque(Tait<()>)]
//~^ ERROR: expected one of `(`, `,`, `::`, or `=`, found `<`
fn main() {}
//~^ ERROR: `main` function not found

View file

@ -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`.