rust/compiler
Jubilee Young 2f4a55b41d compiler: plug unsupported ABI leakage from the AST
We modify rustc_ast_lowering to prevent all unsupported ABIs
from leaking through the HIR without being checked for target support.
Previously ad-hoc checking on various HIR items required making sure
we check every HIR item which could contain an `extern "{abi}"` string.
This is a losing proposition compared to gating the lowering itself.

As a consequence, unsupported ABI strings will now hard-error instead of
triggering the FCW `unsupported_fn_ptr_calling_conventions`.
This FCW was upgraded to warn in dependencies in Rust 1.87 which was
released on 2025 May 17, and it is now 2025 June, so it has become
active within a stable Rust version.

As we already had errored on these ABIs in most other positions, and
have warned for fn ptrs, this breakage has had reasonable foreshadowing.

However, this does cause errors for usages of `extern "{abi}"` that were
theoretically writeable within source but could not actually be applied
in any useful way by Rust programmers without either warning or error.
For instance, trait declarations without impls were never checked.
These are the exact kinds of leakages that this new approach prevents.

A deprecation cycle is not useful for these marginal cases as upon impl,
even default impls within traits, different HIR objects would be used.
Details of our HIR analysis meant that those objects did get checked.

We choose to error twice if an ABI is also barred by a feature gate
on the presumption that usage of a target-incorrect ABI is intentional.

