Parse const unsafe trait properly

Previously, this was greedily stolen by the `fn` parsing logic.
This commit is contained in:
Deadbeef
2025-10-18 23:35:23 +00:00
parent 6380899f32
commit b145213cee
2 changed files with 17 additions and 1 deletions

View File

@@ -2664,7 +2664,10 @@ impl<'a> Parser<'a> {
// Rule out `unsafe extern {`.
&& !self.is_unsafe_foreign_mod()
// Rule out `async gen {` and `async gen move {`
&& !self.is_async_gen_block())
&& !self.is_async_gen_block()
// Rule out `const unsafe auto` and `const unsafe trait`.
&& !self.is_keyword_ahead(2, &[kw::Auto, kw::Trait])
)
})
// `extern ABI fn`
|| self.check_keyword_case(exp!(Extern), case)