rust/tests/ui/const-generics/defaults/doesnt_infer.stderr

38 lines
1.3 KiB
Plaintext

error[E0284]: type annotations needed for `Foo<_>`
--> $DIR/doesnt_infer.rs:13:9
|
LL | let foo = Foo::foo();
| ^^^ ---------- type must be known at this point
|
note: required by a const generic parameter in `Foo::<N>::foo`
--> $DIR/doesnt_infer.rs:5:6
|
LL | impl<const N: u32> Foo<N> {
| ^^^^^^^^^^^^ required by this const generic parameter in `Foo::<N>::foo`
LL | fn foo() -> Self {
| --- required by a bound in this associated function
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
|
LL | let foo: Foo<N> = Foo::foo();
| ++++++++
error[E0284]: type annotations needed for `Foo<_>`
--> $DIR/doesnt_infer.rs:13:9
|
LL | let foo = Foo::foo();
| ^^^ --- type must be known at this point
|
note: required by a const generic parameter in `Foo`
--> $DIR/doesnt_infer.rs:3:12
|
LL | struct Foo<const N: u32 = 2>;
| ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo`
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
|
LL | let foo: Foo<N> = Foo::foo();
| ++++++++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0284`.