rust
rust copied to clipboard
Error message ""instantiating a type parameter with an incompatible type" should tell you the type
fn main() {
let (port, chan) = pipes::stream(); // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)
do task::spawn {
io::println(port.recv()); // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)
}
chan.send("hello, world"); // instantiating a type parameter with an incompatible type (needs `owned`, got `const copy owned`, missing `durable`)
}
None of these three error messages mention the actual types involved.
Some more comments from IRC:
[12:36:02] <@nmatsakis> bstrie: in any case the error message is clearly... wrong-ish, because it's saying "I needed owned and you gave me owned but not durable". (what version of rustc are you using? durable was replaced with &static at some point)
[12:36:32] <@nmatsakis> bstrie: in any case, if it needs durable, it should say so. This may have something to do with the fact that kinds are a kind of bit set and in fact owned should imply durable...
What's happening here is that the type of the port is getting inferred to &str since it gets constrained by io::println(). The printout from the kind checker not only lacks types, but it's just kind of... wrong. It did not get a "const copy owned" type.
@nikomatsakis I think this can be closed now ?
assigning bug; change assignment if you disagree
This is fixed. I'll check in a test case.