-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
intrinsicck is broken in the presence of associated types #28625
Comments
Reduced: trait Bar {
type Bar;
}
struct ArrayPeano<T: Bar> {
data: T::Bar,
}
fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
unsafe { std::mem::transmute(a) }
}
impl Bar for () {
type Bar = ();
}
fn main() {
let x: ArrayPeano<()> = ArrayPeano { data: () };
foo(&x);
} |
It appears that |
More specifically,
|
Weirdly, implementing the trait for |
This debug output is also concerning:
It seems that because |
How did the |
intrinsicck tries to use the types I can't really see how intrinsicck can survive with associated types. |
intrinsicck should really be replaced with an |
Just bumped into this problem when trying to transmute a reference into a Edit: For anyone else wondering, the workaround for |
This has been fixed, @apasel422's reduction produces a transmute size mismatch error. |
The compiler told me to report it, so here goes ;)
I tried to compile this code using
cargo build
: https://gist.github.com/fizyk20/4cf1665a18ff800584f1This is the only file in the crate. Cargo.toml looks like this:
So, nothing really unusual.
What I got is posted below:
Meta
rustc --version --verbose
:(I'm on Arch Linux)
Backtrace is above, so I won't be pasting it here again ;)
The text was updated successfully, but these errors were encountered: