forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc-json: Include safety of
static
s
- Loading branch information
1 parent
51ea7c1
commit f33dba0
Showing
4 changed files
with
74 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// ignore-tidy-linelength | ||
//@ edition: 2021 | ||
|
||
extern "C" { | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false | ||
pub static A: i32; | ||
//@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true | ||
pub static mut B: i32; | ||
|
||
// items in unadorned `extern` blocks cannot have safety qualifiers | ||
} | ||
|
||
unsafe extern "C" { | ||
//@ is '$.index[*][?(@.name=="C")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="C")].inner.static.is_mutable' false | ||
pub static C: i32; | ||
//@ is '$.index[*][?(@.name=="D")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="D")].inner.static.is_mutable' true | ||
pub static mut D: i32; | ||
|
||
//@ is '$.index[*][?(@.name=="E")].inner.static.is_unsafe' false | ||
//@ is '$.index[*][?(@.name=="E")].inner.static.is_mutable' false | ||
pub safe static E: i32; | ||
//@ is '$.index[*][?(@.name=="F")].inner.static.is_unsafe' false | ||
//@ is '$.index[*][?(@.name=="F")].inner.static.is_mutable' true | ||
pub safe static mut F: i32; | ||
|
||
//@ is '$.index[*][?(@.name=="G")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="G")].inner.static.is_mutable' false | ||
pub unsafe static G: i32; | ||
//@ is '$.index[*][?(@.name=="H")].inner.static.is_unsafe' true | ||
//@ is '$.index[*][?(@.name=="H")].inner.static.is_mutable' true | ||
pub unsafe static mut H: i32; | ||
} | ||
|
||
//@ ismany '$.index[*][?(@.inner.static)].inner.static.expr' '""' '""' '""' '""' '""' '""' '""' '""' | ||
//@ ismany '$.index[*][?(@.inner.static)].inner.static.type.primitive' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' '"i32"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.type.primitive' '"i32"' | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.is_mutable' false | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.expr' '"5"' | ||
//@ is '$.index[*][?(@.name=="A")].inner.static.is_unsafe' false | ||
pub static A: i32 = 5; | ||
|
||
//@ is '$.index[*][?(@.name=="B")].inner.static.type.primitive' '"u32"' | ||
//@ is '$.index[*][?(@.name=="B")].inner.static.is_mutable' true | ||
// Expr value isn't gaurenteed, it'd be fine to change it. | ||
//@ is '$.index[*][?(@.name=="B")].inner.static.expr' '"_"' | ||
//@ is '$.index[*][?(@.name=="B")].inner.static.is_unsafe' false | ||
pub static mut B: u32 = 2 + 3; |