]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/global_asm_x2.rs
Suggest defining type parameter when appropriate
[rust.git] / src / test / codegen / global_asm_x2.rs
1 // ignore-aarch64
2 // ignore-aarch64_be
3 // ignore-arm
4 // ignore-armeb
5 // ignore-avr
6 // ignore-bpfel
7 // ignore-bpfeb
8 // ignore-hexagon
9 // ignore-mips
10 // ignore-mips64
11 // ignore-msp430
12 // ignore-powerpc64
13 // ignore-powerpc64le
14 // ignore-powerpc
15 // ignore-r600
16 // ignore-amdgcn
17 // ignore-sparc
18 // ignore-sparcv9
19 // ignore-sparcel
20 // ignore-s390x
21 // ignore-tce
22 // ignore-thumb
23 // ignore-thumbeb
24 // ignore-xcore
25 // ignore-nvptx
26 // ignore-nvptx64
27 // ignore-le32
28 // ignore-le64
29 // ignore-amdil
30 // ignore-amdil64
31 // ignore-hsail
32 // ignore-hsail64
33 // ignore-spir
34 // ignore-spir64
35 // ignore-kalimba
36 // ignore-shave
37 // ignore-wasm32
38 // ignore-wasm64
39 // ignore-emscripten
40 // compile-flags: -C no-prepopulate-passes
41
42 #![feature(global_asm)]
43 #![crate_type = "lib"]
44 #[no_std]
45
46 // CHECK-LABEL: foo
47 // CHECK: module asm
48 // CHECK: module asm "{{[[:space:]]+}}jmp baz"
49 // any other global_asm will be appended to this first block, so:
50 // CHECK-LABEL: bar
51 // CHECK: module asm "{{[[:space:]]+}}jmp quux"
52 global_asm!(r#"
53     .global foo
54 foo:
55     jmp baz
56 "#);
57
58 extern "C" {
59     fn foo();
60 }
61
62 // CHECK-LABEL: @baz
63 #[no_mangle]
64 pub unsafe extern "C" fn baz() {}
65
66 // no checks here; this has been appended to the first occurrence
67 global_asm!(r#"
68     .global bar
69 bar:
70     jmp quux
71 "#);
72
73 extern "C" {
74     fn bar();
75 }
76
77 #[no_mangle]
78 pub unsafe extern "C" fn quux() {}