Closed
Description
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.