Skip to content

save-analysis: Don't ICE when resolving qualified type paths in struct members - #65353

Merged
bors merged 3 commits into
rust-lang:masterfrom
Xanewok:sa-empty-tables
Oct 16, 2019
Merged

save-analysis: Don't ICE when resolving qualified type paths in struct members#65353
bors merged 3 commits into
rust-lang:masterfrom
Xanewok:sa-empty-tables

Conversation

@Xanewok

Copy link
Copy Markdown
Contributor

Previously, we failed since we use qpath_res via typeck tables - when using those we need to pass in a HirId that's local to the definition path the tables are rooted at (otherwise we risk frame of reference mismatch and an assertion against invalid lookup).

In this case we can't get typeck tables for struct definition because it has no body, however the struct member type node is rooted under the struct definition and so we can't really do anything about it in terms of traversal.

Instead, we try to "nest" the tables as always but change the default behaviour to use empty typeck tables rather than silently trying to use the current ones. This does work as we expect and for prior art, we use the same approach in the privacypass.

Fixes#64659.
Fixes#64821.

r? @nikomatsakis (since this changes the default behaviour introduced in d7d3f19)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2019
@Xanewok

Copy link
Copy Markdown
ContributorAuthor

I'd like to nominate this for beta, after some more testing, if possible - with this we can avoid an ICE in a dep when using RLS

@nikomatsakis

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Oct 15, 2019

Copy link
Copy Markdown
Collaborator

📌 Commit eefc169 has been approved by nikomatsakis

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 15, 2019
@nikomatsakisnikomatsakis added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 15, 2019
@nikomatsakis

Copy link
Copy Markdown
Contributor

Nominating for beta because, as @Xanewokwrote on Zulip:

Igor Matuszewski: ... I'd like to nominate this for beta, since the breakage hit quite a bit of deps on beta still

tmandry added a commit to tmandry/rust that referenced this pull request Oct 15, 2019
…akis
save-analysis: Don't ICE when resolving qualified type paths in struct members
Previously, we failed since we use `qpath_res` via typeck tables - when using those we need to pass in a HirId that's local to the definition path the tables are rooted at (otherwise we risk frame of reference mismatch and an assertion against invalid lookup).
In this case we can't get typeck tables for struct definition because it has no body, however the struct member type node is rooted under the struct definition and so we can't really do anything about it in terms of traversal.
Instead, we try to "nest" the tables as always but change the default behaviour to use empty typeck tables rather than silently trying to use the current ones. This does work as we expect and for prior art, we use the same approach in the [privacy](https://github.com/rust-lang/rust/blob/7bc94cc3c2ccef8b4d393910bb978a6487db1202/src/librustc_privacy/lib.rs#L332-L341) [pass](https://github.com/rust-lang/rust/blob/7bc94cc3c2ccef8b4d393910bb978a6487db1202/src/librustc_privacy/lib.rs#L1007-L1028).
Fixesrust-lang#64659.
Fixesrust-lang#64821.
r? @nikomatsakis (since this changes the default behaviour introduced in rust-lang@d7d3f19)
@tmandrytmandry mentioned this pull request Oct 15, 2019
bors added a commit that referenced this pull request Oct 15, 2019
Rollup of 14 pull requests
Successful merges:
- #64603 (Reducing spurious unused lifetime warnings.)
- #64623 (Remove last uses of gensyms)
- #65235 (don't assume we can *always* find a return type hint in async fn)
- #65242 (Fix suggestion to constrain trait for method to be found)
- #65265 (Cleanup librustc mir err codes)
- #65293 (Optimize `try_expand_impl_trait_type`)
- #65307 (Try fix incorrect "explicit lifetime name needed")
- #65308 (Add long error explanation for E0574)
- #65353 (save-analysis: Don't ICE when resolving qualified type paths in struct members)
- #65389 (Return `false` from `needs_drop` for all zero-sized arrays.)
- #65402 (Add troubleshooting section to PGO chapter in rustc book.)
- #65425 (Optimize `BitIter`)
- #65438 (Organize `never_type` tests)
- #65444 (Implement AsRef<[T]> for List<T>)
Failed merges:
- #65390 (Add long error explanation for E0576)
r? @ghost
@bors
bors merged commit eefc169 into rust-lang:masterOct 16, 2019
@Xanewok
Xanewok deleted the sa-empty-tables branch October 16, 2019 03:40
Centril added a commit to Centril/rust that referenced this pull request Oct 18, 2019
save-analysis: Nest tables when processing impl block definitions
Similar to rust-lang#65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations.
Closesrust-lang#65411
tmandry added a commit to tmandry/rust that referenced this pull request Oct 18, 2019
save-analysis: Nest tables when processing impl block definitions
Similar to rust-lang#65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations.
Closesrust-lang#65411
tmandry added a commit to tmandry/rust that referenced this pull request Oct 18, 2019
save-analysis: Nest tables when processing impl block definitions
Similar to rust-lang#65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations.
Closesrust-lang#65411
@nikomatsakisnikomatsakis added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. beta-accepted Accepted for backporting to the compiler in the beta channel. labels Oct 24, 2019
@nikomatsakis

Copy link
Copy Markdown
Contributor

Discussed in the @rust-lang/compiler meeting, accepted for beta backport.

@Mark-SimulacrumMark-Simulacrum removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 25, 2019
bors added a commit that referenced this pull request Oct 26, 2019
[beta] backport rollup
This includes a bunch of PRs:
* Fix redundant semicolon lint interaction with proc macro attributes #64387
* Upgrade async/await to "used" keywords. #64875
* syntax: fix dropping of attribute on first param of non-method assocated fn #64894
* async/await: improve not-send errors #64895
* Silence unreachable code lint from await desugaring #64930
* Always mark rust and rust-call abi's as unwind #65020
* Account for macro invocation in `let mut $pat` diagnostic. #65123
* Ensure that associated `async fn`s have unique fresh param names #65142
* Add troubleshooting section to PGO chapter in rustc book. #65402
* Upgrade GCC to 8.3.0, glibc to 1.17.0 and crosstool-ng to 1.24.0 for dist-armv7-linux #65302
* Optimize `try_expand_impl_trait_type` #65293
* use precalculated dominators in explain_borrow #65172
* Fix ICE #64964#64989
* [beta] Revert "Auto merge of #62948 - matklad:failable-file-loading, r=petro… #65273
* save-analysis: Don't ICE when resolving qualified type paths in struct members #65353
* save-analysis: Nest tables when processing impl block definitions #65511
* Avoid ICE when checking `Destination` of `break` inside a closure #65518
* Avoid ICE when adjusting bad self ty #65755
* workaround msys2 bug #65762
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beta-acceptedAccepted for backporting to the compiler in the beta channel.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal compiler error but only when running under rls Rustc panics while compiling gstreamer in RLS

5 participants

@Xanewok@nikomatsakis@bors@Mark-Simulacrum@rust-highfive