Skip to content

Commit 4a827db

Browse files
authored
Unrolled build for rust-lang#134213
Rollup merge of rust-lang#134213 - folkertdev:stabilize-naked-functions, r=tgross35,Amanieu,traviscross Stabilize `naked_functions` tracking issue: rust-lang#90957 request for stabilization on tracking issue: rust-lang#90957 (comment) reference PR: rust-lang/reference#1689 # Request for Stabilization Two years later, we're ready to try this again. Even though this issue is already marked as having passed FCP, given the amount of time that has passed and the changes in implementation strategy, we should follow the process again. ## Summary The `naked_functions` feature has two main parts: the `#[naked]` function attribute, and the `naked_asm!` macro. An example of a naked function: ```rust const THREE: usize = 3; #[naked] pub extern "sysv64" fn add_n(number: usize) -> usize { // SAFETY: the validity of the used registers // is guaranteed according to the "sysv64" ABI unsafe { core::arch::naked_asm!( "add rdi, {}", "mov rax, rdi", "ret", const THREE, ) } } ``` When the `#[naked]` attribute is applied to a function, the compiler won't emit a [function prologue](https://en.wikipedia.org/wiki/Function_prologue_and_epilogue) or epilogue when generating code for this function. This attribute is analogous to [`__attribute__((naked))`](https://developer.arm.com/documentation/100067/0608/Compiler-specific-Function--Variable--and-Type-Attributes/--attribute----naked---function-attribute) in C. The use of this feature allows the programmer to have precise control over the assembly that is generated for a given function. The body of a naked function must consist of a single `naked_asm!` invocation, a heavily restricted variant of the `asm!` macro: the only legal operands are `const` and `sym`, and the only legal options are `raw` and `att_syntax`. In lieu of specifying operands, the `naked_asm!` within a naked function relies on the function's calling convention to determine the validity of registers. ## Documentation The Rust Reference: rust-lang/reference#1689 (Previous PR: rust-lang/reference#1153) ## Tests * [tests/run-make/naked-symbol-visiblity](https://github.com/rust-lang/rust/tree/master/tests/codegen/naked-fn) verifies that `pub`, `#[no_mangle]` and `#[linkage = "..."]` work correctly for naked functions * [tests/codegen/naked-fn](https://github.com/rust-lang/rust/tree/master/tests/codegen/naked-fn) has tests for function alignment, use of generics, and validates the exact assembly output on linux, macos, windows and thumb * [tests/ui/asm/naked-*](https://github.com/rust-lang/rust/tree/master/tests/ui/asm) tests for incompatible attributes, generating errors around incorrect use of `naked_asm!`, etc ## Interaction with other (unstable) features ### [fn_align](rust-lang#82232) Combining `#[naked]` with `#[repr(align(N))]` works well, and is tested e.g. here - https://github.com/rust-lang/rust/blob/master/tests/codegen/naked-fn/aligned.rs - https://github.com/rust-lang/rust/blob/master/tests/codegen/naked-fn/min-function-alignment.rs It's tested extensively because we do need to explicitly support the `repr(align)` attribute (and make sure we e.g. don't mistake powers of two for number of bytes). ## History This feature was originally proposed in [RFC 1201](rust-lang/rfcs#1201), filed on 2015-07-10 and accepted on 2016-03-21. Support for this feature was added in [rust-lang#32410](rust-lang#32410), landing on 2016-03-23. Development languished for several years as it was realized that the semantics given in RFC 1201 were insufficiently specific. To address this, a minimal subset of naked functions was specified by [RFC 2972](rust-lang/rfcs#2972), filed on 2020-08-07 and accepted on 2021-11-16. Prior to the acceptance of RFC 2972, all of the stricter behavior specified by RFC 2972 was implemented as a series of warn-by-default lints that would trigger on existing uses of the `naked` attribute; these lints became hard errors in [rust-lang#93153](rust-lang#93153) on 2022-01-22. As a result, today RFC 2972 has completely superseded RFC 1201 in describing the semantics of the `naked` attribute. More recently, the `naked_asm!` macro was added to replace the earlier use of a heavily restricted `asm!` invocation. The `naked_asm!` name is clearer in error messages, and provides a place for documenting the specific requirements of inline assembly in naked functions. The implementation strategy was changed to emitting a global assembly block. In effect, an extern function ```rust extern "C" fn foo() { core::arch::naked_asm!("ret") } ``` is emitted as something similar to ```rust core::arch::global_asm!( "foo:", "ret" ); extern "C" { fn foo(); } ``` The codegen approach was chosen over the llvm naked function attribute because: - the rust compiler can guarantee the behavior (no sneaky additional instructions, no inlining, etc.) - behavior is the same on all backends (llvm, cranelift, gcc, etc) Finally, there is now an allow list of compatible attributes on naked functions, so that e.g. `#[inline]` is rejected with an error. The `#[target_feature]` attribute on naked functions was later made separately unstable, because implementing it is complex and we did not want to block naked functions themselves on how target features work on them. See also rust-lang#138568. relevant PRs for these recent changes - rust-lang#127853 - rust-lang#128651 - rust-lang#128004 - rust-lang#138570 - ### Various historical notes #### `noreturn` [RFC 2972](https://github.com/rust-lang/rfcs/blob/master/text/2972-constrained-naked.md) mentions that naked functions > must have a body which contains only a single asm!() statement which: > iii. must contain the noreturn option. Instead of `asm!`, the current implementation mandates that the body contain a single `naked_asm!` statement. The `naked_asm!` macro is a heavily restricted version of the `asm!` macro, making it easier to talk about and document the rules of assembly in naked functions and give dedicated error messages. For `naked_asm!`, the behavior of the `asm!`'s `noreturn` option is implicit. The `noreturn` option means that it is UB for control flow to fall through the end of the assembly block. With `asm!`, this option is usually used for blocks that diverge (and thus have no return and can be typed as `!`). With `naked_asm!`, the intent is different: usually naked funtions do return, but they must do so from within the assembly block. The `noreturn` option was used so that the compiler would not itself also insert a `ret` instruction at the very end. #### padding / `ud2` A `naked_asm!` block that violates the safety assumption that control flow must not fall through the end of the assembly block is UB. Because no return instruction is emitted, whatever bytes follow the naked function will be executed, resulting in truly undefined behavior. There has been discussion whether rustc should emit an invalid instruction (e.g. `ud2` on x86) after the `naked_asm!` block to at least fail early in the case of an invalid `naked_asm!`. It was however decided that it is more useful to guarantee that `#[naked]` functions NEVER contain any instructions besides those in the `naked_asm!` block. # unresolved questions None r? ``@Amanieu`` I've validated the tests on x86_64 and aarch64
2 parents 8f2819b + df8a3d5 commit 4a827db

