Skip to content
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

Transmute restrictions are placed on functions called 'transmute' #15562

Closed
brson opened this issue Jul 9, 2014 · 1 comment · Fixed by #16751
Closed

Transmute restrictions are placed on functions called 'transmute' #15562

brson opened this issue Jul 9, 2014 · 1 comment · Fixed by #16751

Comments

@brson
Copy link
Contributor

brson commented Jul 9, 2014

The transmute intrinsic has some special restrictions. The check that implements these does not actually check that the function is a lang item, just looking at the name 'transmute':

extern { fn transmute(); }

fn main() { transmute() }
/home/brian/transmute.rs:5:13: 5:22 error: internal compiler error: transmute wasn't a bare fn?!
/home/brian/transmute.rs:5 fn main() { transmute() }
                                       ^~~~~~~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:107

For defs in the local crate it appears this only happens with foreign functions called 'transmute'. From looking at the code, it looks like the cross-crate case isn't so restricted and will try to check every function called 'transmute'.

@brson brson added the I-wrong label Jul 9, 2014
@huonw
Copy link
Member

huonw commented Jul 9, 2014

(I guess this would be an easy fix after #12634.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants