]> git.lizzy.rs Git - rust.git/blob - src/test/compile-fail/macros-in-extern.rs
Account for --remap-path-prefix in save-analysis
[rust.git] / src / test / compile-fail / macros-in-extern.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-wasm32
12
13 #![feature(decl_macro)]
14
15 macro_rules! returns_isize(
16     ($ident:ident) => (
17         fn $ident() -> isize;
18     )
19 );
20
21 macro takes_u32_returns_u32($ident:ident) {
22     fn $ident (arg: u32) -> u32;
23 }
24
25 macro_rules! emits_nothing(
26     () => ()
27 );
28
29 fn main() {
30     assert_eq!(unsafe { rust_get_test_int() }, 0isize);
31     assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEFu32);
32 }
33
34 #[link(name = "rust_test_helpers", kind = "static")]
35 extern {
36     returns_isize!(rust_get_test_int);
37     //~^ ERROR macro invocations in `extern {}` blocks are experimental.
38     takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
39     //~^ ERROR macro invocations in `extern {}` blocks are experimental.
40     emits_nothing!();
41     //~^ ERROR macro invocations in `extern {}` blocks are experimental.
42 }