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

no MIR available ICE instead of an ambiguity error #115380

Closed
tmiasko opened this issue Aug 30, 2023 · 2 comments · Fixed by #115389
Closed

no MIR available ICE instead of an ambiguity error #115380

tmiasko opened this issue Aug 30, 2023 · 2 comments · Fixed by #115389
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. 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

@tmiasko
Copy link
Contributor

tmiasko commented Aug 30, 2023

I tried this code:

a.rs:

pub use a::*;
mod a {
    pub use a::*;
    pub use b::*;
    mod a {
        pub fn f() {}
    }
    mod b {
        pub fn f() {}
    }
}

b.rs:

pub fn main() {
    a::f();
}
rustc a.rs --edition=2018 --crate-type=lib
rustc b.rs --edition=2018 --crate-type=lib -L. --extern a

I expected it to fail with an ambiguity error, instead it ICEs.

The code compiles successfully in 1.72.

Since #113099 it generates an ICE (it seems that now when an ambiguity is detected, the processing is not fully finalized and effective visibilities and reachability is incomplete).

Reporting primarily due to the fact that the future incompatibility for ambiguous glob imports is not enabled by default for dependencies #114095 (comment), which hides the root cause of the issue.

Error output

error: internal compiler error: compiler/rustc_monomorphize/src/collector.rs:963:9: no MIR available for DefId(20:8 ~ a[024e]::a::a::f)
@tmiasko tmiasko added 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. C-bug Category: This is a bug. labels Aug 30, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 30, 2023
@tmiasko tmiasko added the A-resolve Area: Name resolution label Aug 30, 2023
@bvanjoi
Copy link
Contributor

bvanjoi commented Aug 30, 2023

reduced:

// issue-115380-extern.rs
pub use c::*;

mod c {
    pub use self::a::*;
    pub use self::b::*;
    mod a {
        pub fn f() {}
    }
    mod b {
        pub fn f() {}
    }
}

// issue-115380.rs
// compile-flags: --emit=link
// aux-build:issue-115380-extern.rs
extern crate issue_115380_extern;

fn main() {
    issue_115380_extern::f();
}

@bvanjoi
Copy link
Contributor

bvanjoi commented Aug 30, 2023

thanks for the report, it will fix by #115389

@bors bors closed this as completed in 9194213 Aug 31, 2023
@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-resolve Area: Name resolution C-bug Category: This is a bug. 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.

4 participants