Closed
Description
fn main() {
1.bar();
}
Compiling this gives:
error: attempted access of field `bar` on type `<VI0>`, but no field or method with that name was found.
I'm guessing that the compiler hasn't inferred a type for <VI0>
, but it should probably be more explicit about this fact rather than spitting out something that looks like a compiler error. Nothing fancy, it could just look like:
error: attempted access of field `bar` on type `<unknown integral type>`, but no field or method with that name was found.
(Here I'm presuming that a type like <VI0>
is known to be integral, where this error occurs more generally it might say <V0>
, which should simply become <unknown type>
.)
If this can happen in other error messages it should be improved there as well.
Here's a test case with another error message that would likely be improved by the fixing this bug:
trait T {
fn foo();
}
fn bar<V: T>(v: @V) {
v.foo();
}
fn main() {
bar(5);
}
Current output:
5124.rs:10:8: 10:9 error: mismatched types: expected `@<V0>` but found `<VI0>` (expected @-ptr but found integral variable)
5124.rs:10 bar(5);
^
Suggested fixed output:
5124.rs:10:8: 10:9 error: mismatched types: expected `@<unknown type>` but found `<unknown integral type>` (expected @-ptr but found integral variable)
5124.rs:10 bar(5);
^