|
| 1 | +//@ build-fail |
| 2 | +//@ compile-flags: --crate-type=lib --target thumbv4t-none-eabi |
| 3 | +//@ needs-llvm-components: arm |
| 4 | + |
| 5 | +// Checks that forced inlining won't mix asm with incompatible instruction sets. |
| 6 | + |
| 7 | +#![crate_type = "lib"] |
| 8 | +#![feature(rustc_attrs)] |
| 9 | +#![feature(no_core, lang_items)] |
| 10 | +#![no_core] |
| 11 | + |
| 12 | +#[lang = "sized"] |
| 13 | +pubtraitSized{} |
| 14 | +#[lang = "copy"] |
| 15 | +pubtraitCopy{} |
| 16 | +#[lang = "freeze"] |
| 17 | +pubunsafetraitFreeze{} |
| 18 | + |
| 19 | +#[lang = "start"] |
| 20 | +fnstart<T>(_main:fn() -> T,_argc:isize,_argv:*const*constu8,_sigpipe:u8) -> isize{ |
| 21 | +0 |
| 22 | +} |
| 23 | + |
| 24 | +#[rustc_builtin_macro] |
| 25 | +#[macro_export] |
| 26 | +macro_rules! asm { |
| 27 | +("assembly template", |
| 28 | + $(operands,)* |
| 29 | + $(options($(option),*))? |
| 30 | +) => { |
| 31 | +/* compiler built-in */ |
| 32 | +}; |
| 33 | +} |
| 34 | + |
| 35 | +#[instruction_set(arm::a32)] |
| 36 | +#[rustc_force_inline] |
| 37 | +fninstruction_set_a32(){} |
| 38 | + |
| 39 | +#[instruction_set(arm::t32)] |
| 40 | +#[rustc_force_inline] |
| 41 | +fninstruction_set_t32(){} |
| 42 | + |
| 43 | +#[rustc_force_inline] |
| 44 | +fninstruction_set_default(){} |
| 45 | + |
| 46 | +#[rustc_force_inline] |
| 47 | +fninline_always_and_using_inline_asm(){ |
| 48 | +unsafe{asm!("/* do nothing */")}; |
| 49 | +} |
| 50 | + |
| 51 | +#[instruction_set(arm::t32)] |
| 52 | +pubfnt32(){ |
| 53 | +instruction_set_a32(); |
| 54 | +//~^ ERROR `instruction_set_a32` could not be inlined into `t32` but is required to be inlined |
| 55 | +instruction_set_t32(); |
| 56 | +instruction_set_default(); |
| 57 | +inline_always_and_using_inline_asm(); |
| 58 | +//~^ ERROR `inline_always_and_using_inline_asm` could not be inlined into `t32` but is required to be inlined |
| 59 | +} |
| 60 | + |
| 61 | +pubfndefault(){ |
| 62 | +instruction_set_a32(); |
| 63 | +//~^ ERROR `instruction_set_a32` could not be inlined into `default` but is required to be inlined |
| 64 | +instruction_set_t32(); |
| 65 | +//~^ ERROR `instruction_set_t32` could not be inlined into `default` but is required to be inlined |
| 66 | +instruction_set_default(); |
| 67 | +inline_always_and_using_inline_asm(); |
| 68 | +} |
0 commit comments