Commit 630c3ad 1 parent bb9a3ef commit 630c3ad Copy full SHA for 630c3ad
File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Test to ensure the feature is working as expected.
2
+
3
+ #![ feature( unsafe_extern_blocks) ]
4
+ #![ crate_name = "foo" ]
5
+
6
+ // @has 'foo/index.html'
7
+
8
+ // First we check that both the static and the function have a "sup" element
9
+ // to tell they're unsafe.
10
+
11
+ // @count - '//ul[@class="item-table"]//sup[@title="unsafe static"]' 1
12
+ // @has - '//ul[@class="item-table"]//sup[@title="unsafe static"]' '⚠'
13
+ // @count - '//ul[@class="item-table"]//sup[@title="unsafe function"]' 1
14
+ // @has - '//ul[@class="item-table"]//sup[@title="unsafe function"]' '⚠'
15
+
16
+ unsafe extern {
17
+ // @has 'foo/static.FOO.html'
18
+ // @has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32'
19
+ pub safe static FOO : i32 ;
20
+ // @has 'foo/static.BAR.html'
21
+ // @has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32'
22
+ pub static BAR : i32 ;
23
+
24
+ // @has 'foo/fn.foo.html'
25
+ // @has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()'
26
+ pub safe fn foo ( ) ;
27
+ // @has 'foo/fn.bar.html'
28
+ // @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()'
29
+ pub fn bar ( ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments