-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Restrict recursive opaque type check #113636
Restrict recursive opaque type check #113636
Conversation
@bors try |
⌛ Trying commit 0871d66e463572a466d36634f9993526c7dd80dc with merge 168adca86021b4acdae9e717a4c09015b0f1062f... |
0871d66
to
5e179f7
Compare
@bors try |
⌛ Trying commit 5e179f7364488f069858d7bda7259aba7f42a526 with merge 1066537ce94b83c04b9e840838af0b66b0ef1500... |
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
41e77ae
to
d4fcef7
Compare
🎉 Experiment
|
All regressions are spurious disk failures @bors r+ |
📌 Commit d4fcef7df7b25f0d24b57531dc2289f4cfa2c23e has been approved by It is now in the queue for this repository. |
☔ The latest upstream changes (presumably #113328) made this pull request unmergeable. Please resolve the merge conflicts. |
d4fcef7
to
ef0a872
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
.is_break() | ||
if let ty::Alias(ty::Opaque, alias_ty) = hidden_type.ty.kind() | ||
&& alias_ty.def_id == opaque_type_key.def_id.to_def_id() | ||
&& alias_ty.substs == opaque_type_key.substs |
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.
The previous check was only checking the def_id.
This would accept TAIT<T, U>
being inferred to Tait<u32, u32>
.
Do we want to accept that?
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.
that is rejected later. I guess we could do some of these checks here, too, but I don't see any way we could miss doing the checks (as we get the hidden type from borrowck, not from typeck)
d1930d1
to
6875589
Compare
@bors r+ |
⌛ Testing commit 6875589 with merge f19439247f57f0c68e397536e9fb07b018599a72... |
💔 Test failed - checks-actions |
@bors retry empty log |
☀️ Test successful - checks-actions |
Finished benchmarking commit (d351515): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 660.475s -> 658.716s (-0.27%) |
…piler-errors Add test for 113326 Closes rust-lang#113326 Bisecting points to rust-lang#113636 as the fix
Rollup merge of rust-lang#116801 - clubby789:issue-113326-test, r=compiler-errors Add test for 113326 Closes rust-lang#113326 Bisecting points to rust-lang#113636 as the fix
We have a recursive opaque check in writeback to avoid inferring the hidden of an opaque type to be itself:
rust/compiler/rustc_hir_typeck/src/writeback.rs
Lines 556 to 575 in 33a2c24
Issue #113619 treats
make_option2
as not defining the TAITTestImpl
since it is inferred to have the definitionTestImpl := B<TestImpl>
, which fails this check. This regressed in #102700 (5d15beb), I think due to the refactoring that made us record the hidden types of TAITs during writeback.However, nothing actually seems to go bad if we relax this recursion checker to only check for directly recursive definitions. This PR fixes #113619 by changing this recursive check from being a visitor to just checking that the hidden type is exactly the same as the opaque being inferred.
Alternatively, we may be able to fix #113619 by restricting this recursion check only to RPITs/async fns. It seems to only be possible to use misuse the recursion check to cause ICEs for TAITs (though I didn't try too hard to create a bad RPIT example... may be possible, actually.)
r? @oli-obk
--
Fixes #113314