stabilize naked_functions
This commit is contained in:
parent
49e5e4e3a5
commit
df8a3d5f1d
53 changed files with 165 additions and 294 deletions
|
@ -1,13 +1,4 @@
|
|||
#![feature(
|
||||
no_core,
|
||||
lang_items,
|
||||
never_type,
|
||||
linkage,
|
||||
extern_types,
|
||||
naked_functions,
|
||||
thread_local,
|
||||
repr_simd
|
||||
)]
|
||||
#![feature(no_core, lang_items, never_type, linkage, extern_types, thread_local, repr_simd)]
|
||||
#![no_core]
|
||||
#![allow(dead_code, non_camel_case_types, internal_features)]
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ An unsupported naked function definition.
|
|||
Erroneous code example:
|
||||
|
||||
```compile_fail,E0787
|
||||
#![feature(naked_functions)]
|
||||
|
||||
#[unsafe(naked)]
|
||||
pub extern "C" fn f() -> u32 {
|
||||
42
|
||||
|
|
|
@ -300,6 +300,8 @@ declare_features! (
|
|||
/// Allows patterns with concurrent by-move and by-ref bindings.
|
||||
/// For example, you can write `Foo(a, ref b)` where `a` is by-move and `b` is by-ref.
|
||||
(accepted, move_ref_pattern, "1.49.0", Some(68354)),
|
||||
/// Allows using `#[naked]` on functions.
|
||||
(accepted, naked_functions, "CURRENT_RUSTC_VERSION", Some(90957)),
|
||||
/// Allows specifying modifiers in the link attribute: `#[link(modifiers = "...")]`
|
||||
(accepted, native_link_modifiers, "1.61.0", Some(81490)),
|
||||
/// Allows specifying the bundle link modifier
|
||||
|
|
|
@ -443,6 +443,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
ungated!(unsafe(Edition2024) no_mangle, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
|
||||
ungated!(used, Normal, template!(Word, List: "compiler|linker"), WarnFollowing, EncodeCrossCrate::No),
|
||||
ungated!(link_ordinal, Normal, template!(List: "ordinal"), ErrorPreceding, EncodeCrossCrate::Yes),
|
||||
ungated!(unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No),
|
||||
|
||||
// Limits:
|
||||
ungated!(
|
||||
|
@ -515,12 +516,6 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
// Unstable attributes:
|
||||
// ==========================================================================
|
||||
|
||||
// Linking:
|
||||
gated!(
|
||||
unsafe naked, Normal, template!(Word), WarnFollowing, EncodeCrossCrate::No,
|
||||
naked_functions, experimental!(naked)
|
||||
),
|
||||
|
||||
// Testing:
|
||||
gated!(
|
||||
test_runner, CrateLevel, template!(List: "path"), ErrorFollowing,
|
||||
|
|
|
@ -563,8 +563,6 @@ declare_features! (
|
|||
(unstable, must_not_suspend, "1.57.0", Some(83310)),
|
||||
/// Allows `mut ref` and `mut ref mut` identifier patterns.
|
||||
(incomplete, mut_ref, "1.79.0", Some(123076)),
|
||||
/// Allows using `#[naked]` on functions.
|
||||
(unstable, naked_functions, "1.9.0", Some(90957)),
|
||||
/// Allows using `#[naked]` on `extern "Rust"` functions.
|
||||
(unstable, naked_functions_rustic_abi, "CURRENT_RUSTC_VERSION", Some(138997)),
|
||||
/// Allows using `#[target_feature(enable = "...")]` on `#[naked]` on functions.
|
||||
|
|
|
@ -690,13 +690,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
// FIXME(#80564): We permit struct fields, match arms and macro defs to have an
|
||||
// `#[naked]` attribute with just a lint, because we previously
|
||||
// erroneously allowed it and some crates used it accidentally, to be compatible
|
||||
// with crates depending on them, we can't throw an error here.
|
||||
Target::Field | Target::Arm | Target::MacroDef => {
|
||||
self.inline_attr_str_error_with_macro_def(hir_id, attr, "naked")
|
||||
}
|
||||
_ => {
|
||||
self.dcx().emit_err(errors::AttrShouldBeAppliedToFn {
|
||||
attr_span: attr.span(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue