Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion compiler/rustc_parse/src/parser/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/traits/const-traits/parse-const-unsafe-trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Test that `const unsafe trait` and `const unsafe auto trait` works.

//@ check-pass

#![feature(const_trait_impl)]
#![feature(auto_traits)]

pub const unsafe trait Owo {}
const unsafe trait OwO {}
pub const unsafe auto trait UwU {}
const unsafe auto trait Uwu {}

fn main() {}
Loading