rust/compiler
bors 1b3b8e7b02 Auto merge of #128651 - folkertdev:naked-asm-macro-v2, r=Amanieu
add `naked_asm!` macro for use in `#[naked]` functions

tracking issue: https://github.com/rust-lang/rust/issues/90957

Adds the `core::arch::naked_asm` macro, to be used in `#[naked]` functions, but providing better error messages and a place to explain the restrictions on assembly in naked functions.

This PR does not yet require that the `naked_asm!` macro is used inside of `#[naked]` functions:

- the `asm!` macro can still be used in `#[naked]` functions currently, with the same restrictions and error messages as before.
- the `naked_asm!` macro can be used outside of `#[naked]` functions. It has not yet been decided whether that should be allowed long-term.

In this PR, the parsing code of `naked_asm!` now enforces the restrictions on assembly in naked functions, with the exception of checking that the `noreturn` option is specified. It also has not currently been decided if `noreturn` should be implicit or not.

This PR looks large because it touches a bunch of tests. The code changes are mostly straightforward I think: we now have 3 flavors of assembly macro, and that information must be propagated through the parsing code and error messages.

cc `@Lokathor`

r? `@Amanieu`
2024-10-06 21:51:18 +00:00
..
rustc disable size asserts in the compiler when randomizing layouts 2024-08-31 23:56:45 +02:00
rustc_abi Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_arena Remove unnecessary lifetimes from Arena. 2024-09-13 15:33:19 +10:00
rustc_ast various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_ast_ir Add warn(unreachable_pub) to several crates. 2024-08-16 08:46:13 +10:00
rustc_ast_lowering rm ItemKind::OpaqueTy 2024-10-04 23:28:22 +00:00
rustc_ast_passes Rollup merge of #130419 - nnethercote:streamline-HirCollector, r=GuillaumeGomez 2024-10-03 13:47:59 +02:00
rustc_ast_pretty Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_attr Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercote 2024-10-04 15:42:53 +02:00
rustc_baked_icu_data Don't add warn(unreachable_pub) to rustc_baked_icu. 2024-08-16 08:46:52 +10:00
rustc_borrowck various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_builtin_macros various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_codegen_cranelift various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_codegen_gcc Use wide pointers consistenly across the compiler 2024-10-04 14:06:48 +02:00
rustc_codegen_llvm Use wide pointers consistenly across the compiler 2024-10-04 14:06:48 +02:00
rustc_codegen_ssa various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_const_eval various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_data_structures format 2024-10-01 17:21:56 -04:00
rustc_driver
rustc_driver_impl Update out-dated link 2024-10-06 18:08:28 +08:00
rustc_error_codes disallow asm! in #[naked] functions 2024-10-06 18:12:25 +02:00
rustc_error_messages Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_errors bump few deps 2024-09-27 09:23:05 +03:00
rustc_expand Auto merge of #129670 - est31:cfg_attr_crate_type_name_error, r=Urgau 2024-10-06 17:00:02 +00:00
rustc_feature Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercote 2024-10-04 15:42:53 +02:00
rustc_fluent_macro Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_fs_util Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_graphviz Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_hir rm ItemKind::OpaqueTy 2024-10-04 23:28:22 +00:00
rustc_hir_analysis Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errors 2024-10-05 06:19:35 +00:00
rustc_hir_pretty rm ItemKind::OpaqueTy 2024-10-04 23:28:22 +00:00
rustc_hir_typeck various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_incremental Dogfood feature(file_buffered) 2024-09-24 14:25:16 -07:00
rustc_index Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnay 2024-10-04 14:11:34 -07:00
rustc_interface Handle rustc_interface cases of rustc::potential_query_instability lint 2024-10-05 10:01:27 +03:00
rustc_lexer Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_lint Auto merge of #129670 - est31:cfg_attr_crate_type_name_error, r=Urgau 2024-10-06 17:00:02 +00:00
rustc_lint_defs Auto merge of #128651 - folkertdev:naked-asm-macro-v2, r=Amanieu 2024-10-06 21:51:18 +00:00
rustc_llvm Unpin cc and upgrade to the latest version 2024-09-30 13:31:42 -04:00
rustc_log Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_macros Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_metadata Rollup merge of #130518 - scottmcm:stabilize-controlflow-extra, r=dtolnay 2024-10-04 14:11:34 -07:00
rustc_middle various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_mir_build various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_mir_dataflow various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_mir_transform Auto merge of #130540 - veera-sivarajan:fix-87525, r=estebank 2024-10-06 02:39:23 +00:00
rustc_monomorphize Use wide pointers consistenly across the compiler 2024-10-04 14:06:48 +02:00
rustc_next_trait_solver Auto merge of #130821 - lcnr:nalgebra-hang-2, r=compiler-errors 2024-10-02 19:21:44 +00:00
rustc_parse On function and method calls in patterns, link to the book 2024-10-06 01:44:59 +00:00
rustc_parse_format Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_passes various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_pattern_analysis cleanup: don't clone types that are Copy 2024-09-29 13:31:30 +02:00
rustc_privacy Visit opaques for visibilities. 2024-10-04 23:31:55 +00:00
rustc_query_impl Handle rustc_query_impl cases of rustc::potential_query_instability lint 2024-10-03 12:47:08 +03:00
rustc_query_system add unstable support for outputting file checksums for use in cargo 2024-10-01 21:23:20 -06:00
rustc_resolve Auto merge of #131259 - ismailarilik:handle-potential-query-instability-lint-for-librustdoc, r=notriddle 2024-10-06 14:04:21 +00:00
rustc_sanitizers Fix some pub(crate) that were undetected bc of instrument 2024-10-04 14:02:09 -04:00
rustc_serialize Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
rustc_session Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercote 2024-10-04 15:42:53 +02:00
rustc_smir various fixes for naked_asm! implementation 2024-10-06 19:00:09 +02:00
rustc_span Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercote 2024-10-04 15:42:53 +02:00
rustc_symbol_mangling Rollup merge of #130344 - Jaic1:fix-116306, r=BoxyUwU 2024-09-23 06:45:33 +02:00
rustc_target Update target fns to latest main 2024-10-05 12:14:35 +03:00
rustc_trait_selection Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errors 2024-10-05 06:19:35 +00:00
rustc_traits Compiler: Rename "object safe" to "dyn compatible" 2024-09-25 13:26:48 +02:00
rustc_transmute Fix some pub(crate) that were undetected bc of instrument 2024-10-04 14:02:09 -04:00
rustc_ty_utils rm ItemKind::OpaqueTy 2024-10-04 23:28:22 +00:00
rustc_type_ir Elaborate supertrait span correctly to label the error better 2024-10-04 17:15:28 -04:00
rustc_type_ir_macros Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
stable_mir clarify semantics of ConstantIndex MIR projection 2024-10-05 12:19:14 +02:00