| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Add unit assignment to MIR for `asm!()`
Fixes #89305. `ExprKind::LlvmInlineAsm` gets a `push_assign_unit()` here:
https://github.com/rust-lang/rust/blob/2b6ed3b675475abc01ce7e68bb75b457f0c85684/compiler/rustc_mir_build/src/build/expr/into.rs#L475-L479
The same should probably happen for `ExprKind::InlineAsm`, which fixes the "use of possibly-uninitialized variable" error described in #89305.
|
|
|
|
Update new tests to run on aarch64 platforms.
|
|
Enable tests which are largely architecture-independent on all supported
platforms
|
|
Improve error message when _ is used for in/inout asm operands
As suggested by ```@Commeownist``` in https://github.com/rust-lang/rust/issues/72016#issuecomment-903102415.
|
|
The definition order is already close to the span order, and only differs
in corner cases.
|
|
|
|
|
|
Forbid `!` from being used in `asm!` output
Fixes #87802
r? `@Amanieu`
|
|
|
|
Add support for clobber_abi to asm!
This PR adds the `clobber_abi` feature that was proposed in #81092.
Fixes #81092
cc `@rust-lang/wg-inline-asm`
r? `@nagisa`
|
|
Lint against named asm labels
This adds a deny-by-default lint to prevent the use of named labels in inline `asm!`. Without a solution to #81088 about whether the compiler should rewrite named labels or a special syntax for labels, a lint against them should prevent users from writing assembly that could break for internal compiler reasons, such as inlining or anything else that could change the number of actual inline assembly blocks emitted.
This does **not** resolve the issue with rewriting labels, that still needs a decision if the compiler should do any more work to try to make them work.
|
|
|
|
|
|
|
|
Move naked function ABI check to its own lint
This check was previously categorized under the lint named
`UNSUPPORTED_NAKED_FUNCTIONS`. That lint is future incompatible and will
be turned into an error in a future release. However, as defined in the
Constrained Naked Functions RFC, this check should only be a warning.
This is because it is possible for a naked function to be implemented in
such a way that it does not break even the undefined ABI. For example, a
`jmp` to a `const`.
Therefore, this patch defines a new lint named
`UNDEFINED_NAKED_FUNCTION_ABI` which contains just this single check.
Unlike `UNSUPPORTED_NAKED_FUNCTIONS`, `UNDEFINED_NAKED_FUNCTION_ABI`
will not be converted to an error in the future.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
|
|
Validate FFI-safety warnings on naked functions
Test that FFI-safety warnings don't get accidentally dropped on naked
functions. The big picture is that if you implement a naked function
with the Rust ABI you'll get a warning. Further, if you implement a
naked function with a standardized ABI, but use non-FFI-safe types you
will still get a warning.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
cc ``````@joshtriplett`````` ``````@Amanieu`````` ``````@haraldh``````
|
|
|
|
In most calling conventions, accessing function parameters may require
stack access. However, naked functions have no assembly prelude to set
up stack access. This is why naked functions may only contain a single
`asm!()` block. All parameter access is done inside the `asm!()` block,
so we cannot validate the liveness of the input parameters. Therefore,
we should disable the lint for naked functions.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
|
|
This test proves that naked functions are treated the same as regular
functions regarding unused function parameters. We will change this
behavior in the next patch.
|
|
This check was previously categorized under the lint named
`UNSUPPORTED_NAKED_FUNCTIONS`. That lint is future incompatible and will
be turned into an error in a future release. However, as defined in the
Constrained Naked Functions RFC, this check should only be a warning.
This is because it is possible for a naked function to be implemented in
such a way that it does not break even the undefined ABI. For example, a
`jmp` to a `const`.
Therefore, this patch defines a new lint named
`UNDEFINED_NAKED_FUNCTION_ABI` which contains just this single check.
Unlike `UNSUPPORTED_NAKED_FUNCTIONS`, `UNDEFINED_NAKED_FUNCTION_ABI`
will not be converted to an error in the future.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
|
|
|
|
|
|
|
|
|
|
|
|
Test that FFI-safety warnings don't get accidentally dropped on naked
functions. The big picture is that if you implement a naked function
with the Rust ABI you'll get a warning. Further, if you implement a
naked function with a standardized ABI, but use non-FFI-safe types you
will still get a warning.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
|
|
Reject all uses of the inline attribute on naked functions.
rust-lang/rfcs#2774
rust-lang/rfcs#2972
|
|
Add clobber-only register classes for asm!
These are needed to properly express a function call ABI using a clobber
list, even though we don't support passing actual values into/out of
these registers.
|
|
These are needed to properly express a function call ABI using a clobber
list, even though we don't support passing actual values into/out of
these registers.
|
|
|
|
Add a "raw" option for asm! which ignores format string specifiers
This is useful when including raw assembly snippets using `include_str!`.
|
|
|
|
Otherwise something that ought to seemingly work like `//[x86]
needs-llvm-components: x86` or `//[nll_beyond]should-fail` do not get
evaluated properly.
|
|
Doesn't work though, because compiletest doesn't process ignores on a
per-revision manner.
|
|
Remove support for floating-point constants in asm!
Floating-point constants aren't very useful anyways and this simplifies
the code since the type check can now be done in typeck.
cc `@rust-lang/wg-inline-asm`
r? `@nagisa`
|
|
|
|
Floating-point constants aren't very useful anyways and this simplifies
the code since the type check can now be done in typeck.
|
|
|
|
|
|
|
|
|
|
When there are multiple macros in use, it can be difficult to tell
which one was responsible for producing an error.
|
|
Fixes #84025
|
|
Check for asm support in UI tests that require it
Add `needs-asm-support` compiletest directive, and use it in asm tests
that require asm support without relying on any architecture specific
features.
Closes #84038.
|
|
Add `needs-asm-support` compiletest directive, and use it in asm tests
that require asm support without relying on any architecture specific
features.
|
|
Add `bad_asm_style` to HardwiredLints
This was missed when the lint was added, which prevents the lint from being ignored with `#[allow]`.
|
|
|
|
reduce threads spawned by ui-tests
The test harness already spawns enough tests to keep all cores busy.
Individual tests should keep their own threading to a minimum to avoid context switch overhead.
When running ui tests with lld enabled this shaves about 10% off that testsuite on my machine.
Resolves #81946
|