-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc: Enable writing "unsafe extern fn() {}" #14005
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
Conversation
A consequence of this is that |
@@ -398,9 +398,9 @@ impl fmt::Show for clean::Type { | |||
write!(f.buf, "{}{}fn{}{}", | |||
FnStyleSpace(decl.fn_style), | |||
match decl.abi { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be
match decl.abi.as_slice() {
"" => " extern ".to_owned(),
"\"Rust\"" => "".to_owned(),
s => format!(" extern {} ", s)
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed! Updated.
Previously, the parser would not allow you to simultaneously implement a function with a different abi as well as being unsafe at the same time. This extends the parser to allow functions of the form: unsafe extern fn foo() { // ... } The closure type grammar was also changed to reflect this reversal, types previously written as "extern unsafe fn()" must now be written as "unsafe extern fn()". The parser currently has a hack which allows the old style, but this will go away once a snapshot has landed. Closes rust-lang#10025 [breaking-change]
@@ -876,7 +876,6 @@ pub struct FnDecl { | |||
pub enum FnStyle { | |||
UnsafeFn, // declared with "unsafe fn" | |||
NormalFn, // declared with "fn" | |||
ExternFn, // declared with "extern fn" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been bugging me for a while, thanks :).
Previously, the parser would not allow you to simultaneously implement a function with a different abi as well as being unsafe at the same time. This extends the parser to allow functions of the form: unsafe extern fn foo() { // ... } The closure type grammar was also changed to reflect this reversal, types previously written as "extern unsafe fn()" must now be written as "unsafe extern fn()". The parser currently has a hack which allows the old style, but this will go away once a snapshot has landed. Closes #10025 [breaking-change]
I'll take a short break from auto assignments. My last few weeks have been busy and I feel like getting my inbox back in order and taking a short breather will be the best for me. I still plan to review the PRs I'm currently assigned to and writing the changelogs. Jup that's it, have a good day, who ever is reading this =^.^= changelog: none
Previously, the parser would not allow you to simultaneously implement a
function with a different abi as well as being unsafe at the same time. This
extends the parser to allow functions of the form:
The closure type grammar was also changed to reflect this reversal, types
previously written as "extern unsafe fn()" must now be written as
"unsafe extern fn()". The parser currently has a hack which allows the old
style, but this will go away once a snapshot has landed.
Closes #10025
[breaking-change]