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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
1.3 KiB
Plaintext
Raw Normal View History

2024-06-17 08:34:26 +00:00
error[E0284]: type annotations needed for `Foo<_>`
2024-05-29 17:06:50 +01:00
--> $DIR/doesnt_infer.rs:13:9
2021-10-20 23:36:50 +01:00
|
LL | let foo = Foo::foo();
2024-06-17 08:34:26 +00:00
| ^^^ ---------- type must be known at this point
2022-02-14 13:25:26 +01:00
|
note: required by a const generic parameter in `Foo::<N>::foo`
2024-06-17 08:34:26 +00:00
--> $DIR/doesnt_infer.rs:5:6
|
LL | impl<const N: u32> Foo<N> {
| ^^^^^^^^^^^^ required by this const generic parameter in `Foo::<N>::foo`
2024-06-17 08:34:26 +00:00
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`
2024-06-17 08:34:26 +00:00
--> $DIR/doesnt_infer.rs:3:12
|
LL | struct Foo<const N: u32 = 2>;
| ^^^^^^^^^^^^^^^^ required by this const generic parameter in `Foo`
2023-04-07 18:07:11 +10:00
help: consider giving `foo` an explicit type, where the value of const parameter `N` is specified
2022-02-14 13:25:26 +01:00
|
LL | let foo: Foo<N> = Foo::foo();
| ++++++++
2021-10-20 23:36:50 +01:00
2024-06-17 08:34:26 +00:00
error: aborting due to 2 previous errors
2021-10-20 23:36:50 +01:00
2024-06-17 08:34:26 +00:00
For more information about this error, try `rustc --explain E0284`.