Skip to content

Commit cb478d2

Browse files
committed
Add parse fail test using safe trait/impl trait
1 parent c3774be commit cb478d2

File tree

6 files changed

+49
-0
lines changed

6 files changed

+49
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!` or `::`, found keyword `impl`
2+
--> $DIR/safe-impl-trait.rs:5:6
3+
|
4+
LL | safe impl Bar for () { }
5+
| ^^^^ expected one of `!` or `::`
6+
7+
error: aborting due to 1 previous error
8+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//@ revisions: gated ungated
2+
#![cfg_attr(gated, feature(unsafe_extern_blocks))]
3+
4+
trait Bar {}
5+
safe impl Bar for () { }
6+
//[gated]~^ ERROR expected one of `!` or `::`, found keyword `impl`
7+
//[ungated]~^^ ERROR expected one of `!` or `::`, found keyword `impl`
8+
9+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!` or `::`, found keyword `impl`
2+
--> $DIR/safe-impl-trait.rs:5:6
3+
|
4+
LL | safe impl Bar for () { }
5+
| ^^^^ expected one of `!` or `::`
6+
7+
error: aborting due to 1 previous error
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!` or `::`, found keyword `trait`
2+
--> $DIR/safe-trait.rs:4:6
3+
|
4+
LL | safe trait Foo {}
5+
| ^^^^^ expected one of `!` or `::`
6+
7+
error: aborting due to 1 previous error
8+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ revisions: gated ungated
2+
#![cfg_attr(gated, feature(unsafe_extern_blocks))]
3+
4+
safe trait Foo {}
5+
//[gated]~^ ERROR expected one of `!` or `::`, found keyword `trait`
6+
//[ungated]~^^ ERROR expected one of `!` or `::`, found keyword `trait`
7+
8+
fn main() {}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected one of `!` or `::`, found keyword `trait`
2+
--> $DIR/safe-trait.rs:4:6
3+
|
4+
LL | safe trait Foo {}
5+
| ^^^^^ expected one of `!` or `::`
6+
7+
error: aborting due to 1 previous error
8+

0 commit comments

Comments
 (0)