-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
error: the trait Foo
is not implemented for the type Box<Bar>
#18179
Comments
Same with #18040, which is about a change in May I ask what version of |
I tried with today's nightly before reporting this. I've now installed an older nightly so I can't tell the exact version. This issue is already there in the 2014-10-16 and the 2014-10-10 nightlies, and the playpen. What I mean by "I'm not sure" is that this issue is a simplification of a real code which used to work with 2014-10-06 (I'm sure about this), but no longer works with 2014-10-10, 2014-10-16, or 2014-10-19, and produces the same error message. I suspect #17669 to be the cause. |
I think this might have been caused by #17464. The code can easily be fixed by explicitly dereferencing the trait object: trait Foo {
fn do_foo(&self);
}
trait Bar {
fn do_bar(&self);
}
impl<T> Bar for T where T: Foo {
fn do_bar(&self) {
self.do_foo()
}
}
struct Obj {
obj: Box<Bar + 'static>
}
impl Obj {
fn process(&self) {
(*self.obj).do_bar();
}
} |
cc @nikomatsakis sounds like a multi-dispatch regression |
I agree with @P1start that this is likely caused by #17464. I don't think it's a multidispatch regression per se, though there is an interaction with the condtiional dispatch algorithm. In particular, the algorithm decides that it will use the trait method My inclination is to close this as "working as expected". |
Closing. |
…mpletion feat: Allow excluding specific traits from completion
This code:
(http://is.gd/hTCzJI)
Produces:
I think that this kind of code used to work in the past, so it could be a regression.
Even if this code is not supposed to work, the error message makes no sense.
The text was updated successfully, but these errors were encountered: