From 03bd1ac70923ff82100c5207feea47a0d02f3363 Mon Sep 17 00:00:00 2001 From: Luca Versari Date: Mon, 1 Jun 2026 21:34:00 +0200 Subject: [PATCH] stabilize optimize attribute (size, speed, and none) This commit stabilizes the `#[optimize]` attribute, which allows for more fine-grained control of optimization levels. --- .../src/attributes/codegen_attrs.rs | 2 +- compiler/rustc_feature/src/accepted.rs | 2 + compiler/rustc_feature/src/builtin_attrs.rs | 3 +- compiler/rustc_feature/src/unstable.rs | 2 - library/alloc/src/lib.rs | 1 - library/alloctests/lib.rs | 1 - library/core/src/lib.rs | 1 - library/std/src/lib.rs | 1 - .../issues/issue-136329-optnone-noinline.rs | 2 - tests/codegen-llvm/optimize-attr-1.rs | 1 - tests/mir-opt/optimize_none.rs | 2 - tests/rustdoc-json/attrs/optimize.rs | 2 - tests/ui/attributes/args-checked.rs | 1 - tests/ui/attributes/args-checked.stderr | 52 +++--- tests/ui/attributes/malformed-attrs.rs | 1 - tests/ui/attributes/malformed-attrs.stderr | 174 +++++++++--------- tests/ui/attributes/optimize-smoke-test.rs | 2 - tests/ui/attributes/optimize.rs | 9 +- tests/ui/attributes/optimize.stderr | 22 +-- tests/ui/coroutine/other-attribute-on-gen.rs | 1 - ...tation-attribute-allowlist-issue-159015.rs | 1 - ...on-attribute-allowlist-issue-159015.stderr | 16 +- .../feature-gate-optimize_attribute.rs | 15 -- .../feature-gate-optimize_attribute.stderr | 64 ------- 24 files changed, 144 insertions(+), 234 deletions(-) delete mode 100644 tests/ui/feature-gates/feature-gate-optimize_attribute.rs delete mode 100644 tests/ui/feature-gates/feature-gate-optimize_attribute.stderr diff --git a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs index 28016aec48a50..dbd74b84ccc46 100644 --- a/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs @@ -26,7 +26,7 @@ impl SingleAttributeParser for OptimizeParser { Allow(Target::Method(MethodKind::Inherent)), ]); const TEMPLATE: AttributeTemplate = template!(List: &["size", "speed", "none"]); - const STABILITY: AttributeStability = unstable!(optimize_attribute); + const STABILITY: AttributeStability = AttributeStability::Stable; fn convert(cx: &mut AcceptContext<'_, '_>, args: &ArgParser) -> Option { let single = cx.expect_single_element_list(args, cx.attr_span)?; diff --git a/compiler/rustc_feature/src/accepted.rs b/compiler/rustc_feature/src/accepted.rs index 9f42c5c1e7f0b..0babbddcff557 100644 --- a/compiler/rustc_feature/src/accepted.rs +++ b/compiler/rustc_feature/src/accepted.rs @@ -342,6 +342,8 @@ declare_features! ( (accepted, non_modrs_mods, "1.30.0", Some(44660)), /// Allows using multiple nested field accesses in offset_of! (accepted, offset_of_nested, "1.82.0", Some(120140)), + /// Allows using `#[optimize(X)]`. + (accepted, optimize_attribute, "CURRENT_RUSTC_VERSION", Some(54882)), /// Allows the use of or-patterns (e.g., `0 | 1`). (accepted, or_patterns, "1.53.0", Some(54883)), /// Allows using `+bundle,+whole-archive` link modifiers with native libs. diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index c7e9a939f2ba1..1e36a5e3af286 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -157,6 +157,7 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[ sym::force_target_feature, sym::sanitize, sym::coverage, + sym::optimize, sym::doc, @@ -180,8 +181,6 @@ pub static BUILTIN_ATTRIBUTES: &[Symbol] = &[ sym::marker, sym::thread_local, sym::no_core, - // RFC 2412 - sym::optimize, sym::ffi_pure, sym::ffi_const, diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 6505cca2473f8..95d0e96b8155a 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -690,8 +690,6 @@ declare_features! ( (unstable, offset_of_enum, "1.75.0", Some(120141)), /// Allows using fields with slice type in offset_of! (unstable, offset_of_slice, "1.81.0", Some(126151)), - /// Allows using `#[optimize(X)]`. - (unstable, optimize_attribute, "1.34.0", Some(54882)), /// Allows specifying nop padding on functions for dynamic patching. (unstable, patchable_function_entry, "1.81.0", Some(123115)), /// Experimental features that make `Pin` more ergonomic. diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 75cd7397e8c5d..bafeefaa48d9a 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -209,7 +209,6 @@ #![feature(multiple_supertrait_upcastable)] #![feature(negative_impls)] #![feature(never_type)] -#![feature(optimize_attribute)] #![feature(rustc_attrs)] #![feature(slice_internals)] #![feature(staged_api)] diff --git a/library/alloctests/lib.rs b/library/alloctests/lib.rs index 83b017b7625b9..a5529f1d9924a 100644 --- a/library/alloctests/lib.rs +++ b/library/alloctests/lib.rs @@ -63,7 +63,6 @@ #![feature(dropck_eyepatch)] #![feature(min_specialization)] #![feature(never_type)] -#![feature(optimize_attribute)] #![feature(prelude_import)] #![feature(rustc_attrs)] #![feature(staged_api)] diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 6e670375fcc5e..2dd0286b2947c 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -147,7 +147,6 @@ #![feature(negative_impls)] #![feature(never_type)] #![feature(no_core)] -#![feature(optimize_attribute)] #![feature(pattern_types)] #![feature(pin_macro_internals)] #![feature(prelude_import)] diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index e1061af1e7d6d..b8f64069e0a9d 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -303,7 +303,6 @@ #![feature(needs_panic_runtime)] #![feature(negative_impls)] #![feature(never_type)] -#![feature(optimize_attribute)] #![feature(prelude_import)] #![feature(rustc_attrs)] #![feature(rustdoc_internals)] diff --git a/tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs b/tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs index 57c9e47a4992a..1dd4ee585d6e1 100644 --- a/tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs +++ b/tests/codegen-llvm/issues/issue-136329-optnone-noinline.rs @@ -2,8 +2,6 @@ //@ compile-flags: -Copt-level=3 -#![feature(optimize_attribute)] - #[optimize(none)] pub fn foo() { let _x = 123; diff --git a/tests/codegen-llvm/optimize-attr-1.rs b/tests/codegen-llvm/optimize-attr-1.rs index db6bdcf9a8b90..c4cb8e460476f 100644 --- a/tests/codegen-llvm/optimize-attr-1.rs +++ b/tests/codegen-llvm/optimize-attr-1.rs @@ -3,7 +3,6 @@ //@[SIZE-OPT] compile-flags: -Copt-level=s -Ccodegen-units=1 //@[SPEED-OPT] compile-flags: -Copt-level=3 -Ccodegen-units=1 -#![feature(optimize_attribute)] #![crate_type = "rlib"] // CHECK-LABEL: define{{.*}}i32 @nothing diff --git a/tests/mir-opt/optimize_none.rs b/tests/mir-opt/optimize_none.rs index 99efcc35e5955..912257a5273b1 100644 --- a/tests/mir-opt/optimize_none.rs +++ b/tests/mir-opt/optimize_none.rs @@ -2,8 +2,6 @@ //@[NO-OPT] compile-flags: -Copt-level=0 //@[SPEED-OPT] compile-flags: -Copt-level=3 -Coverflow-checks=y -#![feature(optimize_attribute)] - #[optimize(none)] pub fn add_noopt() -> i32 { // CHECK-LABEL: fn add_noopt( diff --git a/tests/rustdoc-json/attrs/optimize.rs b/tests/rustdoc-json/attrs/optimize.rs index 5988120ab2f75..eac9aef5912d9 100644 --- a/tests/rustdoc-json/attrs/optimize.rs +++ b/tests/rustdoc-json/attrs/optimize.rs @@ -1,5 +1,3 @@ -#![feature(optimize_attribute)] - //@ is "$.index[?(@.name=='speed')].attrs" '[{"other": "#[attr = Optimize(Speed)]"}]' #[optimize(speed)] pub fn speed() {} diff --git a/tests/ui/attributes/args-checked.rs b/tests/ui/attributes/args-checked.rs index 18369acfea034..b9c6769449577 100644 --- a/tests/ui/attributes/args-checked.rs +++ b/tests/ui/attributes/args-checked.rs @@ -1,5 +1,4 @@ #![feature(rustc_attrs)] -#![feature(optimize_attribute)] #![feature(coverage_attribute)] #![feature(custom_test_frameworks)] #![allow(unused_attributes)] diff --git a/tests/ui/attributes/args-checked.stderr b/tests/ui/attributes/args-checked.stderr index 54f7b71ab128c..a5e0176ed37a2 100644 --- a/tests/ui/attributes/args-checked.stderr +++ b/tests/ui/attributes/args-checked.stderr @@ -1,5 +1,5 @@ error[E0565]: malformed `test_runner` attribute input - --> $DIR/args-checked.rs:7:4 + --> $DIR/args-checked.rs:6:4 | LL | #![test_runner(x = 5)] | ^^^^^^^^^^^^-----^ @@ -13,7 +13,7 @@ LL + #![test_runner(path)] | error[E0565]: malformed `test_runner` attribute input - --> $DIR/args-checked.rs:9:4 + --> $DIR/args-checked.rs:8:4 | LL | #![test_runner(x(x,y,z))] | ^^^^^^^^^^^^--------^ @@ -27,7 +27,7 @@ LL + #![test_runner(path)] | error[E0539]: malformed `inline` attribute input - --> $DIR/args-checked.rs:12:3 + --> $DIR/args-checked.rs:11:3 | LL | #[inline(always = 5)] | ^^^^^^^----------^ @@ -48,7 +48,7 @@ LL + #[inline(never)] | error[E0539]: malformed `inline` attribute input - --> $DIR/args-checked.rs:14:3 + --> $DIR/args-checked.rs:13:3 | LL | #[inline(always(x, y, z))] | ^^^^^^^---------------^ @@ -69,7 +69,7 @@ LL + #[inline(never)] | error[E0539]: malformed `instruction_set` attribute input - --> $DIR/args-checked.rs:16:3 + --> $DIR/args-checked.rs:15:3 | LL | #[instruction_set(arm::a32 = 5)] | ^^^^^^^^^^^^^^^^------------^ @@ -84,7 +84,7 @@ LL + #[instruction_set(set)] | error[E0539]: malformed `instruction_set` attribute input - --> $DIR/args-checked.rs:18:3 + --> $DIR/args-checked.rs:17:3 | LL | #[instruction_set(arm::a32(x, y, z))] | ^^^^^^^^^^^^^^^^-----------------^ @@ -99,7 +99,7 @@ LL + #[instruction_set(set)] | error[E0539]: malformed `optimize` attribute input - --> $DIR/args-checked.rs:20:3 + --> $DIR/args-checked.rs:19:3 | LL | #[optimize(size = 5)] | ^^^^^^^^^--------^ @@ -119,7 +119,7 @@ LL + #[optimize(speed)] | error[E0539]: malformed `optimize` attribute input - --> $DIR/args-checked.rs:22:3 + --> $DIR/args-checked.rs:21:3 | LL | #[optimize(size(x, y, z))] | ^^^^^^^^^-------------^ @@ -139,19 +139,19 @@ LL + #[optimize(speed)] | error: multiple `optimize` attributes - --> $DIR/args-checked.rs:22:1 + --> $DIR/args-checked.rs:21:1 | LL | #[optimize(size(x, y, z))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/args-checked.rs:20:1 + --> $DIR/args-checked.rs:19:1 | LL | #[optimize(size = 5)] | ^^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `coverage` attribute input - --> $DIR/args-checked.rs:25:3 + --> $DIR/args-checked.rs:24:3 | LL | #[coverage(off = 5)] | ^^^^^^^^^-------^ @@ -168,7 +168,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `coverage` attribute input - --> $DIR/args-checked.rs:27:3 + --> $DIR/args-checked.rs:26:3 | LL | #[coverage(off(x, y, z))] | ^^^^^^^^^------------^ @@ -185,7 +185,7 @@ LL + #[coverage(on)] | error[E0539]: malformed `rustc_abi` attribute input - --> $DIR/args-checked.rs:29:3 + --> $DIR/args-checked.rs:28:3 | LL | #[rustc_abi(debug = 5)] | ^^^^^^^^^----------- @@ -202,7 +202,7 @@ LL + #[rustc_abi(debug)] | error[E0539]: malformed `rustc_abi` attribute input - --> $DIR/args-checked.rs:31:3 + --> $DIR/args-checked.rs:30:3 | LL | #[rustc_abi(debug(x, y, z))] | ^^^^^^^^^---------------- @@ -219,19 +219,19 @@ LL + #[rustc_abi(debug)] | error: `rustc_allow_const_fn_unstable` expects feature names - --> $DIR/args-checked.rs:47:33 + --> $DIR/args-checked.rs:46:33 | LL | #[rustc_allow_const_fn_unstable(x = 5)] | ^^^^^ error: `rustc_allow_const_fn_unstable` expects feature names - --> $DIR/args-checked.rs:49:33 + --> $DIR/args-checked.rs:48:33 | LL | #[rustc_allow_const_fn_unstable(x(x, y, z))] | ^^^^^^^^^^ error[E0539]: malformed `used` attribute input - --> $DIR/args-checked.rs:53:3 + --> $DIR/args-checked.rs:52:3 | LL | #[used(always = 5)] | ^^^^^----------^ @@ -251,7 +251,7 @@ LL + #[used(linker)] | error[E0539]: malformed `used` attribute input - --> $DIR/args-checked.rs:55:3 + --> $DIR/args-checked.rs:54:3 | LL | #[used(always(x, y, z))] | ^^^^^---------------^ @@ -271,7 +271,7 @@ LL + #[used(linker)] | error[E0565]: malformed `rustc_must_implement_one_of` attribute input - --> $DIR/args-checked.rs:59:3 + --> $DIR/args-checked.rs:58:3 | LL | #[rustc_must_implement_one_of(eq = 5, neq)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^------^^^^^^ @@ -285,7 +285,7 @@ LL + #[rustc_must_implement_one_of(function1, function2, ...)] | error[E0565]: malformed `rustc_must_implement_one_of` attribute input - --> $DIR/args-checked.rs:61:3 + --> $DIR/args-checked.rs:60:3 | LL | #[rustc_must_implement_one_of(eq(x, y, z), neq)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^ @@ -299,7 +299,7 @@ LL + #[rustc_must_implement_one_of(function1, function2, ...)] | error[E0565]: malformed `rustc_dump_layout` attribute input - --> $DIR/args-checked.rs:67:3 + --> $DIR/args-checked.rs:66:3 | LL | #[rustc_dump_layout(debug = 5)] | ^^^^^^^^^^^^^^^^^^---------^ @@ -307,7 +307,7 @@ LL | #[rustc_dump_layout(debug = 5)] | didn't expect a literal here error[E0565]: malformed `rustc_dump_layout` attribute input - --> $DIR/args-checked.rs:69:3 + --> $DIR/args-checked.rs:68:3 | LL | #[rustc_dump_layout(debug(x, y, z))] | ^^^^^^^^^^^^^^^^^^--------------^ @@ -315,7 +315,7 @@ LL | #[rustc_dump_layout(debug(x, y, z))] | didn't expect a literal here error: valid forms for the attribute are `macro_export` and `macro_export(local_inner_macros)` - --> $DIR/args-checked.rs:37:3 + --> $DIR/args-checked.rs:36:3 | LL | #[macro_export(local_inner_macros = 5)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -325,7 +325,7 @@ LL | #[macro_export(local_inner_macros = 5)] = note: `#[deny(invalid_macro_export_arguments)]` (part of `#[deny(future_incompatible)]`) on by default error: valid forms for the attribute are `macro_export` and `macro_export(local_inner_macros)` - --> $DIR/args-checked.rs:40:3 + --> $DIR/args-checked.rs:39:3 | LL | #[macro_export(local_inner_macros(x, y, z))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -339,7 +339,7 @@ Some errors have detailed explanations: E0539, E0565. For more information about an error, try `rustc --explain E0539`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `macro_export` and `macro_export(local_inner_macros)` - --> $DIR/args-checked.rs:37:3 + --> $DIR/args-checked.rs:36:3 | LL | #[macro_export(local_inner_macros = 5)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -350,7 +350,7 @@ LL | #[macro_export(local_inner_macros = 5)] Future breakage diagnostic: error: valid forms for the attribute are `macro_export` and `macro_export(local_inner_macros)` - --> $DIR/args-checked.rs:40:3 + --> $DIR/args-checked.rs:39:3 | LL | #[macro_export(local_inner_macros(x, y, z))] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index 332ed63aadbee..fc82e3b79e3a7 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -5,7 +5,6 @@ #![feature(allow_internal_unstable)] // FIXME(#82232, #143834): temporarily renamed to mitigate `#[align]` nameres ambiguity #![feature(fn_align)] -#![feature(optimize_attribute)] #![feature(dropck_eyepatch)] #![feature(export_stable)] #![allow(incomplete_features)] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 5b8c823581f1a..1bfead867394b 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,5 +1,5 @@ error[E0539]: malformed `cfg` attribute input - --> $DIR/malformed-attrs.rs:109:3 + --> $DIR/malformed-attrs.rs:108:3 | LL | #[cfg] | ^^^ expected this to be a list @@ -11,7 +11,7 @@ LL | #[cfg(predicate)] | +++++++++++ error[E0539]: malformed `cfg_attr` attribute input - --> $DIR/malformed-attrs.rs:111:3 + --> $DIR/malformed-attrs.rs:110:3 | LL | #[cfg_attr] | ^^^^^^^^ expected this to be a list @@ -23,13 +23,13 @@ LL | #[cfg_attr(predicate, attr1, attr2, ...)] | ++++++++++++++++++++++++++++++ error[E0463]: can't find crate for `wloop` - --> $DIR/malformed-attrs.rs:213:1 + --> $DIR/malformed-attrs.rs:212:1 | LL | extern crate wloop; | ^^^^^^^^^^^^^^^^^^^ can't find crate error: malformed `allow` attribute input - --> $DIR/malformed-attrs.rs:179:1 + --> $DIR/malformed-attrs.rs:178:1 | LL | #[allow] | ^^^^^^^^ @@ -45,7 +45,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `expect` attribute input - --> $DIR/malformed-attrs.rs:181:1 + --> $DIR/malformed-attrs.rs:180:1 | LL | #[expect] | ^^^^^^^^^ @@ -61,7 +61,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `warn` attribute input - --> $DIR/malformed-attrs.rs:183:1 + --> $DIR/malformed-attrs.rs:182:1 | LL | #[warn] | ^^^^^^^ @@ -77,7 +77,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `deny` attribute input - --> $DIR/malformed-attrs.rs:185:1 + --> $DIR/malformed-attrs.rs:184:1 | LL | #[deny] | ^^^^^^^ @@ -93,7 +93,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: malformed `forbid` attribute input - --> $DIR/malformed-attrs.rs:187:1 + --> $DIR/malformed-attrs.rs:186:1 | LL | #[forbid] | ^^^^^^^^^ @@ -109,25 +109,25 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")] | +++++++++++++++++++++++++++++++++++++ error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:106:1 + --> $DIR/malformed-attrs.rs:105:1 | LL | #[proc_macro = 18] | ^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:123:1 + --> $DIR/malformed-attrs.rs:122:1 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type - --> $DIR/malformed-attrs.rs:130:1 + --> $DIR/malformed-attrs.rs:129:1 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `windows_subsystem` attribute input - --> $DIR/malformed-attrs.rs:26:4 + --> $DIR/malformed-attrs.rs:25:4 | LL | #![windows_subsystem] | ^^^^^^^^^^^^^^^^^ expected this to be of the form `windows_subsystem = "..."` @@ -141,7 +141,7 @@ LL | #![windows_subsystem = "windows"] | +++++++++++ error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:29:3 + --> $DIR/malformed-attrs.rs:28:3 | LL | #[unsafe(export_name)] | ^^^^^^^^^^^^^^^^^^^ @@ -152,19 +152,19 @@ LL | #[unsafe(export_name = "name")] | ++++++++ error: `rustc_allow_const_fn_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:31:1 + --> $DIR/malformed-attrs.rs:30:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `allow_internal_unstable` expects a list of feature names - --> $DIR/malformed-attrs.rs:34:1 + --> $DIR/malformed-attrs.rs:33:1 | LL | #[allow_internal_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0539]: malformed `rustc_confusables` attribute input - --> $DIR/malformed-attrs.rs:36:3 + --> $DIR/malformed-attrs.rs:35:3 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^ expected this to be a list @@ -175,7 +175,7 @@ LL | #[rustc_confusables("name1", "name2", ...)] | +++++++++++++++++++++++ error: the `rustc_confusables` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:36:3 + --> $DIR/malformed-attrs.rs:35:3 | LL | #[rustc_confusables] | ^^^^^^^^^^^^^^^^^ @@ -183,7 +183,7 @@ LL | #[rustc_confusables] = help: the `rustc_confusables` attribute can only be applied to inherent methods error[E0539]: malformed `deprecated` attribute input - --> $DIR/malformed-attrs.rs:39:3 + --> $DIR/malformed-attrs.rs:38:3 | LL | #[deprecated = 5] | ^^^^^^^^^^^^^- @@ -191,7 +191,7 @@ LL | #[deprecated = 5] | expected a string literal here error[E0539]: malformed `rustc_macro_transparency` attribute input - --> $DIR/malformed-attrs.rs:43:3 + --> $DIR/malformed-attrs.rs:42:3 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -206,7 +206,7 @@ LL | #[rustc_macro_transparency = "transparent"] | +++++++++++++++ error: the `rustc_macro_transparency` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:43:3 + --> $DIR/malformed-attrs.rs:42:3 | LL | #[rustc_macro_transparency] | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -214,7 +214,7 @@ LL | #[rustc_macro_transparency] = help: the `rustc_macro_transparency` attribute can only be applied to macro defs error[E0539]: malformed `repr` attribute input - --> $DIR/malformed-attrs.rs:46:3 + --> $DIR/malformed-attrs.rs:45:3 | LL | #[repr] | ^^^^ expected this to be a list @@ -222,7 +222,7 @@ LL | #[repr] = note: for more information, visit error[E0565]: malformed `rustc_as_ptr` attribute input - --> $DIR/malformed-attrs.rs:48:3 + --> $DIR/malformed-attrs.rs:47:3 | LL | #[rustc_as_ptr = 5] | ^^^^^^^^^^^^^--- @@ -236,7 +236,7 @@ LL + #[rustc_as_ptr] | error[E0539]: malformed `rustc_align` attribute input - --> $DIR/malformed-attrs.rs:53:3 + --> $DIR/malformed-attrs.rs:52:3 | LL | #[rustc_align] | ^^^^^^^^^^^ expected this to be a list @@ -247,7 +247,7 @@ LL | #[rustc_align()] | ++++++++++++++++++++++ error[E0539]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:55:3 + --> $DIR/malformed-attrs.rs:54:3 | LL | #[optimize] | ^^^^^^^^ expected this to be a list @@ -262,7 +262,7 @@ LL | #[optimize(speed)] | +++++++ error[E0805]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:57:3 + --> $DIR/malformed-attrs.rs:56:3 | LL | #[optimize(none, none)] | ^^^^^^^^------------ @@ -282,7 +282,7 @@ LL + #[optimize(speed)] | error[E0805]: malformed `optimize` attribute input - --> $DIR/malformed-attrs.rs:59:3 + --> $DIR/malformed-attrs.rs:58:3 | LL | #[optimize(none, speed)] | ^^^^^^^^------------- @@ -302,7 +302,7 @@ LL + #[optimize(speed)] | error[E0565]: malformed `cold` attribute input - --> $DIR/malformed-attrs.rs:61:3 + --> $DIR/malformed-attrs.rs:60:3 | LL | #[cold = 1] | ^^^^^--- @@ -316,7 +316,7 @@ LL + #[cold] | error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:63:3 + --> $DIR/malformed-attrs.rs:62:3 | LL | #[must_use()] | ^^^^^^^^-- @@ -334,7 +334,7 @@ LL + #[must_use = "reason"] | error[E0565]: malformed `no_mangle` attribute input - --> $DIR/malformed-attrs.rs:65:3 + --> $DIR/malformed-attrs.rs:64:3 | LL | #[no_mangle = 1] | ^^^^^^^^^^--- @@ -348,7 +348,7 @@ LL + #[no_mangle] | error[E0565]: malformed `naked` attribute input - --> $DIR/malformed-attrs.rs:67:3 + --> $DIR/malformed-attrs.rs:66:3 | LL | #[unsafe(naked())] | ^^^^^^^^^^^^--^ @@ -362,7 +362,7 @@ LL + #[unsafe(naked)] | error[E0565]: malformed `track_caller` attribute input - --> $DIR/malformed-attrs.rs:69:3 + --> $DIR/malformed-attrs.rs:68:3 | LL | #[track_caller()] | ^^^^^^^^^^^^-- @@ -376,7 +376,7 @@ LL + #[track_caller] | error[E0539]: malformed `export_name` attribute input - --> $DIR/malformed-attrs.rs:71:3 + --> $DIR/malformed-attrs.rs:70:3 | LL | #[export_name()] | ^^^^^^^^^^^^^ @@ -388,7 +388,7 @@ LL + #[export_name = "name"] | error[E0805]: malformed `used` attribute input - --> $DIR/malformed-attrs.rs:73:3 + --> $DIR/malformed-attrs.rs:72:3 | LL | #[used()] | ^^^^-- @@ -406,7 +406,7 @@ LL | #[used(linker)] | ++++++ error: the `used` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:73:3 + --> $DIR/malformed-attrs.rs:72:3 | LL | #[used()] | ^^^^ @@ -414,7 +414,7 @@ LL | #[used()] = help: the `used` attribute can only be applied to statics error[E0539]: malformed `crate_name` attribute input - --> $DIR/malformed-attrs.rs:76:3 + --> $DIR/malformed-attrs.rs:75:3 | LL | #[crate_name] | ^^^^^^^^^^ @@ -425,7 +425,7 @@ LL | #[crate_name = "name"] | ++++++++ error[E0539]: malformed `target_feature` attribute input - --> $DIR/malformed-attrs.rs:81:3 + --> $DIR/malformed-attrs.rs:80:3 | LL | #[target_feature] | ^^^^^^^^^^^^^^ expected this to be a list @@ -436,7 +436,7 @@ LL | #[target_feature(enable = "feat1, feat2")] | +++++++++++++++++++++++++ error[E0565]: malformed `export_stable` attribute input - --> $DIR/malformed-attrs.rs:83:3 + --> $DIR/malformed-attrs.rs:82:3 | LL | #[export_stable = 1] | ^^^^^^^^^^^^^^--- @@ -450,7 +450,7 @@ LL + #[export_stable] | error[E0539]: malformed `link` attribute input - --> $DIR/malformed-attrs.rs:85:3 + --> $DIR/malformed-attrs.rs:84:3 | LL | #[link] | ^^^^ expected this to be a list @@ -458,7 +458,7 @@ LL | #[link] = note: for more information, visit error[E0539]: malformed `link_name` attribute input - --> $DIR/malformed-attrs.rs:89:3 + --> $DIR/malformed-attrs.rs:88:3 | LL | #[link_name] | ^^^^^^^^^ @@ -470,7 +470,7 @@ LL | #[link_name = "name"] | ++++++++ error[E0539]: malformed `link_section` attribute input - --> $DIR/malformed-attrs.rs:93:3 + --> $DIR/malformed-attrs.rs:92:3 | LL | #[link_section] | ^^^^^^^^^^^^ @@ -482,7 +482,7 @@ LL | #[link_section = "name"] | ++++++++ error[E0539]: malformed `coverage` attribute input - --> $DIR/malformed-attrs.rs:95:3 + --> $DIR/malformed-attrs.rs:94:3 | LL | #[coverage] | ^^^^^^^^ expected this to be a list @@ -495,13 +495,13 @@ LL | #[coverage(on)] | ++++ error[E0539]: malformed `sanitize` attribute input - --> $DIR/malformed-attrs.rs:97:3 + --> $DIR/malformed-attrs.rs:96:3 | LL | #[sanitize] | ^^^^^^^^ expected this to be a list error[E0565]: malformed `no_implicit_prelude` attribute input - --> $DIR/malformed-attrs.rs:102:3 + --> $DIR/malformed-attrs.rs:101:3 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^^---- @@ -515,7 +515,7 @@ LL + #[no_implicit_prelude] | error[E0565]: malformed `proc_macro` attribute input - --> $DIR/malformed-attrs.rs:106:3 + --> $DIR/malformed-attrs.rs:105:3 | LL | #[proc_macro = 18] | ^^^^^^^^^^^---- @@ -529,7 +529,7 @@ LL + #[proc_macro] | error[E0539]: malformed `instruction_set` attribute input - --> $DIR/malformed-attrs.rs:113:3 + --> $DIR/malformed-attrs.rs:112:3 | LL | #[instruction_set] | ^^^^^^^^^^^^^^^ expected this to be a list @@ -541,7 +541,7 @@ LL | #[instruction_set(set)] | +++++ error[E0539]: malformed `patchable_function_entry` attribute input - --> $DIR/malformed-attrs.rs:115:3 + --> $DIR/malformed-attrs.rs:114:3 | LL | #[patchable_function_entry] | ^^^^^^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -552,7 +552,7 @@ LL | #[patchable_function_entry(prefix_nops = m, entry_nops = n, section = "sect | ++++++++++++++++++++++++++++++++++++++++++++++++++++++ error[E0565]: malformed `coroutine` attribute input - --> $DIR/malformed-attrs.rs:118:7 + --> $DIR/malformed-attrs.rs:117:7 | LL | #[coroutine = 63] || {} | ^^^^^^^^^^---- @@ -566,7 +566,7 @@ LL + #[coroutine] || {} | error[E0565]: malformed `proc_macro_attribute` attribute input - --> $DIR/malformed-attrs.rs:123:3 + --> $DIR/malformed-attrs.rs:122:3 | LL | #[proc_macro_attribute = 19] | ^^^^^^^^^^^^^^^^^^^^^---- @@ -580,7 +580,7 @@ LL + #[proc_macro_attribute] | error[E0539]: malformed `must_use` attribute input - --> $DIR/malformed-attrs.rs:126:3 + --> $DIR/malformed-attrs.rs:125:3 | LL | #[must_use = 1] | ^^^^^^^^^^^- @@ -598,7 +598,7 @@ LL + #[must_use = "reason"] | error[E0539]: malformed `proc_macro_derive` attribute input - --> $DIR/malformed-attrs.rs:130:3 + --> $DIR/malformed-attrs.rs:129:3 | LL | #[proc_macro_derive] | ^^^^^^^^^^^^^^^^^ expected this to be a list @@ -612,7 +612,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))] | ++++++++++++++++++++++++++++++++++++++++++ error[E0539]: malformed `must_not_suspend` attribute input - --> $DIR/malformed-attrs.rs:135:3 + --> $DIR/malformed-attrs.rs:134:3 | LL | #[must_not_suspend()] | ^^^^^^^^^^^^^^^^-- @@ -628,7 +628,7 @@ LL | #[must_not_suspend(count)] | +++++ error[E0539]: malformed `cfi_encoding` attribute input - --> $DIR/malformed-attrs.rs:137:3 + --> $DIR/malformed-attrs.rs:136:3 | LL | #[cfi_encoding = ""] | ^^^^^^^^^^^^^^^-- @@ -641,7 +641,7 @@ LL | #[cfi_encoding = "encoding"] | ++++++++ error[E0565]: malformed `marker` attribute input - --> $DIR/malformed-attrs.rs:156:3 + --> $DIR/malformed-attrs.rs:155:3 | LL | #[marker = 3] | ^^^^^^^--- @@ -655,7 +655,7 @@ LL + #[marker] | error[E0565]: malformed `fundamental` attribute input - --> $DIR/malformed-attrs.rs:158:3 + --> $DIR/malformed-attrs.rs:157:3 | LL | #[fundamental()] | ^^^^^^^^^^^-- @@ -669,7 +669,7 @@ LL + #[fundamental] | error[E0565]: malformed `ffi_pure` attribute input - --> $DIR/malformed-attrs.rs:166:7 + --> $DIR/malformed-attrs.rs:165:7 | LL | #[unsafe(ffi_pure = 1)] | ^^^^^^^^^^^^^^^^---^ @@ -683,7 +683,7 @@ LL + #[unsafe(ffi_pure)] | error[E0539]: malformed `link_ordinal` attribute input - --> $DIR/malformed-attrs.rs:168:7 + --> $DIR/malformed-attrs.rs:167:7 | LL | #[link_ordinal] | ^^^^^^^^^^^^ expected this to be a list @@ -695,7 +695,7 @@ LL | #[link_ordinal(ordinal)] | +++++++++ error[E0565]: malformed `ffi_const` attribute input - --> $DIR/malformed-attrs.rs:172:7 + --> $DIR/malformed-attrs.rs:171:7 | LL | #[unsafe(ffi_const = 1)] | ^^^^^^^^^^^^^^^^^---^ @@ -709,13 +709,13 @@ LL + #[unsafe(ffi_const)] | error[E0539]: malformed `linkage` attribute input - --> $DIR/malformed-attrs.rs:174:7 + --> $DIR/malformed-attrs.rs:173:7 | LL | #[linkage] | ^^^^^^^ expected this to be of the form `linkage = "..."` error[E0539]: malformed `debugger_visualizer` attribute input - --> $DIR/malformed-attrs.rs:189:3 + --> $DIR/malformed-attrs.rs:188:3 | LL | #[debugger_visualizer] | ^^^^^^^^^^^^^^^^^^^ expected this to be a list @@ -727,7 +727,7 @@ LL | #[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")] | ++++++++++++++++++++++++++++++++++++++++++++++ error[E0565]: malformed `automatically_derived` attribute input - --> $DIR/malformed-attrs.rs:191:3 + --> $DIR/malformed-attrs.rs:190:3 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^^---- @@ -741,7 +741,7 @@ LL + #[automatically_derived] | error[E0565]: malformed `non_exhaustive` attribute input - --> $DIR/malformed-attrs.rs:199:3 + --> $DIR/malformed-attrs.rs:198:3 | LL | #[non_exhaustive = 1] | ^^^^^^^^^^^^^^^--- @@ -755,7 +755,7 @@ LL + #[non_exhaustive] | error[E0565]: malformed `thread_local` attribute input - --> $DIR/malformed-attrs.rs:205:3 + --> $DIR/malformed-attrs.rs:204:3 | LL | #[thread_local()] | ^^^^^^^^^^^^-- @@ -769,7 +769,7 @@ LL + #[thread_local] | error[E0565]: malformed `no_link` attribute input - --> $DIR/malformed-attrs.rs:209:3 + --> $DIR/malformed-attrs.rs:208:3 | LL | #[no_link()] | ^^^^^^^-- @@ -783,7 +783,7 @@ LL + #[no_link] | error[E0539]: malformed `macro_use` attribute input - --> $DIR/malformed-attrs.rs:211:3 + --> $DIR/malformed-attrs.rs:210:3 | LL | #[macro_use = 1] | ^^^^^^^^^^--- @@ -801,7 +801,7 @@ LL + #[macro_use(name1, name2, ...)] | error[E0539]: malformed `macro_export` attribute input - --> $DIR/malformed-attrs.rs:216:3 + --> $DIR/malformed-attrs.rs:215:3 | LL | #[macro_export = 18] | ^^^^^^^^^^^^^---- @@ -818,7 +818,7 @@ LL + #[macro_export(local_inner_macros)] | error[E0658]: the `allow_internal_unsafe` attribute side-steps the `unsafe_code` lint - --> $DIR/malformed-attrs.rs:218:3 + --> $DIR/malformed-attrs.rs:217:3 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^ @@ -827,7 +827,7 @@ LL | #[allow_internal_unsafe = 1] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0565]: malformed `allow_internal_unsafe` attribute input - --> $DIR/malformed-attrs.rs:218:3 + --> $DIR/malformed-attrs.rs:217:3 | LL | #[allow_internal_unsafe = 1] | ^^^^^^^^^^^^^^^^^^^^^^--- @@ -841,7 +841,7 @@ LL + #[allow_internal_unsafe] | error: attribute should be applied to `const fn` - --> $DIR/malformed-attrs.rs:31:1 + --> $DIR/malformed-attrs.rs:30:1 | LL | #[rustc_allow_const_fn_unstable] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -853,7 +853,7 @@ LL | | } | |_- not a `const fn` error: valid forms for the attribute are `doc = "string"`, `doc(alias)`, `doc(attribute)`, `doc(auto_cfg)`, `doc(cfg)`, `doc(fake_variadic)`, `doc(hidden)`, `doc(html_favicon_url)`, `doc(html_logo_url)`, `doc(html_no_source)`, `doc(html_playground_url)`, `doc(html_root_url)`, `doc(include)`, `doc(inline)`, `doc(issue_tracker_base_url)`, `doc(keyword)`, `doc(masked)`, `doc(no_default_passes)`, `doc(no_inline)`, `doc(notable_trait)`, `doc(passes)`, `doc(plugins)`, `doc(rust_logo)`, `doc(search_unbox)`, `doc(spotlight)`, and `doc(test)` - --> $DIR/malformed-attrs.rs:41:3 + --> $DIR/malformed-attrs.rs:40:3 | LL | #[doc] | ^^^ @@ -865,7 +865,7 @@ LL | #![deny(invalid_doc_attributes)] | ^^^^^^^^^^^^^^^^^^^^^^ error: valid forms for the attribute are `inline`, `inline(always)`, and `inline(never)` - --> $DIR/malformed-attrs.rs:50:3 + --> $DIR/malformed-attrs.rs:49:3 | LL | #[inline = 5] | ^^^^^^^^^^ @@ -875,13 +875,13 @@ LL | #[inline = 5] = note: `#[deny(ill_formed_attribute_input)]` (part of `#[deny(future_incompatible)]`) on by default warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![crate_name]` - --> $DIR/malformed-attrs.rs:76:1 + --> $DIR/malformed-attrs.rs:75:1 | LL | #[crate_name] | ^^^^^^^^^^^^^ | note: this attribute does not have an `!`, which means it is applied to this function - --> $DIR/malformed-attrs.rs:117:1 + --> $DIR/malformed-attrs.rs:116:1 | LL | / fn test() { LL | | #[coroutine = 63] || {} @@ -891,13 +891,13 @@ LL | | } = note: requested on the command line with `-W unused-attributes` error: valid forms for the attribute are `doc = "string"`, `doc(alias)`, `doc(attribute)`, `doc(auto_cfg)`, `doc(cfg)`, `doc(fake_variadic)`, `doc(hidden)`, `doc(html_favicon_url)`, `doc(html_logo_url)`, `doc(html_no_source)`, `doc(html_playground_url)`, `doc(html_root_url)`, `doc(include)`, `doc(inline)`, `doc(issue_tracker_base_url)`, `doc(keyword)`, `doc(masked)`, `doc(no_default_passes)`, `doc(no_inline)`, `doc(notable_trait)`, `doc(passes)`, `doc(plugins)`, `doc(rust_logo)`, `doc(search_unbox)`, `doc(spotlight)`, and `doc(test)` - --> $DIR/malformed-attrs.rs:79:3 + --> $DIR/malformed-attrs.rs:78:3 | LL | #[doc] | ^^^ warning: the `link` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:85:3 + --> $DIR/malformed-attrs.rs:84:3 | LL | #[link] | ^^^^ @@ -906,7 +906,7 @@ LL | #[link] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: the `link_name` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:89:3 + --> $DIR/malformed-attrs.rs:88:3 | LL | #[link_name] | ^^^^^^^^^ @@ -915,7 +915,7 @@ LL | #[link_name] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:99:3 + --> $DIR/malformed-attrs.rs:98:3 | LL | #[ignore()] | ^^^^^^^^ @@ -924,7 +924,7 @@ LL | #[ignore()] = note: for more information, see issue #57571 warning: the `no_implicit_prelude` attribute cannot be used on functions - --> $DIR/malformed-attrs.rs:102:3 + --> $DIR/malformed-attrs.rs:101:3 | LL | #[no_implicit_prelude = 23] | ^^^^^^^^^^^^^^^^^^^ @@ -933,7 +933,7 @@ LL | #[no_implicit_prelude = 23] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! warning: missing options for `diagnostic::on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:141:1 + --> $DIR/malformed-attrs.rs:140:1 | LL | #[diagnostic::on_unimplemented] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -942,7 +942,7 @@ LL | #[diagnostic::on_unimplemented] = note: `#[warn(malformed_diagnostic_attributes)]` (part of `#[warn(unknown_or_malformed_diagnostic_attributes)]`) on by default warning: malformed `diagnostic::on_unimplemented` attribute - --> $DIR/malformed-attrs.rs:143:1 + --> $DIR/malformed-attrs.rs:142:1 | LL | #[diagnostic::on_unimplemented = 1] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here @@ -950,13 +950,13 @@ LL | #[diagnostic::on_unimplemented = 1] = help: only `message`, `note` and `label` are allowed as options warning: `#[diagnostic::do_not_recommend]` does not expect any arguments - --> $DIR/malformed-attrs.rs:150:1 + --> $DIR/malformed-attrs.rs:149:1 | LL | #[diagnostic::do_not_recommend()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: the `automatically_derived` attribute cannot be used on modules - --> $DIR/malformed-attrs.rs:191:3 + --> $DIR/malformed-attrs.rs:190:3 | LL | #[automatically_derived = 18] | ^^^^^^^^^^^^^^^^^^^^^ @@ -965,7 +965,7 @@ LL | #[automatically_derived = 18] = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:225:3 + --> $DIR/malformed-attrs.rs:224:3 | LL | #[ignore = 1] | ^^^^^^^^^^ @@ -974,7 +974,7 @@ LL | #[ignore = 1] = note: for more information, see issue #57571 error[E0308]: mismatched types - --> $DIR/malformed-attrs.rs:118:23 + --> $DIR/malformed-attrs.rs:117:23 | LL | fn test() { | - help: a return type might be missing here: `-> _` @@ -982,7 +982,7 @@ LL | #[coroutine = 63] || {} | ^^^^^ expected `()`, found coroutine | = note: expected unit type `()` - found coroutine `{coroutine@$DIR/malformed-attrs.rs:118:23: 118:25}` + found coroutine `{coroutine@$DIR/malformed-attrs.rs:117:23: 117:25}` error: aborting due to 74 previous errors; 8 warnings emitted @@ -990,7 +990,7 @@ Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805 For more information about an error, try `rustc --explain E0308`. Future incompatibility report: Future breakage diagnostic: error: valid forms for the attribute are `inline`, `inline(always)`, and `inline(never)` - --> $DIR/malformed-attrs.rs:50:3 + --> $DIR/malformed-attrs.rs:49:3 | LL | #[inline = 5] | ^^^^^^^^^^ @@ -1001,7 +1001,7 @@ LL | #[inline = 5] Future breakage diagnostic: error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:99:3 + --> $DIR/malformed-attrs.rs:98:3 | LL | #[ignore()] | ^^^^^^^^ @@ -1012,7 +1012,7 @@ LL | #[ignore()] Future breakage diagnostic: error: valid forms for the attribute are `ignore` and `ignore = "reason"` - --> $DIR/malformed-attrs.rs:225:3 + --> $DIR/malformed-attrs.rs:224:3 | LL | #[ignore = 1] | ^^^^^^^^^^ diff --git a/tests/ui/attributes/optimize-smoke-test.rs b/tests/ui/attributes/optimize-smoke-test.rs index 9d8e75c4bec5e..d379450fcaad9 100644 --- a/tests/ui/attributes/optimize-smoke-test.rs +++ b/tests/ui/attributes/optimize-smoke-test.rs @@ -1,8 +1,6 @@ //! Basic smoke test for `#[optimize(..)]` attributes. //@ run-pass -#![feature(optimize_attribute)] - #[optimize(speed)] fn optimized_speed() -> i32 { 42 diff --git a/tests/ui/attributes/optimize.rs b/tests/ui/attributes/optimize.rs index f1e07f35e0971..41c716e0e9854 100644 --- a/tests/ui/attributes/optimize.rs +++ b/tests/ui/attributes/optimize.rs @@ -1,4 +1,3 @@ -#![feature(optimize_attribute)] #![feature(stmt_expr_attributes)] #![deny(unused_attributes)] #![allow(dead_code)] @@ -74,3 +73,11 @@ fn inline_conflict_b() {} #[inline(never)] #[optimize(none)] fn inline_conflict_c() {} + +#[optimize(none)] +fn valid_none() {} + +#[optimize(none)] +async fn async_fn_none() { + () +} diff --git a/tests/ui/attributes/optimize.stderr b/tests/ui/attributes/optimize.stderr index db45f96d143c8..5c9ab33a6e590 100644 --- a/tests/ui/attributes/optimize.stderr +++ b/tests/ui/attributes/optimize.stderr @@ -1,5 +1,5 @@ error: the `optimize` attribute cannot be used on structs - --> $DIR/optimize.rs:8:3 + --> $DIR/optimize.rs:7:3 | LL | #[optimize(speed)] | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | #[optimize(speed)] = help: the `optimize` attribute can only be applied to functions error: the `optimize` attribute cannot be used on expressions - --> $DIR/optimize.rs:12:7 + --> $DIR/optimize.rs:11:7 | LL | #[optimize(speed)] | ^^^^^^^^ @@ -15,7 +15,7 @@ LL | #[optimize(speed)] = help: the `optimize` attribute can only be applied to functions error: the `optimize` attribute cannot be used on modules - --> $DIR/optimize.rs:21:3 + --> $DIR/optimize.rs:20:3 | LL | #[optimize(speed)] | ^^^^^^^^ @@ -23,7 +23,7 @@ LL | #[optimize(speed)] = help: the `optimize` attribute can only be applied to functions error: the `optimize` attribute cannot be used on inherent impl blocks - --> $DIR/optimize.rs:24:3 + --> $DIR/optimize.rs:23:3 | LL | #[optimize(speed)] | ^^^^^^^^ @@ -31,7 +31,7 @@ LL | #[optimize(speed)] = help: the `optimize` attribute can only be applied to functions error: the `optimize` attribute cannot be used on required trait methods - --> $DIR/optimize.rs:45:7 + --> $DIR/optimize.rs:44:7 | LL | #[optimize(speed)] | ^^^^^^^^ @@ -39,31 +39,31 @@ LL | #[optimize(speed)] = help: the `optimize` attribute can only be applied to functions with a body error: multiple `optimize` attributes - --> $DIR/optimize.rs:59:1 + --> $DIR/optimize.rs:58:1 | LL | #[optimize(speed)] | ^^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/optimize.rs:58:1 + --> $DIR/optimize.rs:57:1 | LL | #[optimize(speed)] | ^^^^^^^^^^^^^^^^^^ error: multiple `optimize` attributes - --> $DIR/optimize.rs:63:1 + --> $DIR/optimize.rs:62:1 | LL | #[optimize(size)] | ^^^^^^^^^^^^^^^^^ help: remove this attribute | note: attribute also specified here - --> $DIR/optimize.rs:62:1 + --> $DIR/optimize.rs:61:1 | LL | #[optimize(speed)] | ^^^^^^^^^^^^^^^^^^ error: `#[optimize(none)]` cannot be used with `#[inline]` attributes - --> $DIR/optimize.rs:66:1 + --> $DIR/optimize.rs:65:1 | LL | #[optimize(none)] | ^^^^^^^^^^^^^^^^^ `#[optimize(none)]` here @@ -71,7 +71,7 @@ LL | #[inline] | --------- `#[inline]` here error: `#[optimize(none)]` cannot be used with `#[inline]` attributes - --> $DIR/optimize.rs:71:1 + --> $DIR/optimize.rs:70:1 | LL | #[inline(always)] | ----------------- `#[inline]` here diff --git a/tests/ui/coroutine/other-attribute-on-gen.rs b/tests/ui/coroutine/other-attribute-on-gen.rs index e13a0abcbfd63..8fb428fd81b25 100644 --- a/tests/ui/coroutine/other-attribute-on-gen.rs +++ b/tests/ui/coroutine/other-attribute-on-gen.rs @@ -1,7 +1,6 @@ //@ edition: 2024 //@ run-pass #![feature(gen_blocks)] -#![feature(optimize_attribute)] #![feature(async_iterator)] #![allow(dead_code)] diff --git a/tests/ui/eii/implementation-attribute-allowlist-issue-159015.rs b/tests/ui/eii/implementation-attribute-allowlist-issue-159015.rs index d27ea2a833e0f..e486b8620b777 100644 --- a/tests/ui/eii/implementation-attribute-allowlist-issue-159015.rs +++ b/tests/ui/eii/implementation-attribute-allowlist-issue-159015.rs @@ -6,7 +6,6 @@ #![feature(coverage_attribute)] #![feature(extern_item_impls)] -#![feature(optimize_attribute)] #![feature(sanitize)] #[eii] diff --git a/tests/ui/eii/implementation-attribute-allowlist-issue-159015.stderr b/tests/ui/eii/implementation-attribute-allowlist-issue-159015.stderr index af9673099f20f..bda69efd5630d 100644 --- a/tests/ui/eii/implementation-attribute-allowlist-issue-159015.stderr +++ b/tests/ui/eii/implementation-attribute-allowlist-issue-159015.stderr @@ -1,5 +1,5 @@ error: `#[foo]` is not allowed to have `#[no_mangle]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:46:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:45:1 | LL | #[foo] | ------ `#[foo]` is not allowed to have `#[no_mangle]` @@ -7,7 +7,7 @@ LL | #[unsafe(no_mangle)] | ^^^^^^^^^^^^^^^^^^^^ error: `#[baz]` is not allowed to have `#[export_name]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:54:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:53:1 | LL | #[baz] | ------ `#[baz]` is not allowed to have `#[export_name]` @@ -15,7 +15,7 @@ LL | #[unsafe(export_name = "qux")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[quux]` is not allowed to have `#[link_section]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:62:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:61:1 | LL | #[quux] | ------- `#[quux]` is not allowed to have `#[link_section]` @@ -23,7 +23,7 @@ LL | #[unsafe(link_section = "__TEXT,__text")] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[grault]` is not allowed to have `#[track_caller]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:70:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:69:1 | LL | #[grault] | --------- `#[grault]` is not allowed to have `#[track_caller]` @@ -31,7 +31,7 @@ LL | #[track_caller] | ^^^^^^^^^^^^^^^ error: `#[naked_attr]` is not allowed to have `#[naked]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:78:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:77:1 | LL | #[naked_attr] | ------------- `#[naked_attr]` is not allowed to have `#[naked]` @@ -39,7 +39,7 @@ LL | #[unsafe(naked)] | ^^^^^^^^^^^^^^^^ error: `#[multiple_invalid_attrs]` is not allowed to have `#[no_mangle]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:88:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:87:1 | LL | #[multiple_invalid_attrs] | ------------------------- `#[multiple_invalid_attrs]` is not allowed to have `#[no_mangle]` @@ -47,7 +47,7 @@ LL | #[unsafe(no_mangle)] | ^^^^^^^^^^^^^^^^^^^^ error: `#[multiple_invalid_attrs]` is not allowed to have `#[track_caller]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:90:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:89:1 | LL | #[multiple_invalid_attrs] | ------------------------- `#[multiple_invalid_attrs]` is not allowed to have `#[track_caller]` @@ -56,7 +56,7 @@ LL | #[track_caller] | ^^^^^^^^^^^^^^^ error: `#[static_eii]` is not allowed to have `#[used]` - --> $DIR/implementation-attribute-allowlist-issue-159015.rs:98:1 + --> $DIR/implementation-attribute-allowlist-issue-159015.rs:97:1 | LL | #[static_eii] | ------------- `#[static_eii]` is not allowed to have `#[used]` diff --git a/tests/ui/feature-gates/feature-gate-optimize_attribute.rs b/tests/ui/feature-gates/feature-gate-optimize_attribute.rs deleted file mode 100644 index b1da0dca9c85b..0000000000000 --- a/tests/ui/feature-gates/feature-gate-optimize_attribute.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![crate_type="rlib"] - -#[optimize(size)] //~ ERROR the `optimize` attribute is an experimental feature -fn size() {} - -#[optimize(speed)] //~ ERROR the `optimize` attribute is an experimental feature -fn speed() {} - -#[optimize(none)] //~ ERROR the `optimize` attribute is an experimental feature -fn none() {} - -#[optimize(banana)] -//~^ ERROR the `optimize` attribute is an experimental feature -//~| ERROR malformed `optimize` attribute input [E0539] -fn not_known() {} diff --git a/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr b/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr deleted file mode 100644 index 67f0b832866ca..0000000000000 --- a/tests/ui/feature-gates/feature-gate-optimize_attribute.stderr +++ /dev/null @@ -1,64 +0,0 @@ -error[E0658]: the `optimize` attribute is an experimental feature - --> $DIR/feature-gate-optimize_attribute.rs:3:3 - | -LL | #[optimize(size)] - | ^^^^^^^^ - | - = note: see issue #54882 for more information - = help: add `#![feature(optimize_attribute)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `optimize` attribute is an experimental feature - --> $DIR/feature-gate-optimize_attribute.rs:6:3 - | -LL | #[optimize(speed)] - | ^^^^^^^^ - | - = note: see issue #54882 for more information - = help: add `#![feature(optimize_attribute)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `optimize` attribute is an experimental feature - --> $DIR/feature-gate-optimize_attribute.rs:9:3 - | -LL | #[optimize(none)] - | ^^^^^^^^ - | - = note: see issue #54882 for more information - = help: add `#![feature(optimize_attribute)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0658]: the `optimize` attribute is an experimental feature - --> $DIR/feature-gate-optimize_attribute.rs:12:3 - | -LL | #[optimize(banana)] - | ^^^^^^^^ - | - = note: see issue #54882 for more information - = help: add `#![feature(optimize_attribute)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error[E0539]: malformed `optimize` attribute input - --> $DIR/feature-gate-optimize_attribute.rs:12:3 - | -LL | #[optimize(banana)] - | ^^^^^^^^^------^ - | | - | valid arguments are `size`, `speed` or `none` - | -help: try changing it to one of the following valid forms of the attribute - | -LL - #[optimize(banana)] -LL + #[optimize(none)] - | -LL - #[optimize(banana)] -LL + #[optimize(size)] - | -LL - #[optimize(banana)] -LL + #[optimize(speed)] - | - -error: aborting due to 5 previous errors - -Some errors have detailed explanations: E0539, E0658. -For more information about an error, try `rustc --explain E0539`.