diagnostics: avoid ICE for undeclared generic parameter in impl#154182
Open
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Open
diagnostics: avoid ICE for undeclared generic parameter in impl#154182Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Unique-Usman wants to merge 1 commit intorust-lang:mainfrom
Conversation
Collaborator
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
b88bcb8 to
20d63f9
Compare
This comment has been minimized.
This comment has been minimized.
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>
20d63f9 to
b31dc4a
Compare
Contributor
Author
Collaborator
|
|
Member
|
Please, don't assign Matthias r? compiler |
Contributor
|
@bors r+ rollup |
Contributor
estebank
reviewed
Mar 21, 2026
Comment on lines
+1
to
+17
| 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> {} | ||
| | +++ |
Contributor
There was a problem hiding this comment.
(Not for this PR) It'd be nice if we didn't provide any suggestion in this case and instead mentioned that A takes no parameter (at this place, same thing for struct A<T> and impl<T> A<T, K> {} so that we emit a single error instead of two, but this is [p-low].
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Mar 21, 2026
…tebank
diagnostics: avoid ICE for undeclared generic parameter in impl
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`.
Fixes rust-lang#154165 and introduced by rust-lang#152913
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Mar 21, 2026
…tebank
diagnostics: avoid ICE for undeclared generic parameter in impl
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`.
Fixes rust-lang#154165 and introduced by rust-lang#152913
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Avoid an ICE for:
The compiler no longer panics and can proceed to emit existing diagnostics.
Adds
tests/ui/missing/undeclared-generic-parameter.rs.Fixes #154165 and introduced by #152913