Auto merge of #131517 - aDotInTheVoid:rdj-safe-extern-test, r=GuillaumeGomez

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

Closes https://github.com/rust-lang/rust/issues/126786, turns out this all Just Works (TM)

Tracking issue: #123743

r? `@GuillaumeGomez`
This commit is contained in:
bors 2024-10-11 03:23:45 +00:00
commit 0321e73d1c

View file

@ -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();
}