Commit Graph

17 Commits

Author SHA1 Message Date
Oli Scherer
d5ffe11cd9 Make a test independent of 64/32 bit 2022-05-24 16:28:57 +00:00
Oli Scherer
0d88631059 Add the transmute and asm checks to typeck as deferred checks 2022-05-24 16:28:57 +00:00
jam1garner
bf26d87df6 Add regression test for naked functions with invalid asm syntax 2022-04-01 12:24:04 -04:00
jam1garner
0df84cdc49 Don't emit non-asm contents error for naked function composed of errors 2022-04-01 11:02:36 -04:00
Camille GILLOT
27d8cd7db0 Cleanup feature gates. 2022-03-03 18:50:28 +01:00
Tomasz Miąsko
beeba4bcea Reject may_unwind option in naked functions 2022-01-21 00:00:00 +00:00
Tomasz Miąsko
888332fee4 Reject unsupported naked functions
Transition unsupported naked functions future incompatibility lint into
an error:

* Naked functions must contain a single inline assembly block.
  Introduced as future incompatibility lint in 1.50 #79653.
  Change into an error fixes a soundness issue described in #32489.

* Naked functions must not use any forms of inline attribute.
  Introduced as future incompatibility lint in 1.56 #87652.
2022-01-21 17:38:21 +01:00
Tomasz Miąsko
61c233bac3 Remove ui tests for LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Amanieu d'Antras
44a3a66ee8 Stabilize asm! and global_asm!
They are also removed from the prelude as per the decision in
https://github.com/rust-lang/rust/issues/87228.

stdarch and compiler-builtins are updated to work with the new, stable
asm! and global_asm! macros.
2021-12-12 11:20:03 +00:00
Amanieu d'Antras
eb32c00216 Add features gates for experimental asm features 2021-11-07 01:23:53 +00:00
Adam Gemmell
27213b0254 Disable some tests for platforms without registers.
Update new tests to run on aarch64 platforms.
2021-09-24 17:00:57 +00:00
Adam Gemmell
6d218d02d9 Add inline asm! tests for aarch64
Enable tests which are largely architecture-independent on all supported
platforms
2021-09-24 16:23:37 +00:00
Amanieu d'Antras
632a400a36 Fix ui tests for llvm_asm! deprecation 2021-08-15 13:27:13 +01:00
Amanieu d'Antras
e9fb7bada1 Fix error message typo for pure asm without outputs 2021-08-12 12:42:58 +01:00
Nathaniel McCallum
ba9afb58b3 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
2021-08-04 15:23:50 -04:00
Nathaniel McCallum
157e0a0e8f Validate that naked functions are never inlined
Reject all uses of the inline attribute on naked functions.

rust-lang/rfcs#2774
rust-lang/rfcs#2972
2021-08-02 21:49:51 -04:00
Tomasz Miąsko
8065dabd17 Validate naked functions definitions 2020-12-07 00:00:00 +00:00