-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Add regression test for nested associated-type projection ICE #160087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+104
−0
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
tests/ui/associated-types/nested-assoc-type-projection-ice-109864.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| //! Regression test for <https://github.com/rust-lang/rust/issues/109864>. | ||
| //! | ||
| //! Deeply nested associated-type projections used to ICE with "type variables | ||
| //! should not be hashed" — but only under incremental compilation. They should now | ||
| //! produce ordinary trait-bound errors instead of crashing. | ||
|
|
||
| //@ incremental | ||
|
|
||
| struct S; | ||
| struct S2<P>(); //~ ERROR type parameter `P` is never used | ||
|
|
||
| trait Foo<A> { | ||
| type Out; | ||
| } | ||
|
|
||
| trait Bar<A, B> { | ||
| type Out; | ||
| } | ||
|
|
||
| trait Qux<A> { | ||
| type Out; | ||
| } | ||
|
|
||
| trait Fuzz<A> { | ||
| type Out; | ||
| } | ||
|
|
||
| impl<A: Foo<B>, B> Fuzz<S2<B>> for S2<A> { | ||
| type Out = <<A as Foo<B>>::Out as Bar< | ||
| //~^ ERROR the trait bound `<A as Foo<B>>::Out: Qux<S>` is not satisfied | ||
| //~| ERROR the trait bound `<A as Foo<B>>::Out: Bar<S2<A>, _>` is not satisfied | ||
| //~| ERROR the trait bound `<A as Foo<B>>::Out: Bar<S2<A>, _>` is not satisfied | ||
| S2<A>, | ||
| <<<A as Foo<B>>::Out as Qux<S>>::Out as Fuzz<S2<B>>>::Out, | ||
| //~^ ERROR the trait bound `<A as Foo<B>>::Out: Qux<S>` is not satisfied | ||
| >>::Out; | ||
| } | ||
|
|
||
| fn main() {} |
65 changes: 65 additions & 0 deletions
65
tests/ui/associated-types/nested-assoc-type-projection-ice-109864.stderr
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| error[E0392]: type parameter `P` is never used | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:10:11 | ||
| | | ||
| LL | struct S2<P>(); | ||
| | ^ unused type parameter | ||
| | | ||
| = help: consider removing `P`, referring to it in a field, or using a marker such as `PhantomData` | ||
| = help: if you intended `P` to be a const parameter, use `const P: /* Type */` instead | ||
|
|
||
| error[E0277]: the trait bound `<A as Foo<B>>::Out: Qux<S>` is not satisfied | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:16 | ||
| | | ||
| LL | type Out = <<A as Foo<B>>::Out as Bar< | ||
| | ________________^ | ||
| ... | | ||
| LL | | >>::Out; | ||
| | |___________^ the trait `Qux<S>` is not implemented for `<A as Foo<B>>::Out` | ||
| | | ||
| help: consider further restricting the associated type | ||
| | | ||
| LL | impl<A: Foo<B>, B> Fuzz<S2<B>> for S2<A> where <A as Foo<B>>::Out: Qux<S> { | ||
| | ++++++++++++++++++++++++++++++++ | ||
|
|
||
| error[E0277]: the trait bound `<A as Foo<B>>::Out: Bar<S2<A>, _>` is not satisfied | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:16 | ||
| | | ||
| LL | type Out = <<A as Foo<B>>::Out as Bar< | ||
| | ________________^ | ||
| ... | | ||
| LL | | >>::Out; | ||
| | |___________^ the trait `Bar<S2<A>, _>` is not implemented for `<A as Foo<B>>::Out` | ||
| | | ||
| help: this trait has no implementations, consider adding one | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:16:1 | ||
| | | ||
| LL | trait Bar<A, B> { | ||
| | ^^^^^^^^^^^^^^^ | ||
|
|
||
| error[E0277]: the trait bound `<A as Foo<B>>::Out: Qux<S>` is not satisfied | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:34:10 | ||
| | | ||
| LL | <<<A as Foo<B>>::Out as Qux<S>>::Out as Fuzz<S2<B>>>::Out, | ||
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Qux<S>` is not implemented for `<A as Foo<B>>::Out` | ||
| | | ||
| help: consider further restricting the associated type | ||
| | | ||
| LL | impl<A: Foo<B>, B> Fuzz<S2<B>> for S2<A> where <A as Foo<B>>::Out: Qux<S> { | ||
| | ++++++++++++++++++++++++++++++++ | ||
|
|
||
| error[E0277]: the trait bound `<A as Foo<B>>::Out: Bar<S2<A>, _>` is not satisfied | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:29:5 | ||
| | | ||
| LL | type Out = <<A as Foo<B>>::Out as Bar< | ||
| | ^^^^^^^^ the trait `Bar<S2<A>, _>` is not implemented for `<A as Foo<B>>::Out` | ||
| | | ||
| help: this trait has no implementations, consider adding one | ||
| --> $DIR/nested-assoc-type-projection-ice-109864.rs:16:1 | ||
| | | ||
| LL | trait Bar<A, B> { | ||
| | ^^^^^^^^^^^^^^^ | ||
|
|
||
| error: aborting due to 5 previous errors | ||
|
|
||
| Some errors have detailed explanations: E0277, E0392. | ||
| For more information about an error, try `rustc --explain E0277`. |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue was an incremental ICE, it only reproduces if incremental is enabled. Please check how other ui tests enable incremental and use that here, too
View changes since the review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review, Added
//@ incrementalso the test runs in incremental mode, now produces the trait-bound errors there instead of crashing.@rustbot ready