Skip to content

Commit

Permalink
rustdoc-json: Add tests for unsafe/safe extern blocks (RFC 3484)
Browse files Browse the repository at this point in the history
  • Loading branch information
aDotInTheVoid committed Oct 10, 2024
1 parent 8d94e06 commit 8a9b670
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 8a9b670

Please sign in to comment.