File tree

53 files changed

+165
-294
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+165
-294
lines changed

Diff for: compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
#![feature(
2-
no_core,
3-
lang_items,
4-
never_type,
5-
linkage,
6-
extern_types,
7-
naked_functions,
8-
thread_local,
9-
repr_simd
10-
)]
1+
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
112
#![no_core]
123
#![allow(dead_code, non_camel_case_types, internal_features)]
134

Diff for: compiler/rustc_error_codes/src/error_codes/E0787.md

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ An unsupported naked function definition.
33
Erroneous code example:
44

55
```compile_fail,E0787
6-
#![feature(naked_functions)]
7-
86
#[unsafe(naked)]
97
pub extern "C" fn f() -> u32 {
108
42

Diff for: compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,8 @@ declare_features! (
300300
/// Allows patterns with concurrent by-move and by-ref bindings.
301301
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
302302
(accepted, move_ref_pattern, "1.49.0", Some(68354)),
303+
/// Allows using `#[naked]` on functions.
304+
(accepted, naked_functions, "CURRENT_RUSTC_VERSION", Some(90957)),
303305
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
304306
(accepted, native_link_modifiers, "1.61.0", Some(81490)),
305307
/// Allows specifying the bundle link modifier

Diff for: compiler/rustc_feature/src/builtin_attrs.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
443443
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
444444
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
445445
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
446+
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
446447

447448
// Limits:
448449
ungated!(
@@ -515,12 +516,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
515516
// Unstable attributes:
516517
// ==========================================================================
517518

518-
// Linking:
519-
gated!(
520-
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
521-
naked_functions, experimental!(naked)
522-
),
523-
524519
// Testing:
525520
gated!(
526521
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,

Diff for: compiler/rustc_feature/src/unstable.rs

-2
Original file line numberDiff line numberDiff line change
@@ -563,8 +563,6 @@ declare_features! (
563563
(unstable, must_not_suspend, "1.57.0", Some(83310)),
564564
/// Allows `mut ref` and `mut ref mut` identifier patterns.
565565
(incomplete, mut_ref, "1.79.0", Some(123076)),
566-
/// Allows using `#[naked]` on functions.
567-
(unstable, naked_functions, "1.9.0", Some(90957)),
568566
/// Allows using `#[naked]` on `extern "Rust"` functions.
569567
(unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)),
570568
/// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions.

Diff for: compiler/rustc_passes/src/check_attr.rs

-7
Original file line numberDiff line numberDiff line change
@@ -690,13 +690,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
690690
}
691691
}
692692
}
693-
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
694-
// `#[naked]` attribute with just a lint, because we previously
695-
// erroneously allowed it and some crates used it accidentally, to be compatible
696-
// with crates depending on them, we can't throw an error here.
697-
Target::Field | Target::Arm | Target::MacroDef => {
698-
self.inline_attr_str_error_with_macro_def(hir_id, attr, "naked")
699-
}
700693
_ => {
701694
self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
702695
attr_span: attr.span(),

Diff for: library/core/src/arch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub macro asm("assembly template", $(operands,)* $(options($(option),*))?) {
3232
///
3333
/// [Rust By Example]: https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html
3434
/// [reference]: https://doc.rust-lang.org/nightly/reference/inline-assembly.html
35-
#[unstable(feature = "naked_functions", issue = "90957")]
35+
#[stable(feature = "naked_functions", since = "CURRENT_RUSTC_VERSION")]
3636
#[rustc_builtin_macro]
3737
pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?) {
3838
/* compiler built-in */

Diff for: src/doc/unstable-book/src/compiler-flags/sanitizer.md

-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,6 @@ See the [Clang ControlFlowIntegrity documentation][clang-cfi] for more details.
245245
## Example 1: Redirecting control flow using an indirect branch/call to an invalid destination
246246
247247
```rust,ignore (making doc tests pass cross-platform is hard)
248-
#![feature(naked_functions)]
249-
250248
use std::arch::naked_asm;
251249
use std::mem;
252250

Diff for: tests/assembly/naked-functions/aarch64-naked-fn-no-bti-prolog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//@ only-aarch64
55

66
#![crate_type = "lib"]
7-
#![feature(naked_functions)]
7+
88
use std::arch::naked_asm;
99

1010
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",

Diff for: tests/assembly/naked-functions/aix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@[aix] needs-llvm-components: powerpc
1010

1111
#![crate_type = "lib"]
12-
#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)]
12+
#![feature(no_core, asm_experimental_arch, f128, linkage, fn_align)]
1313
#![no_core]
1414

1515
// tests that naked functions work for the `powerpc64-ibm-aix` target.

Diff for: tests/assembly/naked-functions/wasm32.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//@ [wasm32-wasip1] needs-llvm-components: webassembly
1010

1111
#![crate_type = "lib"]
12-
#![feature(no_core, naked_functions, asm_experimental_arch, f128, linkage, fn_align)]
12+
#![feature(no_core, asm_experimental_arch, f128, linkage, fn_align)]
1313
#![no_core]
1414

1515
extern crate minicore;

Diff for: tests/assembly/naked-functions/x86_64-naked-fn-no-cet-prolog.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//@ only-x86_64
55

66
#![crate_type = "lib"]
7-
#![feature(naked_functions)]
7+
88
use std::arch::naked_asm;
99

1010
// The problem at hand: Rust has adopted a fairly strict meaning for "naked functions",

Diff for: tests/auxiliary/minicore.rs

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
negative_impls,
2323
rustc_attrs,
2424
decl_macro,
25-
naked_functions,
2625
f16,
2726
f128,
2827
asm_experimental_arch,

Diff for: tests/codegen/cffi/c-variadic-naked.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#![crate_type = "lib"]
77
#![feature(c_variadic)]
8-
#![feature(naked_functions)]
98
#![no_std]
109

1110
#[unsafe(naked)]

Diff for: tests/codegen/naked-asan.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#![crate_type = "lib"]
88
#![no_std]
9-
#![feature(abi_x86_interrupt, naked_functions)]
9+
#![feature(abi_x86_interrupt)]
1010

1111
pub fn caller() {
1212
page_fault_handler(1, 2);

Diff for: tests/codegen/naked-fn/aligned.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ ignore-arm no "ret" mnemonic
44

55
#![crate_type = "lib"]
6-
#![feature(naked_functions, fn_align)]
6+
#![feature(fn_align)]
77
use std::arch::naked_asm;
88

99
// CHECK: .balign 16

Diff for: tests/codegen/naked-fn/generics.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
//@ only-x86_64
33

44
#![crate_type = "lib"]
5-
#![feature(naked_functions, asm_const)]
65

76
use std::arch::naked_asm;
87

Diff for: tests/codegen/naked-fn/instruction-set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ [thumb-mode] needs-llvm-components: arm
77

88
#![crate_type = "lib"]
9-
#![feature(no_core, lang_items, rustc_attrs, naked_functions)]
9+
#![feature(no_core, lang_items, rustc_attrs)]
1010
#![no_core]
1111

1212
extern crate minicore;

Diff for: tests/codegen/naked-fn/min-function-alignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ needs-asm-support
33
//@ ignore-arm no "ret" mnemonic
44

5-
#![feature(naked_functions, fn_align)]
5+
#![feature(fn_align)]
66
#![crate_type = "lib"]
77

88
// functions without explicit alignment use the global minimum

Diff for: tests/codegen/naked-fn/naked-functions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
//@[thumb] needs-llvm-components: arm
1414

1515
#![crate_type = "lib"]
16-
#![feature(no_core, lang_items, rustc_attrs, naked_functions)]
16+
#![feature(no_core, lang_items, rustc_attrs)]
1717
#![no_core]
1818

1919
extern crate minicore;

Diff for: tests/run-make/naked-symbol-visibility/a_rust_dylib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(naked_functions, linkage)]
1+
#![feature(linkage)]
22
#![crate_type = "dylib"]
33

44
use std::arch::naked_asm;

Diff for: tests/ui/asm/naked-asm-outside-naked-fn.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//@ ignore-nvptx64
44
//@ ignore-spirv
55

6-
#![feature(naked_functions)]
76
#![crate_type = "lib"]
87

98
use std::arch::naked_asm;

Diff for: tests/ui/asm/naked-asm-outside-naked-fn.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
2-
--> $DIR/naked-asm-outside-naked-fn.rs:21:5
2+
--> $DIR/naked-asm-outside-naked-fn.rs:20:5
33
|
44
LL | naked_asm!("")
55
| ^^^^^^^^^^^^^^
66

77
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
8-
--> $DIR/naked-asm-outside-naked-fn.rs:26:9
8+
--> $DIR/naked-asm-outside-naked-fn.rs:25:9
99
|
1010
LL | (|| naked_asm!(""))()
1111
| ^^^^^^^^^^^^^^
1212

1313
error: the `naked_asm!` macro can only be used in functions marked with `#[unsafe(naked)]`
14-
--> $DIR/naked-asm-outside-naked-fn.rs:32:9
14+
--> $DIR/naked-asm-outside-naked-fn.rs:31:9
1515
|
1616
LL | naked_asm!("");
1717
| ^^^^^^^^^^^^^^

Diff for: tests/ui/asm/naked-functions-ffi.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ check-pass
22
//@ needs-asm-support
3-
#![feature(naked_functions)]
43
#![crate_type = "lib"]
54

65
use std::arch::naked_asm;

Diff for: tests/ui/asm/naked-functions-ffi.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: `extern` fn uses type `char`, which is not FFI-safe
2-
--> $DIR/naked-functions-ffi.rs:9:28
2+
--> $DIR/naked-functions-ffi.rs:8:28
33
|
44
LL | pub extern "C" fn naked(p: char) -> u128 {
55
| ^^^^ not FFI-safe
@@ -9,7 +9,7 @@ LL | pub extern "C" fn naked(p: char) -> u128 {
99
= note: `#[warn(improper_ctypes_definitions)]` on by default
1010

1111
warning: `extern` fn uses type `u128`, which is not FFI-safe
12-
--> $DIR/naked-functions-ffi.rs:9:37
12+
--> $DIR/naked-functions-ffi.rs:8:37
1313
|
1414
LL | pub extern "C" fn naked(p: char) -> u128 {
1515
| ^^^^ not FFI-safe

Diff for: tests/ui/asm/naked-functions-inline.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//@ needs-asm-support
2-
#![feature(naked_functions)]
32
#![crate_type = "lib"]
43

54
use std::arch::naked_asm;

Diff for: tests/ui/asm/naked-functions-inline.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
2-
--> $DIR/naked-functions-inline.rs:13:1
2+
--> $DIR/naked-functions-inline.rs:12:1
33
|
44
LL | #[unsafe(naked)]
55
| ---------------- function marked with `#[unsafe(naked)]` here
66
LL | #[inline]
77
| ^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
88

99
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
10-
--> $DIR/naked-functions-inline.rs:20:1
10+
--> $DIR/naked-functions-inline.rs:19:1
1111
|
1212
LL | #[unsafe(naked)]
1313
| ---------------- function marked with `#[unsafe(naked)]` here
1414
LL | #[inline(always)]
1515
| ^^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
1616

1717
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
18-
--> $DIR/naked-functions-inline.rs:27:1
18+
--> $DIR/naked-functions-inline.rs:26:1
1919
|
2020
LL | #[unsafe(naked)]
2121
| ---------------- function marked with `#[unsafe(naked)]` here
2222
LL | #[inline(never)]
2323
| ^^^^^^^^^^^^^^^^ the `inline` attribute is incompatible with `#[unsafe(naked)]`
2424

2525
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
26-
--> $DIR/naked-functions-inline.rs:34:19
26+
--> $DIR/naked-functions-inline.rs:33:19
2727
|
2828
LL | #[unsafe(naked)]
2929
| ---------------- function marked with `#[unsafe(naked)]` here

Diff for: tests/ui/asm/naked-functions-instruction-set.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//@ build-pass
66

77
#![crate_type = "lib"]
8-
#![feature(no_core, naked_functions)]
8+
#![feature(no_core)]
99
#![no_core]
1010

1111
extern crate minicore;

Diff for: tests/ui/asm/naked-functions-rustic-abi.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//@ build-pass
77
//@ needs-asm-support
88

9-
#![feature(naked_functions, naked_functions_rustic_abi, rust_cold_cc)]
9+
#![feature(naked_functions_rustic_abi, rust_cold_cc)]
1010
#![crate_type = "lib"]
1111

1212
use std::arch::{asm, naked_asm};

Diff for: tests/ui/asm/naked-functions-target-feature.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@ build-pass
22
//@ needs-asm-support
33

4-
#![feature(naked_functions, naked_functions_target_feature)]
4+
#![feature(naked_functions_target_feature)]
55
#![crate_type = "lib"]
66

77
use std::arch::{asm, naked_asm};

Diff for: tests/ui/asm/naked-functions-testattrs.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ needs-asm-support
22
//@ compile-flags: --test
33

4-
#![feature(naked_functions)]
54
#![feature(test)]
65
#![crate_type = "lib"]
76

Diff for: tests/ui/asm/naked-functions-testattrs.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
2-
--> $DIR/naked-functions-testattrs.rs:11:1
2+
--> $DIR/naked-functions-testattrs.rs:10:1
33
|
44
LL | #[test]
55
| ------- function marked with testing attribute here
66
LL | #[unsafe(naked)]
77
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
88

99
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
10-
--> $DIR/naked-functions-testattrs.rs:19:1
10+
--> $DIR/naked-functions-testattrs.rs:18:1
1111
|
1212
LL | #[test]
1313
| ------- function marked with testing attribute here
1414
LL | #[unsafe(naked)]
1515
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
1616

1717
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
18-
--> $DIR/naked-functions-testattrs.rs:27:1
18+
--> $DIR/naked-functions-testattrs.rs:26:1
1919
|
2020
LL | #[test]
2121
| ------- function marked with testing attribute here
2222
LL | #[unsafe(naked)]
2323
| ^^^^^^^^^^^^^^^^ `#[unsafe(naked)]` is incompatible with testing attributes
2424

2525
error[E0736]: cannot use `#[unsafe(naked)]` with testing attributes
26-
--> $DIR/naked-functions-testattrs.rs:34:1
26+
--> $DIR/naked-functions-testattrs.rs:33:1
2727
|
2828
LL | #[bench]
2929
| -------- function marked with testing attribute here

0 commit comments

Comments
 (0)