9479792cb4
Rustc of course already WF-checked the field types at the definition site, but for error tainting of consts to work properly, there needs to be an error emitted at the use site. Previously, with no use-site error, we proceeded with CTFE and ran into ICEs since we are running code with type errors. Emitting use-site errors also brings struct-like constructors more in line with fn-like constructors since they already emit use-site errors for WF issues.
36 lines
1006 B
Plaintext
36 lines
1006 B
Plaintext
error: unconstrained generic constant
|
|
--> $DIR/no_where_clause.rs:10:6
|
|
|
|
|
LL | b: [f32; complex_maths(N)],
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try adding a `where` bound
|
|
|
|
|
LL | pub struct Example<const N: usize> where [(); complex_maths(N)]: {
|
|
| +++++++++++++++++++++++++++++
|
|
|
|
error: unconstrained generic constant
|
|
--> $DIR/no_where_clause.rs:18:10
|
|
|
|
|
LL | b: [0.; complex_maths(N)],
|
|
| ^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try adding a `where` bound
|
|
|
|
|
LL | pub fn new() -> Self where [(); complex_maths(N)]: {
|
|
| +++++++++++++++++++++++++++++
|
|
|
|
error: unconstrained generic constant
|
|
--> $DIR/no_where_clause.rs:18:15
|
|
|
|
|
LL | b: [0.; complex_maths(N)],
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
help: try adding a `where` bound
|
|
|
|
|
LL | pub fn new() -> Self where [(); complex_maths(N)]: {
|
|
| +++++++++++++++++++++++++++++
|
|
|
|
error: aborting due to 3 previous errors
|
|
|