os-rust/compiler/rustc_error_messages/locales/en-US
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
..
ast_lowering.ftl Improve the help message for an invalid calling convention 2022-09-22 22:18:30 +02:00
ast_passes.ftl Autoderive ExternBlockSuggestion 2023-01-19 13:52:15 +01:00
attr.ftl Reorder diagnostics in code order, then alphabetical order 2022-08-22 20:19:19 +02:00
borrowck.ftl Handle diagnostics customization on the fluent side 2023-01-17 08:21:34 +00:00
builtin_macros.ftl Replace - with _ in ftl slugs for better grepability 2022-08-12 22:22:55 +02:00
codegen_gcc.ftl Fix some Fluent typos 2023-01-27 11:27:37 +00:00
codegen_llvm.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
codegen_ssa.ftl Fix some Fluent typos 2023-01-27 11:27:37 +00:00
compiletest.ftl errors: rename typeck.ftl to hir_analysis.ftl 2022-10-03 13:52:17 +01:00
const_eval.ftl Addressed trailing newlines, odd whitespace skipped by x.py fmt 2022-08-22 12:38:16 -03:00
driver.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
errors.ftl ADD - IntoDiagnostic conformance for TargetDataLayoutErrors in rustc_errors 2022-10-12 16:54:25 -04:00
expand.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
hir_analysis.ftl Move autoderef to rustc_hir_analysis 2023-01-11 20:12:57 +00:00
hir_typeck.ftl add checks for the signature of the lang item 2023-01-11 14:35:08 -08:00
incremental.ftl incremental: migrate diagnostics 2023-01-30 17:11:35 +00:00
infer.ftl Rollup merge of #106971 - oli-obk:tait_error, r=davidtwco 2023-01-26 15:02:19 +01:00
interface.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
lint.ftl Reintroduce multiple_supertrait_upcastable lint 2023-01-28 15:08:07 +00:00
metadata.ftl Auto merge of #105609 - bjorn3:shrink_rustc_dev, r=jyn514 2023-01-03 08:05:54 +00:00
middle.ftl Match crate and slug names 2022-11-21 15:24:50 +01:00
mir_build.ftl Rollup merge of #106978 - mejrs:mir_build3, r=davidtwco 2023-01-26 15:02:20 +01:00
mir_dataflow.ftl Rename rustc_mir_dataflow diagnostic to mir_dataflow 2022-08-23 13:48:15 +01:00
monomorphize.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
parse.ftl Migrate some range parsing diagnostics 2023-01-28 21:57:35 +00:00
passes.ftl Auto merge of #107257 - inquisitivecrystal:ffi-attr, r=davidtwco 2023-02-01 11:37:24 +00:00
plugin_impl.ftl Migrate rustc_plugin_impl to SessionDiagnostic 2022-08-22 16:35:05 +01:00
privacy.ftl change AccessLevels representation 2022-09-14 18:11:00 +03:00
query_system.ftl query_system: finish migration 2022-10-10 14:20:16 +01:00
resolve.ftl migrating rustc_resolve to SessionDiagnostic. work in progress. start 2022-11-13 19:39:26 +05:30
save_analysis.ftl save_analysis: Migrate diagnostics 2022-08-24 06:50:16 +09:00
session.ftl session: diagnostic migration lint on more fns 2023-01-30 17:11:35 +00:00
symbol_mangling.ftl UPDATE - merge and avoid translations for symbol mangling test output 2022-09-13 16:19:32 -04:00
trait_selection.ftl Move autoderef to rustc_hir_analysis 2023-01-11 20:12:57 +00:00
ty_utils.ftl Properly pluralize 'generic constants' 2023-01-16 20:21:29 +00:00