mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-01 15:50:05 +03:00
b31dc4ab49
Avoid an ICE for:
struct A;
impl A<B> {}
The compiler no longer panics and can proceed to emit existing diagnostics.
Adds `tests/ui/missing/undeclared-generic-parameter.rs`.
Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
37 lines
939 B
Plaintext
37 lines
939 B
Plaintext
error[E0425]: cannot find type `B` in this scope
|
|
--> $DIR/undeclared-generic-parameter.rs:2:8
|
|
|
|
|
LL | struct A;
|
|
| --------- similarly named struct `A` defined here
|
|
LL | impl A<B> {}
|
|
| ^
|
|
|
|
|
help: a struct with a similar name exists
|
|
|
|
|
LL - impl A<B> {}
|
|
LL + impl A<A> {}
|
|
|
|
|
help: you might be missing a type parameter
|
|
|
|
|
LL | impl<B> A<B> {}
|
|
| +++
|
|
|
|
error[E0107]: struct takes 0 generic arguments but 1 generic argument was supplied
|
|
--> $DIR/undeclared-generic-parameter.rs:2:6
|
|
|
|
|
LL | impl A<B> {}
|
|
| ^--- help: remove the unnecessary generics
|
|
| |
|
|
| expected 0 generic arguments
|
|
|
|
|
note: struct defined here, with 0 generic parameters
|
|
--> $DIR/undeclared-generic-parameter.rs:1:8
|
|
|
|
|
LL | struct A;
|
|
| ^
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
Some errors have detailed explanations: E0107, E0425.
|
|
For more information about an error, try `rustc --explain E0107`.
|