Skip to content

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

Closed
@brson

Description

@brson

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'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions