Skip to content

Commit 3fddb98

Browse files
committed
Merge pull request #851 from Amanieu/const_unsafe
Fix ordering of "const unsafe fn"
2 parents 9302963 + ef03dca commit 3fddb98

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/items.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,12 +1078,13 @@ fn rewrite_fn_base(context: &RewriteContext,
10781078
let mut result = String::with_capacity(1024);
10791079
// Vis unsafety abi.
10801080
result.push_str(format_visibility(vis));
1081-
result.push_str(::utils::format_unsafety(unsafety));
10821081

10831082
if let ast::Constness::Const = constness {
10841083
result.push_str("const ");
10851084
}
10861085

1086+
result.push_str(::utils::format_unsafety(unsafety));
1087+
10871088
if abi != abi::Abi::Rust {
10881089
result.push_str(&::utils::format_abi(abi));
10891090
}

tests/source/issue-850.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const unsafe fn x() {}

tests/target/issue-850.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const unsafe fn x() {}

0 commit comments

Comments
 (0)