forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#87134 - BoxyUwU:cgd-self-ty-error, r=lcnr
Make SelfInTyParamDefault wording not be specific to type defaults r? ``@lcnr``
- Loading branch information
Showing
6 changed files
with
60 additions
and
23 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
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
16 changes: 16 additions & 0 deletions
16
src/test/ui/const-generics/defaults/default-const-param-cannot-reference-self.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_generics_defaults)] | ||
|
||
struct Struct<const N: usize = { Self; 10 }>; | ||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735] | ||
|
||
enum Enum<const N: usize = { Self; 10 }> { } | ||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735] | ||
|
||
union Union<const N: usize = { Self; 10 }> { not_empty: () } | ||
//~^ ERROR generic parameters cannot use `Self` in their defaults [E0735] | ||
|
||
fn main() { | ||
let _: Struct; | ||
let _: Enum; | ||
let _: Union; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/ui/const-generics/defaults/default-const-param-cannot-reference-self.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,21 @@ | ||
error[E0735]: generic parameters cannot use `Self` in their defaults | ||
--> $DIR/default-const-param-cannot-reference-self.rs:3:34 | ||
| | ||
LL | struct Struct<const N: usize = { Self; 10 }>; | ||
| ^^^^ `Self` in generic parameter default | ||
|
||
error[E0735]: generic parameters cannot use `Self` in their defaults | ||
--> $DIR/default-const-param-cannot-reference-self.rs:6:30 | ||
| | ||
LL | enum Enum<const N: usize = { Self; 10 }> { } | ||
| ^^^^ `Self` in generic parameter default | ||
|
||
error[E0735]: generic parameters cannot use `Self` in their defaults | ||
--> $DIR/default-const-param-cannot-reference-self.rs:9:32 | ||
| | ||
LL | union Union<const N: usize = { Self; 10 }> { not_empty: () } | ||
| ^^^^ `Self` in generic parameter default | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0735`. |
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
24 changes: 12 additions & 12 deletions
24
src/test/ui/generics/issue-61631-default-type-param-cannot-reference-self.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