-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error message for @S as @T cast is unclear #5543
Comments
Reproduced with 0252c30 . Nominating for milestone 5, production-ready |
sub-bug of #6308 |
Note that the phrase "cast an @-pointer to an @-object" has two parses in English, which I suspect is part of my confusion:
|
Actually, this more related to the inability to cast between trait objects. You don't actually have a @-pointer, you have a trait object. |
accepted for production-ready milestone |
Assigning P-low. (also we may be able to just close this; I need to look at the current state of the various error messages.) |
This still exists today: use std::io;
fn bar(r:~Reader) { }
fn main() {
let r : ~Reader = ~io::stdin();
let _m = bar(r as ~Reader);
}
|
In 0.12 it gives a better error message: use std::io;
fn bar(r:Box<Reader>) { }
fn main() {
let r : Box<Reader> = box io::stdin();
let _m = bar(r as Box<Reader>);
} gives
through the identity cast should always be allowed, the error-messages are now good. |
rustup rust-lang#71292 cc rust-lang#71608 --- changelog: none
bar.rs:
rustc error message:
I read the above, I say "um...
r
is an@-pointer
, not just an unadornedReader
instance..."(The poor quality of the error message may or may not be a side-effect of the fact that there is an
impl Reader for @Reader
implementation inio.rs
that might be causing the type checker to first treatr
as a Reader before passing it tobar
; I am not sure. Either way, the message is confusing.)The text was updated successfully, but these errors were encountered: