-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Work around ICE in diagnostics for local super-universes missing UniverseInfo
s
#115384
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a725436
return default `UniverseInfo` cause in `RegionInferenceContext`
lqd f3a1bae
add test for issue 114907
lqd 4076951
remove dummy UniverseInfo causes from type checker `instantiate_canon…
lqd ae963b5
remove dummy UniverseInfo causes from type checker `type_check`
lqd 10ef8d9
remove dummy UniverseInfo causes from type checker `fully_perform_op`
lqd 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
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
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
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
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,40 @@ | ||
// This is a non-regression test for issue #114907 where an ICE happened because of missing | ||
// `UniverseInfo`s accessed during diagnostics. | ||
// | ||
// A couple notes: | ||
// - the `FnOnce` bounds need an arg that is a reference | ||
// - a custom `Drop` is needed somewhere in the type that `accept` returns, to create universes | ||
// during liveness and dropck outlives computation | ||
|
||
// check-fail | ||
|
||
trait Role { | ||
type Inner; | ||
} | ||
|
||
struct HandshakeCallback<C>(C); | ||
impl<C: FnOnce(&())> Role for HandshakeCallback<C> { | ||
type Inner = (); | ||
} | ||
|
||
struct Handshake<R: Role> { | ||
_inner: Option<R::Inner>, | ||
} | ||
impl<R: Role> Drop for Handshake<R> { | ||
fn drop(&mut self) {} | ||
} | ||
|
||
fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> { | ||
todo!() | ||
} | ||
|
||
fn main() { | ||
let callback = |_| {}; | ||
accept(callback); | ||
//~^ ERROR mismatched types | ||
//~| ERROR mismatched types | ||
//~| ERROR implementation of `FnOnce` is not general enough | ||
//~| ERROR implementation of `FnOnce` is not general enough | ||
//~| ERROR higher-ranked subtype error | ||
//~| ERROR higher-ranked subtype error | ||
} |
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,79 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:5 | ||
| | ||
LL | accept(callback); | ||
| ^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected trait `for<'a> FnOnce<(&'a (),)>` | ||
found trait `FnOnce<(&(),)>` | ||
note: this closure does not fulfill the lifetime requirements | ||
--> $DIR/missing-universe-cause-issue-114907.rs:32:20 | ||
| | ||
LL | let callback = |_| {}; | ||
| ^^^ | ||
note: the lifetime requirement is introduced here | ||
--> $DIR/missing-universe-cause-issue-114907.rs:27:14 | ||
| | ||
LL | fn accept<C: FnOnce(&())>(_: C) -> Handshake<HandshakeCallback<C>> { | ||
| ^^^^^^^^^^^ | ||
help: consider specifying the type of the closure parameters | ||
| | ||
LL | let callback = |_: &_| {}; | ||
| ~~~~~~~ | ||
|
||
error: implementation of `FnOnce` is not general enough | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:5 | ||
| | ||
LL | accept(callback); | ||
| ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | ||
| | ||
= note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... | ||
= note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` | ||
|
||
error: implementation of `FnOnce` is not general enough | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:5 | ||
| | ||
LL | accept(callback); | ||
| ^^^^^^^^^^^^^^^^ implementation of `FnOnce` is not general enough | ||
| | ||
= note: closure with signature `fn(&'2 ())` must implement `FnOnce<(&'1 (),)>`, for any lifetime `'1`... | ||
= note: ...but it actually implements `FnOnce<(&'2 (),)>`, for some specific lifetime `'2` | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:5 | ||
| | ||
LL | accept(callback); | ||
| ^^^^^^^^^^^^^^^^ one type is more general than the other | ||
| | ||
= note: expected trait `for<'a> FnOnce<(&'a (),)>` | ||
found trait `FnOnce<(&(),)>` | ||
note: this closure does not fulfill the lifetime requirements | ||
--> $DIR/missing-universe-cause-issue-114907.rs:32:20 | ||
| | ||
LL | let callback = |_| {}; | ||
| ^^^ | ||
note: the lifetime requirement is introduced here | ||
--> $DIR/missing-universe-cause-issue-114907.rs:20:21 | ||
| | ||
LL | struct Handshake<R: Role> { | ||
| ^^^^ | ||
help: consider specifying the type of the closure parameters | ||
| | ||
LL | let callback = |_: &_| {}; | ||
| ~~~~~~~ | ||
|
||
error: higher-ranked subtype error | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:21 | ||
| | ||
LL | accept(callback); | ||
| ^ | ||
|
||
error: higher-ranked subtype error | ||
--> $DIR/missing-universe-cause-issue-114907.rs:33:21 | ||
| | ||
LL | accept(callback); | ||
| ^ | ||
|
||
error: aborting due to 6 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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.
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.
If we're going to do this here we should remove the places where we add
UniverseInfo::other
to universe causes.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.
I've pushed a few commits to remove these. I think that's all of them.