Skip to content

Commit

Permalink
Add parse fail test using safe trait/impl trait
Browse files Browse the repository at this point in the history
  • Loading branch information
spastorino committed Jul 2, 2024
1 parent c3774be commit cb478d2
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `!` or `::`, found keyword `impl`
--> $DIR/safe-impl-trait.rs:5:6
|
LL | safe impl Bar for () { }
| ^^^^ expected one of `!` or `::`

error: aborting due to 1 previous error

9 changes: 9 additions & 0 deletions tests/ui/rust-2024/unsafe-extern-blocks/safe-impl-trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//@ revisions: gated ungated
#![cfg_attr(gated, feature(unsafe_extern_blocks))]

trait Bar {}
safe impl Bar for () { }
//[gated]~^ ERROR expected one of `!` or `::`, found keyword `impl`
//[ungated]~^^ ERROR expected one of `!` or `::`, found keyword `impl`

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `!` or `::`, found keyword `impl`
--> $DIR/safe-impl-trait.rs:5:6
|
LL | safe impl Bar for () { }
| ^^^^ expected one of `!` or `::`

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `!` or `::`, found keyword `trait`
--> $DIR/safe-trait.rs:4:6
|
LL | safe trait Foo {}
| ^^^^^ expected one of `!` or `::`

error: aborting due to 1 previous error

8 changes: 8 additions & 0 deletions tests/ui/rust-2024/unsafe-extern-blocks/safe-trait.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ revisions: gated ungated
#![cfg_attr(gated, feature(unsafe_extern_blocks))]

safe trait Foo {}
//[gated]~^ ERROR expected one of `!` or `::`, found keyword `trait`
//[ungated]~^^ ERROR expected one of `!` or `::`, found keyword `trait`

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected one of `!` or `::`, found keyword `trait`
--> $DIR/safe-trait.rs:4:6
|
LL | safe trait Foo {}
| ^^^^^ expected one of `!` or `::`

error: aborting due to 1 previous error

0 comments on commit cb478d2

Please sign in to comment.