-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4def89
commit 1e27b65
Showing
5 changed files
with
99 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#![feature(const_trait_impl)] | ||
#![allow(incomplete_features)] | ||
|
||
struct Foo; | ||
|
||
const impl Foo { //~ ERROR: expected identifier, found keyword | ||
fn bar() {} | ||
} | ||
|
||
fn main() { | ||
// shouldn't error here because we shouldn't have been able to recover above | ||
Foo::bar(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/test/ui/rfc-2632-const-trait-impl/const-impl-norecover.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
error: expected identifier, found keyword `impl` | ||
--> $DIR/const-impl-norecover.rs:6:7 | ||
| | ||
LL | const impl Foo { | ||
| ^^^^ expected identifier, found keyword | ||
|
||
error: aborting due to previous error | ||
|
16 changes: 16 additions & 0 deletions
16
src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![feature(const_trait_impl)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo {} | ||
|
||
const impl Foo for i32 {} //~ ERROR: expected identifier, found keyword | ||
|
||
trait Bar {} | ||
|
||
const impl<T: Foo> Bar for T {} //~ ERROR: expected identifier, found keyword | ||
|
||
const fn still_implements<T: Bar>() {} | ||
|
||
const _: () = still_implements::<i32>(); | ||
|
||
fn main() {} |
24 changes: 24 additions & 0 deletions
24
src/test/ui/rfc-2632-const-trait-impl/const-impl-recovery.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
error: expected identifier, found keyword `impl` | ||
--> $DIR/const-impl-recovery.rs:6:7 | ||
| | ||
LL | const impl Foo for i32 {} | ||
| ^^^^ expected identifier, found keyword | ||
| | ||
help: you might have meant to write a const trait impl | ||
| | ||
LL | impl const Foo for i32 {} | ||
|-- ^^^^^ | ||
|
||
error: expected identifier, found keyword `impl` | ||
--> $DIR/const-impl-recovery.rs:10:7 | ||
| | ||
LL | const impl<T: Foo> Bar for T {} | ||
| ^^^^ expected identifier, found keyword | ||
| | ||
help: you might have meant to write a const trait impl | ||
| | ||
LL | impl<T: Foo> const Bar for T {} | ||
|-- ^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|