Skip to content

resolve: Fix one more ICE in import validation - #57185

Merged
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:impice4
Dec 30, 2018
Merged

resolve: Fix one more ICE in import validation#57185
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:impice4

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

So if you have an unresolved import

mod m {use foo::bar;}

error recovery will insert a special item with Def::Err definition into module m, so other things depending on bar won't produce extra errors.

The issue was that erroneous bar was overwriting legitimate bars coming from globs, e.g.

mod m {use baz::*;// imports real existing `bar`use foo::bar;}

causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like #57015.
This PR stops overwriting real successful resolutions with Def::Errs.

Fixes#57015

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @cramertj

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 29, 2018
@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

Beta-nominating as a regression fix, the assert was introduced in stable Rust 1.31 (in #55884).

@petrochenkovpetrochenkov added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Dec 29, 2018
@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

I'm glad I added all those asserts in #55884.
So many interesting corner cases were found (mostly in code with errors though).

@cramertj

Copy link
Copy Markdown
Member

r? @petrochenkov

@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

@cramertj
This is my PR :)

r? @estebank

@estebank

Copy link
Copy Markdown
Contributor

r=me once travis' done

@cramertj

cramertj commented Dec 29, 2018

Copy link
Copy Markdown
Member

@petrochenkov lol, sorry XD -- in my defense it looked like sometihng you'd be qualified to review!

@Centril

Copy link
Copy Markdown
Contributor

@bors r=estebank

@bors

bors commented Dec 29, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit ddb550a has been approved by estebank

@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 Dec 29, 2018
@bors

bors commented Dec 30, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit ddb550a with merge 171c1fc...

bors added a commit that referenced this pull request Dec 30, 2018
resolve: Fix one more ICE in import validation
So if you have an unresolved import
```rust
mod m {
use foo::bar;
}
```
error recovery will insert a special item with `Def::Err` definition into module `m`, so other things depending on `bar` won't produce extra errors.
The issue was that erroneous `bar` was overwriting legitimate `bar`s coming from globs, e.g.
```rust
mod m {
use baz::*; // imports real existing `bar`
use foo::bar;
}
```
causing some unwanted diagnostics talking about "unresolved items", and producing inconsistent resolutions like #57015.
This PR stops overwriting real successful resolutions with `Def::Err`s.
Fixes#57015
@bors

bors commented Dec 30, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: estebank
Pushing 171c1fc to master...

@bors
bors merged commit ddb550a into rust-lang:masterDec 30, 2018
@borsbors mentioned this pull request Dec 30, 2018
@nagisanagisa 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. and removed beta-nominated Nominated for backporting to the compiler in the beta channel. labels Jan 3, 2019
@emilyalbiniemilyalbini added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 3, 2019
@emilyalbiniemilyalbini mentioned this pull request Jan 3, 2019
@emilyalbiniemilyalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jan 3, 2019
bors added a commit that referenced this pull request Jan 4, 2019
[beta] Rollup backports
Cherry-picked:
* #57053: Fix alignment for array indexing
* #57181: resolve: Fix another ICE in import validation
* #57185: resolve: Fix one more ICE in import validation
* #57282: Wf-check the output type of a function in MIR-typeck
* #55318: Ensure that Rustdoc discovers all necessary auto trait bounds
* #56838: Call poly_project_and_unify_type on types that contain inference types
Rolled up:
* #57300: [beta] Update RLS to include 100% CPU on hover bugfix
* #57301: beta: bootstrap from latest stable (1.31.1)
* #57292: [BETA] Update cargo
r? @ghost
@petrochenkov
petrochenkov deleted the impice4 branch June 5, 2019 16:28
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.

attempting to address path clarity warnings for 2018 edition with StructOpt macro led to ICE

8 participants

@petrochenkov@rust-highfive@cramertj@estebank@Centril@bors@nagisa@emilyalbini