about summary refs log tree commit diff
path: root/tests/ui/asm
AgeCommit message (Collapse)AuthorLines
2024-11-02Add bad-reg inline assembly ui test for RISC-V and s390xTaiki Endo-0/+1338
2024-11-02Support clobber_abi and vector registers (clobber-only) in PowerPC inline ↵Taiki Endo-0/+1180
assembly
2024-10-14Fix clobber_abi and disallow SVE-related registers in Arm64EC inline assemblyTaiki Endo-0/+73
2024-10-11Make asm label blocks safe contextGary Guo-0/+37
`asm!()` is forced to be wrapped inside unsafe. If there's no special treatment, the label blocks would also always be unsafe with no way of opting out.
2024-10-06various fixes for `naked_asm!` implementationFolkert de Vries-3/+1
- fix for divergence - fix error message - fix another cranelift test - fix some cranelift things - don't set the NORETURN option for naked asm - fix use of naked_asm! in doc comment - fix use of naked_asm! in run-make test - use `span_bug` in unreachable branch
2024-10-06disallow `asm!` in `#[naked]` functionsFolkert de Vries-177/+144
also disallow the `noreturn` option, and infer `naked_asm!` as `!`
2024-10-06use `naked_asm!` in naked-function testsFolkert-38/+58
2024-10-06use `naked_asm!` in `tests/ui/asm/naked-functions.rs`Folkert-139/+117
2024-09-30Rollup merge of #130895 - RalfJung:asm-tests, r=nnethercoteMatthias Krüger-96/+22
make type-check-4 asm tests about non-const expressions These tests recently got changed in https://github.com/rust-lang/rust/pull/129759. I asked the PR author to make the tests read from a `static mut` (rather than just making them "pass"), but I now think that was a mistake: previously the tests failed because the const was not a valid const expression, after the PR they failed because the const failed to evaluate. So this PR restores the tests to "fail because the const is not a valid const expression". That can be done in a target-independent way so I unified the x86 and aarch64 tests into one. Cc `@oli-obk` as the original [author](https://github.com/rust-lang/rust/commit/0d88631059742db30c44edadd1c8a2f51c8eb971) of these tests -- not sure if you still remember what they were intended to test.
2024-09-30make type-check-4 asm tests about non-const expressionsRalf Jung-96/+22
2024-09-29adjust testRalf Jung-11/+4
2024-09-27Rollup merge of #130917 - gurry:129503-ice-wrong-span-in-macros, r=chenyukangMatthias Krüger-0/+54
Fix error span if arg to `asm!()` is a macro call Fixes #129503 When the argument to `asm!()` is a macro call, e.g. `asm!(concat!("abc", "{} pqr"))`, and there's an error in the resulting template string, we do not take into account the presence of this macro call while computing the error span. This PR fixes that. Now we will use the entire thing between the parenthesis of `asm!()` as the error span in this situation e.g. for `asm!(concat!("abc", "{} pqr"))` the error span will be `concat!("abc", "{} pqr")`.
2024-09-27Fix error span when arg to asm!() is a macro callGurinder Singh-0/+54
When the template string passed to asm!() is produced by a macro call like concat!() we were producing wrong error spans. Now in the case of a macro call we just use the entire arg to asm!(), macro call and all, as the error span.
2024-09-26Stabilize `const_refs_to_static`Ding Xiang Fei-93/+52
update tests fix bitwidth-sensitive stderr output use build-fail for asm tests
2024-09-18Update the minimum external LLVM to 18Josh Stone-122/+22
2024-09-11Auto merge of #130195 - folkertdev:naked-asm-outside-naked-fn, r=Amanieubors-0/+55
disallow `naked_asm!` outside of `#[naked]` functions tracking issue: https://github.com/rust-lang/rust/issues/90957 parent PR: https://github.com/rust-lang/rust/pull/128651 I split this out from the parent PR because it's self-contained and because the analysis has to search through all functions and there might be performance regressions. r? `@Amanieu`
2024-09-10Auto merge of #129403 - scottmcm:only-array-simd, r=compiler-errorsbors-22/+19
Ban non-array SIMD Nearing the end of https://github.com/rust-lang/compiler-team/issues/621 ! Currently blocked on ~~https://github.com/rust-lang/compiler-builtins/pull/673~~ ~~https://github.com/rust-lang/compiler-builtins/pull/674~~ ~~https://github.com/rust-lang/rust/pull/129400~~ ~~https://github.com/rust-lang/rust/pull/129481~~ for windows.
2024-09-10disallow `naked_asm!` outside of `#[naked]` functionsFolkert de Vries-0/+55
2024-09-09Ban non-array SIMDScott McMurray-22/+19
2024-09-09bootstrap `naked_asm!` for `compiler-builtins`Folkert de Vries-6/+6
in this commit, `naked_asm!` is an alias for `asm!` with one difference: `options(noreturn)` is always enabled by `naked_asm!`. That makes it future-compatible for when `naked_asm!` starts disallowing `options(noreturn)` later.
2024-09-04fix ICE when `asm_const` and `const_refs_to_static` are combinedFolkert de Vries-0/+43
2024-08-28Rollup merge of #129421 - jdonszelmann:naked-repr-align-functions, ↵Matthias Krüger-0/+125
r=workingjubilee,compiler-errors add repr to the allowlist for naked functions Fixes #129412 (combining unstable features #90957 (`#![feature(naked_functions)]`) and #82232 (`#![feature(fn_align)]`)
2024-08-27add uitest for naked functions and the repr attr on functionsjdonszelmann-0/+125
2024-08-25Add `f16` and `f128` inline ASM support for `aarch64`beetrees-6/+10
2024-08-24Enable f16 in assembly on aarch64 platforms that support itrongfu.leng-3/+24
Signed-off-by: rongfu.leng <lenronfu@gmail.com>
2024-08-13stabilize `asm_const`Folkert-287/+263
2024-08-06Auto merge of #125558 - Amanieu:const-asm-type, r=lcnrbors-228/+217
Tweak type inference for `const` operands in inline asm Previously these would be treated like integer literals and default to `i32` if a type could not be determined. To allow for forward-compatibility with `str` constants in the future, this PR changes type inference to use an unbound type variable instead. The actual type checking is deferred until after typeck where we still ensure that the final type for the `const` operand is an integer type. <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-08-04Rollup merge of #128305 - folkertdev:asm-parser-unsupported-operand, r=AmanieuMatthias Krüger-7/+48
improve error message when `global_asm!` uses `asm!` operands follow-up to https://github.com/rust-lang/rust/pull/128207 what was ``` error: expected expression, found keyword `in` --> src/lib.rs:1:31 | 1 | core::arch::global_asm!("{}", in(reg)); | ^^ expected expression ``` becomes ``` error: the `in` operand cannot be used with `global_asm!` --> $DIR/parse-error.rs:150:19 | LL | global_asm!("{}", in(reg)); | ^^ the `in` operand is not meaningful for global-scoped inline assembly, remove it ``` the span of the error is just the keyword, which means that we can't create a machine-applicable suggestion here. The alternative would be to attempt to parse the full operand, but then if there are syntax errors in the operand those would be presented to the user, even though the parser already knows that the output won't be valid. Also that would require more complexity in the parser. So I think this is a nice improvement at very low cost.
2024-08-02add `needs-asm-support` to invalid-sym-operandFolkert-3/+7
2024-08-01separate test file for invalid const operandFolkert-143/+155
2024-08-01separate test file for invalid sym operandFolkert-116/+80
2024-07-30make `///` doc comments compatible with naked functionsFolkert-0/+3
2024-07-28improve error message when global asm uses inline asm operandsFolkert-7/+48
2024-07-28Rollup merge of #127853 - folkertdev:naked-function-error-messages, r=bjorn3Matthias Krüger-73/+246
`#[naked]`: report incompatible attributes tracking issue: https://github.com/rust-lang/rust/issues/90957 this is a re-implementation of https://github.com/rust-lang/rust/pull/93809 by ``@bstrie`` which was closed 2 years ago due to inactivity. This PR takes some of the final comments into account, specifically providing a little more context in error messages, and using an allow list to determine which attributes are compatible with `#[naked]`. Notable attributes that are incompatible with `#[naked]` are: * `#[inline]` * `#[track_caller]` * ~~`#[target_feature]`~~ (this is now allowed, see PR discussion) * `#[test]`, `#[ignore]`, `#[should_panic]` These attributes just directly conflict with what `#[naked]` should do. Naked functions are still important for systems programming, embedded, and operating systems, so I'd like to move them forward.
2024-07-27add `needs-asm-support` to `tests/ui/asm/unsupported-option.rs`Folkert-3/+5
2024-07-27fix `tests/ui/asm/naked-functions.rs` for aarch64Folkert-6/+7
2024-07-27update aarch64 asm testsFolkert-47/+61
2024-07-27allow `#[target_feature]` on `#[naked]` functionsFolkert-25/+6
2024-07-27switch to an allowlist approachFolkert-27/+128
- merge error codes - use attribute name that is incompatible in error message - add test for conditional incompatible attribute - add `linkage` to the allowlist
2024-07-26add `run-rustfix` test for machine-applicable suggestionFolkert-0/+40
2024-07-25improve error message when `global_asm!` uses `asm!` optionsFolkert-41/+63
2024-07-25apply fix suggested by lcnrFolkert-39/+49
2024-07-25Work around #96304 by ignoring one test caseAmanieu d'Antras-43/+42
2024-07-25Rollup merge of #128138 - folkertdev:asm-option-allowlist, r=lcnrMatthias Krüger-2/+2
`#[naked]`: use an allowlist for allowed options on `asm!` in naked functions tracking issue: https://github.com/rust-lang/rust/issues/90957 this is mostly just a refactor, but using an allowlist (rather than a denylist) for which asm options are allowed in naked functions is a little safer. These options are disallowed because naked functions are effectively global asm, but defined using inline asm.
2024-07-24use an allow list for allowed asm options in naked functionsFolkert-2/+2
2024-07-18Update the `binary_asm_label` messageTrevor Gross-5/+15
The link pointed to a closed issue. Create a new one and point the link to it. Also add a help message to hint what change the user could make. Fixes: https://github.com/rust-lang/rust/issues/127821
2024-07-18Change `binary_asm_labels` to only fire on x86 and x86_64Trevor Gross-0/+17
In <https://github.com/rust-lang/rust/pull/126922>, the `binary_asm_labels` lint was added which flags labels such as `0:` and `1:`. Before that change, LLVM was giving a confusing error on x86/x86_64 because of an incorrect interpretation. However, targets other than x86 and x86_64 never had the error message and have not been a problem. This means that the lint was causing code that previously worked to start failing (e.g. `compiler_builtins`), rather than only providing a more clear messages where there has always been an error. Adjust the lint to only fire on x86 and x86_64 assembly to avoid this regression.
2024-07-17add error message when `#[naked]` is used with `#[test]`Folkert-0/+74
2024-07-16improve error message when `#[naked]` is used with `#[track-caller] and ↵Folkert-0/+25
`#[target-feature]``
2024-07-16improve error message when `#[naked]` is used with `#[inline]`Folkert-71/+62