|
| 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 | +unsafeextern{ |
| 17 | +// @has 'foo/static.FOO.html' |
| 18 | +// @has - '//pre[@class="rust item-decl"]' 'pub static FOO: i32' |
| 19 | +pub safestaticFOO:i32; |
| 20 | +// @has 'foo/static.BAR.html' |
| 21 | +// @has - '//pre[@class="rust item-decl"]' 'pub unsafe static BAR: i32' |
| 22 | +pubstaticBAR:i32; |
| 23 | + |
| 24 | +// @has 'foo/fn.foo.html' |
| 25 | +// @has - '//pre[@class="rust item-decl"]' 'pub extern "C" fn foo()' |
| 26 | +pub safefnfoo(); |
| 27 | +// @has 'foo/fn.bar.html' |
| 28 | +// @has - '//pre[@class="rust item-decl"]' 'pub unsafe extern "C" fn bar()' |
| 29 | +pubfnbar(); |
| 30 | +} |