-
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
Check hidden types in dead code #102700
Check hidden types in dead code #102700
Conversation
match self.map.get(&r.into()).map(|k| k.unpack()) { | ||
Some(GenericArgKind::Lifetime(r1)) => r1, | ||
Some(u) => panic!("region mapped to unexpected kind: {:?}", u), | ||
None if self.do_not_error => self.tcx.lifetimes.re_static, | ||
None if generics.parent.is_some() => { | ||
if let Some(hidden_ty) = self.hidden_ty.take() { |
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.
Why did this code exist? What did it achieve?
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.
Oh, well it was dead code anyways. I should read the commit title.
☔ The latest upstream changes (presumably #101632) made this pull request unmergeable. Please resolve the merge conflicts. |
I literally wrote up a comment that had bors r+ but it's on a computer that I don't have access to for a day or two. Anyways this code makes sense to me and thanks for splitting it up into easily reviewable commits. @bors r+ rollup=never (just in case we want to bisect to this PR) |
☀️ Test successful - checks-actions |
Finished benchmarking commit (60bd3f9): comparison URL. Overall result: ❌✅ regressions and improvements - ACTION NEEDEDNext Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
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.
CyclesResultsThis 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.
Footnotes |
This is a small improvement for everything but the ctfe stress test. The stress test regressed in actual CTFE (though it also added a few additional query calls to @rustbot label: +perf-regression-triaged |
Check hidden types in dead code fixes rust-lang#99490 r? `@compiler-errors` best reviewed commit by commit
…ck-bad, r=oli-obk Restrict recursive opaque type check We have a recursive opaque check in writeback to avoid inferring the hidden of an opaque type to be itself: https://github.com/rust-lang/rust/blob/33a2c2487ac5d9927830ea4c1844335c6b9f77db/compiler/rustc_hir_typeck/src/writeback.rs#L556-L575 Issue rust-lang#113619 treats `make_option2` as not defining the TAIT `TestImpl` since it is inferred to have the definition `TestImpl := B<TestImpl>`, which fails this check. This regressed in rust-lang#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 rust-lang#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 rust-lang#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 rust-lang#113314
fixes #99490
r? @compiler-errors
best reviewed commit by commit