Skip to content

internal compiler error: Encountered ambiguity selecting Binder(<[type error] as TraitA>) during codegen, presuming due to overflow #69602

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
dwrensha opened this issue Mar 1, 2020 · 3 comments · Fixed by #69614
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Mar 1, 2020

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

trait TraitA {
    const VALUE: usize;
}

struct A;
impl TraitA for A {
  const VALUE: usize = 0;
}

trait TraitB {
    type MyA: TraitA;
    const VALUE: usize = Self::MyA::VALUE;
}

struct B;
impl TraitB for B {
    type M   = A;
}

fn main() {
    let _ = [0; B::VALUE];
}
$ rustc main.rs
error[E0437]: type `M` is not a member of trait `TraitB`
  --> main.rs:17:5
   |
17 |     type M   = A;
   |     ^^^^^^^^^^^^^ not a member of trait `TraitB`

error[E0046]: not all trait items implemented, missing: `MyA`
  --> main.rs:16:1
   |
11 |     type MyA: TraitA;
   |     ----------------- `MyA` from trait
...
16 | impl TraitB for B {
   | ^^^^^^^^^^^^^^^^^ missing `MyA` in implementation

error: internal compiler error: src/librustc/traits/codegen/mod.rs:48: Encountered ambiguity selecting `Binder(<[type error] as TraitA>)` during codegen, presuming due to overflow

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:905:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

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.41.1 (f3e1a954d 2020-02-24) running on x86_64-unknown-linux-gnu

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0046, E0437.
For more information about an error, try `rustc --explain E0046`.

The error happens on stable, beta, and nightly.

@JohnTitor JohnTitor added 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. labels Mar 1, 2020
@dwrensha
Copy link
Contributor Author

dwrensha commented Mar 1, 2020

This regressed in #60126.

@dwrensha
Copy link
Contributor Author

dwrensha commented Mar 1, 2020

cc @estebank @oli-obk

@jonas-schievink jonas-schievink added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Mar 1, 2020
@estebank estebank self-assigned this Mar 1, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Mar 4, 2020

triage: already has fix in pipeline. P-high. removing nomination label.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Mar 4, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 5, 2020
`delay_span_bug` when codegen cannot select obligation

Fix rust-lang#69602, introduced in rust-lang#60126 by letting the compiler continue past
type checking after encountering errors.
JohnTitor added a commit to JohnTitor/rust that referenced this issue Mar 5, 2020
`delay_span_bug` when codegen cannot select obligation

Fix rust-lang#69602, introduced in rust-lang#60126 by letting the compiler continue past
type checking after encountering errors.
bors added a commit that referenced this issue Mar 6, 2020
`delay_span_bug` when codegen cannot select obligation

Fix #69602, introduced in #60126 by letting the compiler continue past
type checking after encountering errors.
@bors bors closed this as completed in 7b6f5ed Mar 6, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

5 participants