E3039
E3039 —I::Itemdisagrees with the impl for whatIis: an argument bound it to one type and that impl bindsItemto another.
What the compiler reports
E3039 … `I::Item` is i32 here, but `Range` binds `Item` to i64
The fragments the test suite holds the compiler to. An ellipsis marks text the test does not constrain; the emitted message also carries a source location.
A program that triggers it
import core::iter;
fn apply<I : Iterator, U>(it : I, f : Closure1<I::Item, U>) -> U {
let mut i = it;
let p = f.func;
return p(f.env, i.next().unwrap());
}
fn main() -> i32 {
let m = apply(range(0i64, 5i64), | x : i32 | x * 2);
return 0;
}
// The closure says the items are i32; `Range` says they are i64.
From tests/frontend/fail/projection_disagrees_with_the_impl.vx, which asserts this diagnostic on every commit.
Related
A tour of VxThe chapter covering the rule this code enforces.
All diagnosticsEvery code the compiler can emit, grouped by stage.
E3038
type Item = .. in an impl whose trait declares no Item. Usually a misspelling: nothing reads the binding, so it would go on meaning nothing, in silence.
E3040I::Item where no impl for what I is binds an associated type named Item: I has no such bound, or the name is misspelled.