Skip to content

Add whitelist of safe intrinsics - #6307

Merged
bors[bot] merged 4 commits into
rust-lang:masterfrom
frazar:fix-5996
Oct 21, 2020
Merged

Add whitelist of safe intrinsics#6307
bors[bot] merged 4 commits into
rust-lang:masterfrom
frazar:fix-5996

Conversation

@frazar

@frazar frazar commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

This PR should fix #5996, where intrinsic operations where all marked as unsafe.

I'm rather new to this codebase, so I might be doing something very wrong. Please forgive me!

In particular, I'm not sure how to "check that we are in extern rust-intrinsics" as mentioned in this comment.

@lnicola

lnicola commented Oct 21, 2020

Copy link
Copy Markdown
Member

Awesome, thanks for the PR :-). In other places we clone the repository and read the files from there, but this feels like such a huge wart TBH...

Comment thread crates/hir_expand/src/name.rs Outdated
Comment thread crates/hir_def/src/item_tree/tests.rs Outdated
@lnicola

lnicola commented Oct 21, 2020

Copy link
Copy Markdown
Member

Regarding the type of the extern block, the AST looks like this:

  EXTERN_BLOCK@0..28
    ABI@0..10
      EXTERN_KW@0..6 "extern"
      WHITESPACE@6..7 " "
      STRING@7..10 "\"C\""

@lnicola

lnicola commented Oct 21, 2020

Copy link
Copy Markdown
Member

I think you can get the ABI node using extern_block.abi(), but there's no child for the type, only for the extern token. @matklad, we should probably add it to the AST? We're missing the accessor for it.

Comment thread crates/hir_def/src/item_tree/lower.rs Outdated
@bors

bors Bot commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

✌️ frazar can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@matklad

matklad commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

@lnicola good question! Turns out this needs a bit of design, I've put together #6308

@frazar

frazar commented Oct 21, 2020

Copy link
Copy Markdown
Contributor Author

Thank you for your feedback and comments. I think I addressed all points, except for the issue about checking the ABI name, which I guess is blocked on #6308.

Also, I'm not sure why CI failed for macos-latest.. It might be unrelated.

Let me know what should I do next!

@lnicola

lnicola commented Oct 21, 2020

Copy link
Copy Markdown
Member

bors r=frazar

@bors

bors Bot commented Oct 21, 2020

Copy link
Copy Markdown
Contributor

@bors
bors Bot merged commit 9eb6cbb into rust-lang:master Oct 21, 2020
@frazar

frazar commented Oct 21, 2020

Copy link
Copy Markdown
Contributor Author

Great! As a final note, would you mind adding the hacktoberfest-accepted label to this PR? Thanks!

@lnicola

lnicola commented Oct 21, 2020

Copy link
Copy Markdown
Member

Sure, done.

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.

Incorrect "operation requires unsafe block"

3 participants