Skip to content

Restrict transmute intrinsicck to just rust-intrinsic fn's. #16751

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

Merged
merged 2 commits into from
Aug 27, 2014

Conversation

luqmana
Copy link
Member

@luqmana luqmana commented Aug 25, 2014

Fixes #15562.

@@ -73,9 +73,13 @@ struct IntrinsicCheckingVisitor<'a> {

impl<'a> IntrinsicCheckingVisitor<'a> {
fn def_id_is_transmute(&self, def_id: DefId) -> bool {
let intrinsic = match ty::get(ty::lookup_item_type(self.tcx, def_id).ty).sty {
ty::ty_bare_fn(ref bfty) => bfty.abi == RustIntrinsic,
_ => false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could just return false quickly, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather, if this is not an intrinsic, it could return immediately to avoid the if-guards below.

@alexcrichton
Copy link
Member

r=me with just one small nit

bors added a commit that referenced this pull request Aug 27, 2014
@bors bors closed this Aug 27, 2014
@bors bors merged commit 395ef8b into rust-lang:master Aug 27, 2014
@luqmana luqmana deleted the tr branch July 15, 2015 23:54
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2024
internal: Move diagnostics docs generation and lint definition generation into xtask/codegen
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 this pull request may close these issues.

Transmute restrictions are placed on functions called 'transmute'
3 participants