Skip to content

Commit

Permalink
Auto merge of #131517 - aDotInTheVoid:rdj-safe-extern-test, r=Guillau…
Browse files Browse the repository at this point in the history
…meGomez

rustdoc-json: Add tests for unsafe/safe extern blocks (RFC 3484)

Closes #126786, turns out this all Just Works (TM)

Tracking issue: #123743

r? `@GuillaumeGomez`
  • Loading branch information
bors committed Oct 11, 2024
2 parents 249df9e + 8a9b670 commit 0321e73
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/rustdoc-json/fns/extern_safe.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
extern "C" {
//@ is "$.index[*][?(@.name=='f1')].inner.function.header.is_unsafe" true
pub fn f1();

// items in unadorned `extern` blocks cannot have safety qualifiers
}

unsafe extern "C" {
//@ is "$.index[*][?(@.name=='f4')].inner.function.header.is_unsafe" true
pub fn f4();

//@ is "$.index[*][?(@.name=='f5')].inner.function.header.is_unsafe" true
pub unsafe fn f5();

//@ is "$.index[*][?(@.name=='f6')].inner.function.header.is_unsafe" false
pub safe fn f6();
}

0 comments on commit 0321e73

Please sign in to comment.