-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Showing
5 changed files
with
114 additions
and
12 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
12 changes: 12 additions & 0 deletions
12
tests/ui/parser/defaultness-invalid-places-fail-semantic.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,12 @@ | ||
#![feature(specialization)] //~ WARN the feature `specialization` is incomplete | ||
|
||
fn main() {} | ||
|
||
trait X { | ||
default const A: u8; //~ ERROR `default` is only allowed on items in trait impls | ||
default const B: u8 = 0; //~ ERROR `default` is only allowed on items in trait impls | ||
default type D; //~ ERROR `default` is only allowed on items in trait impls | ||
default type C: Ord; //~ ERROR `default` is only allowed on items in trait impls | ||
default fn f1(); //~ ERROR `default` is only allowed on items in trait impls | ||
default fn f2() {} //~ ERROR `default` is only allowed on items in trait impls | ||
} |
60 changes: 60 additions & 0 deletions
60
tests/ui/parser/defaultness-invalid-places-fail-semantic.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,60 @@ | ||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:6:5 | ||
| | ||
LL | default const A: u8; | ||
| -------^^^^^^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:7:5 | ||
| | ||
LL | default const B: u8 = 0; | ||
| -------^^^^^^^^^^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:8:5 | ||
| | ||
LL | default type D; | ||
| -------^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:9:5 | ||
| | ||
LL | default type C: Ord; | ||
| -------^^^^^^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:10:5 | ||
| | ||
LL | default fn f1(); | ||
| -------^^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
error: `default` is only allowed on items in trait impls | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:11:5 | ||
| | ||
LL | default fn f2() {} | ||
| -------^^^^^^^^ | ||
| | | ||
| `default` because of this | ||
|
||
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/trait-item-with-defaultness-fail-semantic.rs:1:12 | ||
| | ||
LL | #![feature(specialization)] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information | ||
= help: consider using `min_specialization` instead, which is more stable and complete | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: aborting due to 6 previous errors; 1 warning emitted | ||
|
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
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