Co-authored-by: Ralf Jung <post@ralfj.de>
2025-06-23 09:39:23 -07:00
..
rustc Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_abi compiler: Rename LayoutS to LayoutData in comments 2025-06-20 12:50:12 -05:00
rustc_arena Introduce Arena::try_alloc_from_iter. 2025-04-19 01:13:18 +00:00
rustc_ast Auto merge of #142878 - GuillaumeGomez:rollup-53dohob, r=GuillaumeGomez 2025-06-22 17:10:28 +00:00
rustc_ast_ir Use -Wunused_crate_dependencies for compiler crates. 2025-03-20 08:59:43 +11:00
rustc_ast_lowering compiler: plug unsupported ABI leakage from the AST 2025-06-23 09:39:23 -07:00
rustc_ast_passes Fold unnecessary visit_struct_field_def in AstValidator 2025-06-16 17:48:21 +00:00
rustc_ast_pretty Insert parentheses around binary operation with attribute 2025-06-20 13:49:12 -07:00
rustc_attr_data_structures move naked checks out of check_attr.rs 2025-06-23 12:22:57 +02:00
rustc_attr_parsing move naked checks out of check_attr.rs 2025-06-23 12:22:57 +02:00
rustc_baked_icu_data Add unreachable_pub to RUSTC_LINT_FLAGS for compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_borrowck Remove old format_args diagnostic. 2025-06-19 14:08:29 +02:00
rustc_builtin_macros Auto merge of #142878 - GuillaumeGomez:rollup-53dohob, r=GuillaumeGomez 2025-06-22 17:10:28 +00:00
rustc_codegen_cranelift cranelift: fix target feature name type: "fxsr" 2025-06-22 16:32:54 +02:00
rustc_codegen_gcc various minor target feature cleanups 2025-06-19 10:50:03 +09:00
rustc_codegen_llvm centralize -Zmin-function-alignment logic 2025-06-22 00:47:10 +02:00
rustc_codegen_ssa rewrite #[naked] parser 2025-06-23 12:21:43 +02:00
rustc_const_eval centralize -Zmin-function-alignment logic 2025-06-22 00:47:10 +02:00
rustc_data_structures Rollup merge of #142868 - klensy:dc, r=oli-obk 2025-06-22 17:35:36 +02:00
rustc_driver Remove recursion_limit increases. 2025-04-02 16:25:27 +11:00
rustc_driver_impl Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkov 2025-06-20 13:36:01 -04:00
rustc_error_codes convert the optimize attribute to a new parser 2025-06-18 13:48:42 +02:00
rustc_error_messages Extract Translator struct 2025-06-19 13:02:04 -05:00
rustc_errors Extract SilentEmitter 2025-06-19 13:05:01 -05:00
rustc_expand Auto merge of #142706 - fee1-dead-contrib:push-zsznlqyrzsqo, r=oli-obk 2025-06-22 14:03:44 +00:00
rustc_feature Port #[rustc_pub_transparent] to the new attribute system 2025-06-21 21:52:25 +03:00
rustc_fluent_macro Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
rustc_fs_util Retry if creating temp fails with access denied 2025-04-25 11:28:36 +00:00
rustc_graphviz Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
rustc_hashes Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
rustc_hir All HIR attributes are outer 2025-06-21 11:11:34 -07:00
rustc_hir_analysis move naked checks out of check_attr.rs 2025-06-23 12:22:57 +02:00
rustc_hir_pretty All HIR attributes are outer 2025-06-21 11:11:34 -07:00
rustc_hir_typeck rewrite #[naked] parser 2025-06-23 12:21:43 +02:00
rustc_incremental Auto merge of #139758 - Zoxc:thread-local-graph, r=oli-obk 2025-05-07 12:39:54 +00:00
rustc_index index: add method for checking range on DenseBitSet 2025-06-04 00:47:12 +02:00
rustc_index_macros In rustc_mir_tranform, iterate over index newtypes instead of ints 2025-04-12 11:53:07 +00:00
rustc_infer Cache instantiation of canonical binder 2025-06-19 04:23:25 +00:00
rustc_interface Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obk 2025-06-20 23:25:54 -04:00
rustc_lexer rustc_lexer: typo fix + small cleanups 2025-06-06 13:08:16 +00:00
rustc_lint Port #[no_mangle] to new attribute parsing infrastructure 2025-06-22 22:17:04 +02:00
rustc_lint_defs Rollup merge of #141937 - WaffleLapkin:never-report-in-deps, r=oli-obk,traviscross 2025-06-15 23:51:55 +02:00
rustc_llvm rustc_llvm: add Windows system libs only when cross-compiling from Windows 2025-05-31 15:47:14 +02:00
rustc_log Add documentation for init_logger_with_additional_layer 2025-06-12 12:11:15 +02:00
rustc_macros Remove all unused feature gates from the compiler 2025-06-08 14:50:42 +00:00
rustc_metadata Use gen blocks in the compiler instead of from_coroutine 2025-06-20 18:57:52 +00:00
rustc_middle fix 142891 2025-06-23 12:20:02 +02:00
rustc_mir_build Unimplement unsized_locals 2025-06-13 01:16:36 +02:00
rustc_mir_dataflow update cfg(bootstrap) 2025-05-12 15:33:37 +02:00
rustc_mir_transform Auto merge of #142675 - tmiasko:preserve-cache, r=oli-obk 2025-06-22 06:49:02 +00:00
rustc_monomorphize Skip collecting no-op DropGlue in vtables 2025-06-21 18:59:36 -04:00
rustc_next_trait_solver Rollup merge of #142617 - lcnr:search_graph-3, r=compiler-errors 2025-06-22 08:49:04 +02:00
rustc_parse Rollup merge of #142798 - camsteffen:recover-semi, r=compiler-errors 2025-06-22 17:35:35 +02:00
rustc_parse_format Add ParseMode::Diagnostic unit tests 2025-06-09 16:28:58 +02:00
rustc_passes move naked checks out of check_attr.rs 2025-06-23 12:22:57 +02:00
rustc_pattern_analysis Use builin_index instead of hand-rolling it 2025-05-28 10:03:01 +00:00
rustc_privacy Reorder fields in hir::ItemKind variants. 2025-05-30 02:23:20 +10:00
rustc_proc_macro Do not get proc_macro from the sysroot in rustc 2025-05-27 15:49:28 +00:00
rustc_query_impl Auto merge of #140145 - Zoxc:job-server-proxy, r=SparrowLii 2025-05-01 04:11:52 +00:00
rustc_query_system Rollup merge of #142384 - celinval:chores-rayon-mv, r=oli-obk 2025-06-20 23:25:54 -04:00
rustc_resolve Auto merge of #142706 - fee1-dead-contrib:push-zsznlqyrzsqo, r=oli-obk 2025-06-22 14:03:44 +00:00
rustc_sanitizers Replace some Option<Span> with Span and use DUMMY_SP instead of None 2025-06-05 14:14:59 +00:00
rustc_serialize Add a few inline directives in rustc_serialize. 2025-06-21 23:54:16 +00:00
rustc_session Rollup merge of #142650 - camsteffen:refactor-translator, r=petrochenkov 2025-06-20 13:36:01 -04:00
rustc_smir Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk 2025-06-17 15:08:50 +00:00
rustc_span Rollup merge of #142874 - marxin:cranelift-typo-fix, r=bjorn3 2025-06-22 17:35:36 +02:00
rustc_symbol_mangling Change __rust_no_alloc_shim_is_unstable to be a function 2025-06-16 10:54:07 -07:00
rustc_target Rollup merge of #142765 - workingjubilee:more-abimap-docs, r=compiler-errors 2025-06-20 23:25:58 -04:00
rustc_thread_pool Apply suggestions from code review 2025-06-16 12:27:47 -07:00
rustc_trait_selection Rollup merge of #142594 - mejrs:new_desugaring, r=chenyukang 2025-06-22 17:35:33 +02:00
rustc_traits FIXME(-Znext-solver) triage 2025-06-03 14:23:56 +02:00
rustc_transmute transmutability: shift abstraction boundary 2025-06-09 14:08:12 +00:00
rustc_ty_utils Rollup merge of #142619 - klensy:or_fun_call, r=nnethercote 2025-06-18 18:06:51 +02:00
rustc_type_ir Rollup merge of #142617 - lcnr:search_graph-3, r=compiler-errors 2025-06-22 08:49:04 +02:00
rustc_type_ir_macros Split TypeFolder and FallibleTypeFolder 2025-04-15 18:30:35 +00:00
stable_mir Change rustc_driver dependency on stable_mir crate 2025-04-30 15:39:52 -07:00