-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Fix ReErased
leaking into typeck due to typeof(...)
recovery
#100185
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
let ty = tcx.type_of(tcx.hir().local_def_id(e.hir_id)); | ||
let ty_erased = tcx.type_of(tcx.hir().local_def_id(e.hir_id)); | ||
let ty = tcx.fold_regions(ty_erased, |r, _| { | ||
if r.is_erased() { tcx.lifetimes.re_static } else { r } |
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.
Likely makes more sense to never create the ReErased in the first place...
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 would require changing the type_of
query behavior for anon consts -- not sure what that would break though. I guess anon consts should be treating all those lifetimes as ReStatic like other consts though 🤔
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.
@jackh726: Oh... sooo this calls the typeck
query on the body of the AnonConst
, so all non-late lifetimes (incl ReStatic
) are erased during writeback. Don't think I can avoid getting ReErased
when I call tcx.type_of
.
Thanks @compiler-errors! 🙂 @bors r+ rollup |
…sleywiser Fix `ReErased` leaking into typeck due to `typeof(...)` recovery Fixes rust-lang#100183
…sleywiser Fix `ReErased` leaking into typeck due to `typeof(...)` recovery Fixes rust-lang#100183
…llaumeGomez Rollup of 8 pull requests Successful merges: - rust-lang#100185 (Fix `ReErased` leaking into typeck due to `typeof(...)` recovery) - rust-lang#100291 (constify some `CStr` methods) - rust-lang#101677 (Add test for rust-lang#101211) - rust-lang#101723 (Impove diagnostic for `.await`ing non-futures) - rust-lang#101724 (Allow unauthenticated users to add the `const-hack` label) - rust-lang#101731 (rustdoc: improve rustdoc HTML suggestions handling of nested generics) - rust-lang#101732 (Feature gate the `rustdoc::missing_doc_code_examples` lint) - rust-lang#101735 (rustdoc: fix treatment of backslash-escaped HTML) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #100183