-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.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,39 @@ | ||
// rust-lang/rust#119731 | ||
// ICE ... unevaluated constant UnevaluatedConst | ||
|
||
#![feature(generic_const_exprs)] | ||
#![allow(incomplete_features)] | ||
|
||
mod v20 { | ||
const v4: usize = 512; | ||
pub type v11 = [[usize; v4]; v4]; | ||
//~^ WARN type `v11` should have an upper camel case name | ||
const v2: v11 = [[256; v4]; v4]; | ||
|
||
const v0: [[usize; v4]; v4] = v6(v8); | ||
//~^ ERROR cannot find value `v8` in this scope | ||
//~| ERROR cannot find function `v6` in this scope | ||
pub struct v17<const v10: usize, const v7: v11> { | ||
//~^ WARN type `v17` should have an upper camel case name | ||
//~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter | ||
_p: (), | ||
} | ||
|
||
impl v17<512, v0> { | ||
pub const fn v21() -> v18 {} | ||
//~^ ERROR cannot find type `v18` in this scope | ||
} | ||
|
||
impl<const v10: usize> v17<v10, v2> { | ||
//~^ ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} | ||
//~| ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} | ||
pub const fn v21() -> v18 { | ||
//~^ ERROR cannot find type `v18` in this scope | ||
v18 { _p: () } | ||
//~^ ERROR cannot find struct, variant or union type `v18` in this scope | ||
} | ||
} | ||
} | ||
pub use v20::{v13, v17}; | ||
//~^ ERROR unresolved import `v20::v13` | ||
fn main() {} |
92 changes: 92 additions & 0 deletions
92
tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.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,92 @@ | ||
error[E0432]: unresolved import `v20::v13` | ||
--> $DIR/unevaluated-const-ice-119731.rs:37:15 | ||
| | ||
LL | pub use v20::{v13, v17}; | ||
| ^^^ | ||
| | | ||
| no `v13` in `v20` | ||
| help: a similar name exists in the module: `v11` | ||
|
||
error[E0425]: cannot find value `v8` in this scope | ||
--> $DIR/unevaluated-const-ice-119731.rs:13:38 | ||
| | ||
LL | const v0: [[usize; v4]; v4] = v6(v8); | ||
| ^^ not found in this scope | ||
|
||
error[E0412]: cannot find type `v18` in this scope | ||
--> $DIR/unevaluated-const-ice-119731.rs:23:31 | ||
| | ||
LL | pub type v11 = [[usize; v4]; v4]; | ||
| --------------------------------- similarly named type alias `v11` defined here | ||
... | ||
LL | pub const fn v21() -> v18 {} | ||
| ^^^ help: a type alias with a similar name exists: `v11` | ||
|
||
error[E0412]: cannot find type `v18` in this scope | ||
--> $DIR/unevaluated-const-ice-119731.rs:30:31 | ||
| | ||
LL | pub type v11 = [[usize; v4]; v4]; | ||
| --------------------------------- similarly named type alias `v11` defined here | ||
... | ||
LL | pub const fn v21() -> v18 { | ||
| ^^^ help: a type alias with a similar name exists: `v11` | ||
|
||
error[E0422]: cannot find struct, variant or union type `v18` in this scope | ||
--> $DIR/unevaluated-const-ice-119731.rs:32:13 | ||
| | ||
LL | pub type v11 = [[usize; v4]; v4]; | ||
| --------------------------------- similarly named type alias `v11` defined here | ||
... | ||
LL | v18 { _p: () } | ||
| ^^^ help: a type alias with a similar name exists: `v11` | ||
|
||
warning: type `v11` should have an upper camel case name | ||
--> $DIR/unevaluated-const-ice-119731.rs:9:14 | ||
| | ||
LL | pub type v11 = [[usize; v4]; v4]; | ||
| ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V11` | ||
| | ||
= note: `#[warn(non_camel_case_types)]` on by default | ||
|
||
warning: type `v17` should have an upper camel case name | ||
--> $DIR/unevaluated-const-ice-119731.rs:16:16 | ||
| | ||
LL | pub struct v17<const v10: usize, const v7: v11> { | ||
| ^^^ help: convert the identifier to upper camel case (notice the capitalization): `V17` | ||
|
||
error[E0425]: cannot find function `v6` in this scope | ||
--> $DIR/unevaluated-const-ice-119731.rs:13:35 | ||
| | ||
LL | const v0: [[usize; v4]; v4] = v6(v8); | ||
| ^^ not found in this scope | ||
|
||
error: `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter | ||
--> $DIR/unevaluated-const-ice-119731.rs:16:48 | ||
| | ||
LL | pub struct v17<const v10: usize, const v7: v11> { | ||
| ^^^ | ||
| | ||
= note: the only supported types are integers, `bool` and `char` | ||
help: add `#![feature(adt_const_params)]` to the crate attributes to enable more complex and user defined types | ||
| | ||
LL + #![feature(adt_const_params)] | ||
| | ||
|
||
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} | ||
--> $DIR/unevaluated-const-ice-119731.rs:27:37 | ||
| | ||
LL | impl<const v10: usize> v17<v10, v2> { | ||
| ^^ | ||
|
||
error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1} | ||
--> $DIR/unevaluated-const-ice-119731.rs:27:37 | ||
| | ||
LL | impl<const v10: usize> v17<v10, v2> { | ||
| ^^ | ||
| | ||
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` | ||
|
||
error: aborting due to 9 previous errors; 2 warnings emitted | ||
|
||
Some errors have detailed explanations: E0412, E0422, E0425, E0432. | ||
For more information about an error, try `rustc --explain E0412`. |