rust/tests
bors 11d96b5930 Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwco
Strengthen validation of FFI attributes

Previously, `codegen_attrs` validated the attributes `#[ffi_pure]`, `#[ffi_const]`, and `#[ffi_returns_twice]` to make sure that they were only used on foreign functions. However, this validation was insufficient in two ways:

1. `codegen_attrs` only sees items for which code must be generated, so it was unable to raise errors when the attribute was incorrectly applied to macros and the like.
2. the validation code only checked that the item with the attr was foreign, but not that it was a foreign function, allowing these attributes to be applied to foreign statics as well.

This PR moves the validation to `check_attr`, which sees all items. It additionally changes the validation to ensure that the attribute's target is `Target::ForeignFunction`, only allowing the attributes on foreign functions and not foreign statics. Because these attributes are unstable, there is no risk for backwards compatibility. The changes also ending up making the code much easier to read.

This PR is best reviewed commit by commit. Additionally, I was considering moving the tests to the `attribute` subdirectory, to get them out of the general UI directory. I could do that as part of this PR or a follow-up, as the reviewer prefers.

CC: #58328, #58329
2023-02-01 11:37:24 +00:00
..
assembly bump failing assembly & codegen tests from LLVM 14 to LLVM 15 2023-01-17 20:02:01 +01:00
auxiliary
codegen Rollup merge of #107373 - michaelwoerister:dont-merge-vtables-when-debuginfo, r=WaffleLapkin 2023-01-28 05:20:19 +01:00
codegen-units
debuginfo Upgrade mingw-w64 on CI 2023-01-29 13:01:06 +01:00
incremental
mir-opt Reimplement NormalizeArrayLen. 2023-01-29 21:19:02 +00:00
pretty Update tests. 2023-01-29 20:19:26 +01:00
run-make incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
run-make-fulldeps Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
run-pass-valgrind
rustdoc rustdoc: stop making unstable items transparent 2023-01-31 11:27:09 -07:00
rustdoc-gui rustdoc: remove unnecessary wrapper div.item-decl from HTML 2023-01-30 11:06:18 -07:00
rustdoc-js rustdoc: update search test cases 2023-01-14 12:04:12 -07:00
rustdoc-js-std rustdoc: update search test cases 2023-01-14 12:04:12 -07:00
rustdoc-json
rustdoc-ui Modify primary span label for E0308 2023-01-30 20:12:19 +00:00
ui Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwco 2023-02-01 11:37:24 +00:00
ui-fulldeps Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkin 2023-01-28 16:11:33 +00:00
COMPILER_TESTS.md