Skip to content

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

Closed

Description

@dwrensha

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.

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 1, 2020
  2. dwrensha commented on Mar 1, 2020

    @dwrensha
    ContributorAuthor

    This regressed in #60126.

  3. dwrensha commented on Mar 1, 2020

    @dwrensha
    ContributorAuthor
  4. self-assigned this
    on Mar 1, 2020
  5. added a commit that references this issue on Mar 1, 2020
    7b6f5ed
  6. pnkfelix commented on Mar 4, 2020

    @pnkfelix
    Contributor

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

  7. added 2 commits that reference this issue on Mar 5, 2020
    e067bf4
    273c5b2
  8. added a commit that references this issue on Mar 6, 2020
    865b44a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions