Fix ReErased leaking into typeck due to typeof(...) recovery#100185
Merged
bors merged 1 commit intorust-lang:masterfrom Sep 13, 2022
Merged
Fix ReErased leaking into typeck due to typeof(...) recovery#100185bors merged 1 commit intorust-lang:masterfrom
ReErased leaking into typeck due to typeof(...) recovery#100185bors merged 1 commit intorust-lang:masterfrom
Conversation
Contributor
|
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
jackh726
reviewed
Aug 6, 2022
| 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 } |
Member
There was a problem hiding this comment.
Likely makes more sense to never create the ReErased in the first place...
Contributor
Author
There was a problem hiding this comment.
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 🤔
Contributor
Author
There was a problem hiding this comment.
@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.
wesleywiser
approved these changes
Sep 12, 2022
Member
|
Thanks @compiler-errors! 🙂 @bors r+ rollup |
Collaborator
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Sep 12, 2022
…sleywiser Fix `ReErased` leaking into typeck due to `typeof(...)` recovery Fixes rust-lang#100183
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Sep 12, 2022
…sleywiser Fix `ReErased` leaking into typeck due to `typeof(...)` recovery Fixes rust-lang#100183
This was referenced Sep 12, 2022
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Sep 12, 2022
…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
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #100183