-
Notifications
You must be signed in to change notification settings - Fork 13.3k
ICE passing a trait object by reference #17322
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
Comments
cc me |
It works with |
The code example is incorrect code, but it should give an error rather than ICE |
This seems to be a regression from trait reform - we used to do vtable::check_object_cast for coercions as well as casts, but now we seem to only do it for casts. |
I'll investigate. |
@nikomatsakis we used to do this check in vtable.rs. |
Are you sure this code is incorrect? There is an impl of |
(Also, or perhaps the same question, what check exactly did we used to do in vtable?) |
@nikomatsakis yes. Here is simplified code:
The error is on the third line in main where we try to coerce a |
@nikomatsakis we used to call |
@nick29581 so I agree that there is likely a bug introduced by trait-reform, but not that the code is illegal. Here is a version of the example which also ICEs, but which does not depend on
|
Hmm, do we have some blanket |
@nick29581 we do for Writer, yes. I will investigate anyway, since it seems I broke it. |
Another test case for a very similar error: trait Foo {}
fn foo(_: &[&Foo]) {}
impl<'a> Foo for &'a str {}
fn main() {
foo(&[&"foo"]);
}
|
…o be what it expects. Fixes rust-lang#17322.
Pass the unadjusted type into the unsize_info function, which seems to be what it expects. Fixes #17322. r? @nick29581 Full disclosure: still running make check locally ;)
upstream Rust version: 828e075
The text was updated successfully, but these errors were encountered: