Skip to content
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

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

Closed
ashleygwilliams opened this issue Dec 20, 2018 · 9 comments · Fixed by #57185
Assignees
Labels
A-resolve Area: Path resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ashleygwilliams
Copy link
Member

ashleygwilliams commented Dec 20, 2018

the code i tried:

i expected:

  • cargo-generate/pull/135, to not compile and give an error about structStructOpt typo
  • cargo-generate/pull/136, to compile (and no longer display 2018 warnings about path clarity)

instead, what happened:

Compiling cargo-generate v0.2.1 (/Users/ag_dubs/rust/cargo-generate)
thread 'main' panicked at 'assertion failed: directive.imported_module.get().is_none()', src/librustc_resolve/resolve_imports.rs:892:21
note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.33.0-nightly (790f4c566 2018-12-19) running on x86_64-apple-darwin

note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

error: Could not compile `cargo-generate`.

system info:

Ashleys-MacBook-Pro-2:cargo-generate ag_dubs$ rustc --version --verbose
rustc 1.33.0-nightly (790f4c566 2018-12-19)
binary: rustc
commit-hash: 790f4c566d9802dfcadc26398dde2051cfe6ec9f
commit-date: 2018-12-19
host: x86_64-apple-darwin
release: 1.33.0-nightly
LLVM version: 8.0
@ashleygwilliams
Copy link
Member Author

i also get this on stable and earlier nightlies, if that is at all useful.

@petrochenkov petrochenkov self-assigned this Dec 20, 2018
@petrochenkov petrochenkov added A-resolve Area: Path resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 20, 2018
@ashleygwilliams
Copy link
Member Author

(also please feel free to let me know if i can provide any more info- this is my first time filing a compiler bug! thanks for all your hardwork and help <3)

@nikomatsakis nikomatsakis added I-nominated T-community T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-community labels Dec 20, 2018
@nikomatsakis
Copy link
Contributor

Nominating -- we should keep focus on Rust 2018-related bugs like this, I think.

@nikomatsakis
Copy link
Contributor

@ashleygwilliams

i expected: it to compile

Did you? I mean, there is a typo, right? Do you mean, you expected a controller error?

Specifically I see this in the diff:

#[derive(structStructOpt)]

and I think it should be StructOpt?

@nikomatsakis
Copy link
Contributor

I guess you are saying you get the same ICE from https://github.com/ashleygwilliams/cargo-generate/pull/136/files, which has a fix... did you try a cargo clean?

(I'm wondering if it is related to incremental compilation.)

@ashleygwilliams
Copy link
Member Author

yeah, so i noticed the typo, and then fixed it (hence the 2 PRs- i included both on the offchance that there were 2 issues.) i expected the 2nd one to compile, and the first one (after i noticed the typo, to not compile but give an error re: the typo).

i will run a cargo clean and see if it helps!

@nikomatsakis
Copy link
Contributor

OK, thanks for the clarification.

@ashleygwilliams
Copy link
Member Author

ashleygwilliams commented Dec 20, 2018

just ran cargo clean and then cargo build and have the same error message.

@petrochenkov
Copy link
Contributor

Fixed in #57185

bors added a commit that referenced this issue 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Path resolution I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants