rustc: Enable writing "unsafe extern fn() {}"
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]
This commit is contained in:
parent
cf6857b9e9
commit
08237cad8d
15 changed files with 59 additions and 49 deletions
|
|
@ -876,7 +876,6 @@ pub struct FnDecl {
|
|||
pub enum FnStyle {
|
||||
UnsafeFn, // declared with "unsafe fn"
|
||||
NormalFn, // declared with "fn"
|
||||
ExternFn, // declared with "extern fn"
|
||||
}
|
||||
|
||||
impl fmt::Show for FnStyle {
|
||||
|
|
@ -884,7 +883,6 @@ impl fmt::Show for FnStyle {
|
|||
match *self {
|
||||
NormalFn => "normal".fmt(f),
|
||||
UnsafeFn => "unsafe".fmt(f),
|
||||
ExternFn => "extern".fmt(f),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue