summary refs log tree commit diff
path: root/src/test/ui/asm
AgeCommit message (Collapse)AuthorLines
2020-08-09tests: Mark `ui/asm/bad-arch.rs` as requiring wasm llvm backendVadim Petrochenkov-1/+2
2020-08-06Fix ICE when using asm! on an unsupported architectureAmanieu d'Antras-0/+26
Fixes #75220
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-3/+0
2020-07-10Avoid "whitelist"Tamir Duberstein-1/+1
Other terms are more inclusive and precise.
2020-06-30Stabilize `#[track_caller]`.Adam Perry-1/+1
Does not yet make its constness stable, though. Use of `Location::caller` in const contexts is still gated by `#![feature(const_caller_location)]`.
2020-06-20Fix duplicate options errorCamelid-9/+9
The UI isn't glitching anymore.
2020-06-20Make suggestion machine-applicableCamelid-10/+37
2020-06-20Add more to duplicate options testCamelid-1/+26
2020-06-20Use `span_suggestion` instead of `span_label`Camelid-6/+6
2020-06-20Update duplicate options testCamelid-53/+11
2020-06-20Make warning an error; use help instead of suggestion; clean up codeCamelid-25/+66
For some reason, the help message is now in a separate message, which adds a lot of noise. I would like to try to get it back to one message.
2020-06-20Add UI test for duplicate `asm!` options warningCamelid-0/+57
2020-06-20Update testsCamelid-41/+12
2020-06-15asm: Allow multiple template strings; interpret them as newline-separatedJosh Triplett-5/+325
Allow the `asm!` macro to accept a series of template arguments, and interpret them as if they were concatenated with a '\n' between them. This allows writing an `asm!` where each line of assembly appears in a separate template string argument. This syntax makes it possible for rustfmt to reliably format and indent each line of assembly, without risking changes to the inside of a template string. It also avoids the complexity of having the user carefully format and indent a multi-line string (including where to put the surrounding quotes), and avoids the extra indentation and lines of a call to `concat!`. For example, rewriting the second example from the [blog post on the new inline assembly syntax](https://blog.rust-lang.org/inside-rust/2020/06/08/new-inline-asm.html) using multiple template strings: ```rust fn main() { let mut bits = [0u8; 64]; for value in 0..=1024u64 { let popcnt; unsafe { asm!( " popcnt {popcnt}, {v}", "2:", " blsi rax, {v}", " jz 1f", " xor {v}, rax", " tzcnt rax, rax", " stosb", " jmp 2b", "1:", v = inout(reg) value => _, popcnt = out(reg) popcnt, out("rax") _, // scratch inout("rdi") bits.as_mut_ptr() => _, ); } println!("bits of {}: {:?}", value, &bits[0..popcnt]); } } ``` Note that all the template strings must appear before all other arguments; you cannot, for instance, provide a series of template strings intermixed with the corresponding operands. In order to get srcloc mappings right for macros that generate multi-line string literals, create one line_span for each line in the string literal, each pointing to the macro. Make `rustc_parse_format::Parser::curarg` `pub`, so that we can propagate it from one template string argument to the next.
2020-06-12Rollup merge of #73033 - Amanieu:asm-tls, r=oli-obkDylan DPC-5/+47
Fix #[thread_local] statics as asm! sym operands The `asm!` RFC specifies that `#[thread_local]` statics may be used as `sym` operands for inline assembly. This also fixes a regression in the handling of `#[thread_local]` during monomorphization which caused link-time errors with multiple codegen units, most likely introduced by #71192. r? @oli-obk
2020-06-11Rollup merge of #73230 - Amanieu:asm-unused2, r=petrochenkovDylan DPC-1/+21
Suggest including unused asm arguments in a comment to avoid error We require all arguments to an `asm!` to be used in the template string, just like format strings. However in some cases (e.g. `black_box`) it may be desirable to have `asm!` arguments that are not used in the template string. Currently this is a hard error rather than a lint since `#[allow]` does not work on macros (#63221), so this PR suggests using the unused arguments in an asm comment as a workaround. r? @petrochenkov
2020-06-11Add a suggestion to use unused asm arguments in commentsAmanieu d'Antras-1/+21
2020-06-09Handle assembler warnings properlyAmanieu d'Antras-1/+16
2020-06-06Fix #[thread_local] statics as asm! sym operandsAmanieu d'Antras-5/+47
2020-06-05add test for #72960Matthias Krüger-1/+3
Fixes #72960
2020-05-31Clarify errors and warnings about the transition to the new asm!Amanieu d'Antras-6/+12
2020-05-30Rollup merge of #72625 - Amanieu:asm-srcloc, r=petrochenkovRalf Jung-0/+115
Improve inline asm error diagnostics Previously we were just using the raw LLVM error output (with line, caret, etc) as the diagnostic message, which ends up looking rather out of place with our existing diagnostics. The new diagnostics properly format the diagnostics and also take advantage of LLVM's per-line `srcloc` attribute to map an error in inline assembly directly to the relevant line of source code. Incidentally also fixes #71639 by disabling `srcloc` metadata during LTO builds since we don't know what crate it might have come from. We can only resolve `srcloc`s from the currently crate since it indexes into the source map for the current crate. Fixes #72664 Fixes #71639 r? @petrochenkov ### Old style ```rust #![feature(llvm_asm)] fn main() { unsafe { let _x: i32; llvm_asm!( "mov $0, $1 invalid_instruction $0, $1 mov $0, $1" : "=&r" (_x) : "r" (0) :: "intel" ); } } ``` ``` error: <inline asm>:3:14: error: invalid instruction mnemonic 'invalid_instruction' invalid_instruction ecx, eax ^~~~~~~~~~~~~~~~~~~ --> src/main.rs:6:9 | 6 | / llvm_asm!( 7 | | "mov $0, $1 8 | | invalid_instruction $0, $1 9 | | mov $0, $1" ... | 12 | | :: "intel" 13 | | ); | |__________^ ``` ### New style ```rust #![feature(asm)] fn main() { unsafe { asm!( "mov {0}, {1} invalid_instruction {0}, {1} mov {0}, {1}", out(reg) _, in(reg) 0i64, ); } } ``` ``` error: invalid instruction mnemonic 'invalid_instruction' --> test.rs:7:14 | 7 | invalid_instruction {0}, {1} | ^ | note: instantiated into assembly here --> <inline asm>:3:14 | 3 | invalid_instruction rax, rcx | ^^^^^^^^^^^^^^^^^^^ ```
2020-05-30Rollup merge of #72607 - Amanieu:fix-72570, r=oli-obkRalf Jung-0/+18
Eagerly lower asm sub-expressions to HIR even if there is an error Fixes #72570 r? @oli-obk
2020-05-29Improve inline asm error diagnosticsAmanieu d'Antras-0/+115
2020-05-26Fix testAmanieu d'Antras-0/+11
2020-05-26Eagerly lower asm sub-expressions to HIR even if there is an errorAmanieu d'Antras-0/+7
Fixes #72570
2020-05-24Properly handle InlineAsmOperand::SymFn when collecting monomorphized itemsAmanieu d'Antras-0/+38
Fixes #72484
2020-05-18Fix const handling and add tests for const operandsAmanieu d'Antras-0/+56
2020-05-18Add borrow-check testAmanieu d'Antras-1/+50
2020-05-18Implement att_syntax optionAmanieu d'Antras-4/+4
2020-05-18Add support for high byte registers on x86Amanieu d'Antras-46/+40
2020-05-18Apply review feedbackAmanieu d'Antras-18/+33
2020-05-18Add tests for asm!Amanieu d'Antras-0/+1131
2020-04-17Rename `asm` test directory in favor of `llvm_asm`Yuki Okushi-432/+0
2020-04-17Add test for issue-54067Yuki Okushi-0/+12
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+2
2020-03-26Update tests to use llvm_asm!Amanieu d'Antras-98/+98
2020-03-13Add test for issue-69092Yuki Okushi-0/+21
2020-03-09Check if output is immediate valueYuki Okushi-0/+22
2019-12-21rework run-fail and support check,build-failMazdak Farrokhzad-1/+2
2019-11-17Add some more testsVadim Petrochenkov-0/+12
2019-11-17Address review commentsVadim Petrochenkov-5/+5
2019-11-14Fix ui tests with better error code usageGuillaume Gomez-0/+5
2019-10-22Add test for issue-51431Yuki Okushi-0/+18
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-3/+3
2019-06-16compiletest: Remove `skip-codegen`Vadim Petrochenkov-6/+4
2019-04-22update tests for migrate mode by defaultMatthew Jasper-29/+4
2019-04-18hide `--explain` hint if error has no extended infoAndy Russell-4/+0
2019-03-11Update testsVadim Petrochenkov-14/+14
2019-01-02make `panictry!` private to libsyntaxAndy Russell-0/+83
This commit completely removes usage of the `panictry!` macro from outside libsyntax. The macro causes parse errors to be fatal, so using it in libsyntax_ext caused parse failures *within* a syntax extension to be fatal, which is probably not intended. Furthermore, this commit adds spans to diagnostics emitted by empty extensions if they were missing, à la #56491.