Skip to content

Implement unsafe trait and unsafe impl from the OIBIT RFC #19703

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 5 commits into from
Dec 14, 2014

Conversation

nikomatsakis
Copy link
Contributor

This PR allows declaring traits and impls as unsafe. An unsafe trait requires an unsafe impl. An unsafe impl does not permit unsafe code within its interior (unless that code is contained within an unsafe block or unsafe fn, as normal). The commits are standalone.

r? @alexcrichton
cc #13231

try!(self.head(""));
try!(self.print_unsafety(unsafety));
try!(self.word_nbsp(visibility_qualified(item.vis,
"trait").as_slice()));
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the unsafe go in the middle? This looks like it'll print unsafe pub trait instead of pub unsafe trait.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, have to modify the test (as you also pointed out)

@alexcrichton
Copy link
Member

Could you also add a run-pass test with a few examples of unsafe traits and unsafe implementations? Mostly just a smoke test to ensure nothing explodes through the entire compiler pipeline.

@alexcrichton
Copy link
Member

r=me modulo a few nits

@nikomatsakis nikomatsakis force-pushed the unsafe-trait branch 3 times, most recently from 1148399 to c822b7c Compare December 11, 2014 00:06
@sfackler
Copy link
Member

Needs a rebase

@japaric
Copy link
Member

japaric commented Dec 14, 2014

@nikomatsakis This needs a rebase.

bors added a commit that referenced this pull request Dec 14, 2014
Implement `unsafe trait` and `unsafe impl` from the OIBIT RFC

Reviewed-by: acrichto
bors added a commit that referenced this pull request Dec 14, 2014
This PR allows declaring traits and impls as `unsafe`. An `unsafe` trait requires an `unsafe` impl. An `unsafe` impl does not permit unsafe code within its interior (unless that code is contained within an unsafe block or unsafe fn, as normal). The commits are standalone.

r? @alexcrichton 
cc #13231
@bors bors closed this Dec 14, 2014
@bors bors merged commit 7855893 into rust-lang:master Dec 14, 2014
@nikomatsakis nikomatsakis deleted the unsafe-trait branch March 30, 2016 16:17
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.

5 participants