From c1b51dd002ee13514355987ce77fa600584eb3a5 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Wed, 5 Nov 2025 18:49:44 -0800 Subject: [PATCH 01/10] In `Option::get_or_insert_with()`, forget the `None` instead of dropping it. This allows eliminating the `T: [const] Destruct` bounds and avoids generating an implicit `drop_in_place::>()` that will never do anything. Ideally, the compiler would prove that that drop is not necessary itself, but it currently doesn't, even with `const_precise_live_drops` enabled. --- library/core/src/option.rs | 21 ++++++++++++++++++--- library/coretests/tests/option.rs | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/library/core/src/option.rs b/library/core/src/option.rs index e3c4758bc6af5..df92fb3955a97 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -1776,7 +1776,7 @@ impl Option { #[rustc_const_unstable(feature = "const_option_ops", issue = "143956")] pub const fn get_or_insert_default(&mut self) -> &mut T where - T: [const] Default + [const] Destruct, + T: [const] Default, { self.get_or_insert_with(T::default) } @@ -1804,10 +1804,25 @@ impl Option { pub const fn get_or_insert_with(&mut self, f: F) -> &mut T where F: [const] FnOnce() -> T + [const] Destruct, - T: [const] Destruct, { if let None = self { - *self = Some(f()); + // The effect of the following statement is identical to + // *self = Some(f()); + // except that it does not drop the old value of `*self`. This is not a leak, because + // we just checked that the old value is `None`, which contains no fields to drop. + // This implementation strategy + // + // * avoids needing a `T: [const] Destruct` bound, to the benefit of `const` callers, + // * and avoids possibly compiling needless drop code (as would sometimes happen in the + // previous implementation), to the benefit of non-`const` callers. + // + // FIXME(const-hack): It would be nice if this weird trick were made obsolete + // (though that is likely to be hard/wontfix). + // + // It could also be expressed as `unsafe { core::ptr::write(self, Some(f())) }`, but + // no reason is currently known to use additional unsafe code here. + + mem::forget(mem::replace(self, Some(f()))); } // SAFETY: a `None` variant for `self` would have been replaced by a `Some` diff --git a/library/coretests/tests/option.rs b/library/coretests/tests/option.rs index fc0f82ad6bb38..3df7afb4f3bea 100644 --- a/library/coretests/tests/option.rs +++ b/library/coretests/tests/option.rs @@ -495,6 +495,30 @@ const fn option_const_mut() { */ } +/// Test that `Option::get_or_insert_default` is usable in const contexts, including with types that +/// do not satisfy `T: const Destruct`. +#[test] +fn const_get_or_insert_default() { + const OPT_DEFAULT: Option> = { + let mut x = None; + x.get_or_insert_default(); + x + }; + assert!(OPT_DEFAULT.is_some()); +} + +/// Test that `Option::get_or_insert_with` is usable in const contexts, including with types that +/// do not satisfy `T: const Destruct`. +#[test] +fn const_get_or_insert_with() { + const OPT_WITH: Option> = { + let mut x = None; + x.get_or_insert_with(Vec::new); + x + }; + assert!(OPT_WITH.is_some()); +} + #[test] fn test_unwrap_drop() { struct Dtor<'a> { From 438b12617774fa989673968aad51e5eae03d0333 Mon Sep 17 00:00:00 2001 From: binarycat Date: Fri, 12 Dec 2025 14:38:01 -0600 Subject: [PATCH 02/10] rustdoc: don't give depreciation notes special handling --- src/librustdoc/html/markdown.rs | 12 +++++++----- src/librustdoc/html/markdown/tests.rs | 2 +- src/librustdoc/html/static/css/rustdoc.css | 1 - tests/rustdoc-html/deprecated.rs | 5 +++++ 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index c472c20a7dc71..7b3198a194c4f 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -109,13 +109,15 @@ pub(crate) struct MarkdownWithToc<'a> { pub(crate) edition: Edition, pub(crate) playground: &'a Option, } -/// A tuple struct like `Markdown` that renders the markdown escaping HTML tags + +/// A struct like `Markdown` that renders the markdown escaping HTML tags /// and includes no paragraph tags. pub(crate) struct MarkdownItemInfo<'a> { pub(crate) content: &'a str, pub(crate) links: &'a [RenderedLink], pub(crate) ids: &'a mut IdMap, } + /// A tuple struct like `Markdown` that renders only the first paragraph. pub(crate) struct MarkdownSummaryLine<'a>(pub &'a str, pub &'a [RenderedLink]); @@ -1497,10 +1499,10 @@ impl<'a> MarkdownItemInfo<'a> { let p = SpannedLinkReplacer::new(p, links); let p = footnotes::Footnotes::new(p, existing_footnotes); let p = TableWrapper::new(p.map(|(ev, _)| ev)); - let p = p.filter(|event| { - !matches!(event, Event::Start(Tag::Paragraph) | Event::End(TagEnd::Paragraph)) - }); - html::write_html_fmt(&mut f, p) + // in legacy wrap mode, strip

elements to avoid them inserting newlines + html::write_html_fmt(&mut f, p)?; + + Ok(()) }) } } diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs index 1c99ccc5228b1..3655a52deee68 100644 --- a/src/librustdoc/html/markdown/tests.rs +++ b/src/librustdoc/html/markdown/tests.rs @@ -472,7 +472,7 @@ fn test_markdown_html_escape() { let mut idmap = IdMap::new(); let mut output = String::new(); MarkdownItemInfo::new(input, &[], &mut idmap).write_into(&mut output).unwrap(); - assert_eq!(output, expect, "original: {}", input); + assert_eq!(output, format!("

{}

\n", expect), "original: {}", input); } t("`Struct<'a, T>`", "Struct<'a, T>"); diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index b770a0e2a0e41..8410e8c793e1c 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -1585,7 +1585,6 @@ so that we can apply CSS-filters to change the arrow color in themes */ color: var(--main-color); background-color: var(--stab-background-color); width: fit-content; - white-space: pre-wrap; border-radius: 3px; display: inline; vertical-align: baseline; diff --git a/tests/rustdoc-html/deprecated.rs b/tests/rustdoc-html/deprecated.rs index a84657a3df5aa..c7db816cffcfc 100644 --- a/tests/rustdoc-html/deprecated.rs +++ b/tests/rustdoc-html/deprecated.rs @@ -30,3 +30,8 @@ pub struct W; // 'Deprecated: shorthand reason: code$' #[deprecated = "shorthand reason: `code`"] pub struct X; + +//@ matches deprecated/struct.Y.html '//*[@class="stab deprecated"]//p[1]' 'multiple' +//@ matches deprecated/struct.Y.html '//*[@class="stab deprecated"]//p[2]' 'paragraphs' +#[deprecated = "multiple\n\nparagraphs"] +pub struct Y; From 342ad0401a16aebfa2e2160a099764168a4fe2f5 Mon Sep 17 00:00:00 2001 From: David Wood Date: Mon, 9 Mar 2026 12:39:47 +0000 Subject: [PATCH 03/10] ast_passes: unsupported arch w/ scalable vectors Emit an error when attempting to compile a `#[rustc_scalable_vector]` type for a architecture that fundamentally doesn't support scalable vectors. Ultimately this is just a diagnostic improvement for an internal attribute as users should never be doing this. --- .../rustc_ast_passes/src/ast_validation.rs | 15 ++-- compiler/rustc_ast_passes/src/errors.rs | 7 ++ compiler/rustc_target/src/spec/mod.rs | 13 ++++ .../src/directives/directive_names.rs | 1 + .../ui/scalable-vectors/bad-architectures.rs | 13 ++++ .../scalable-vectors/bad-architectures.stderr | 8 ++ tests/ui/scalable-vectors/fn-trait.rs | 1 + tests/ui/scalable-vectors/fn-trait.stderr | 2 +- .../{illegal_init.rs => illegal-init.rs} | 1 + ...llegal_init.stderr => illegal-init.stderr} | 2 +- .../illformed-element-type.rs | 1 + .../illformed-element-type.stderr | 30 +++---- .../illformed-tuples-of-scalable-vectors.rs | 1 + ...llformed-tuples-of-scalable-vectors.stderr | 12 +-- .../illformed-within-types.rs | 1 + .../illformed-within-types.stderr | 10 +-- tests/ui/scalable-vectors/illformed.rs | 1 + tests/ui/scalable-vectors/illformed.stderr | 34 ++++---- tests/ui/scalable-vectors/invalid.rs | 1 + tests/ui/scalable-vectors/invalid.stderr | 78 +++++++++---------- .../ui/scalable-vectors/wellformed-arrays.rs | 1 + tests/ui/scalable-vectors/wellformed.rs | 1 + 22 files changed, 145 insertions(+), 89 deletions(-) create mode 100644 tests/ui/scalable-vectors/bad-architectures.rs create mode 100644 tests/ui/scalable-vectors/bad-architectures.stderr rename tests/ui/scalable-vectors/{illegal_init.rs => illegal-init.rs} (94%) rename tests/ui/scalable-vectors/{illegal_init.stderr => illegal-init.stderr} (87%) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index c8dbba006f6db..2308502df0703 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -1371,11 +1371,16 @@ impl<'a> Visitor<'a> for AstValidator<'a> { ItemKind::Struct(ident, generics, vdata) => { self.with_tilde_const(Some(TildeConstReason::Struct { span: item.span }), |this| { // Scalable vectors can only be tuple structs - let is_scalable_vector = - item.attrs.iter().any(|attr| attr.has_name(sym::rustc_scalable_vector)); - if is_scalable_vector && !matches!(vdata, VariantData::Tuple(..)) { - this.dcx() - .emit_err(errors::ScalableVectorNotTupleStruct { span: item.span }); + let scalable_vector_attr = + item.attrs.iter().find(|attr| attr.has_name(sym::rustc_scalable_vector)); + if let Some(attr) = scalable_vector_attr { + if !matches!(vdata, VariantData::Tuple(..)) { + this.dcx() + .emit_err(errors::ScalableVectorNotTupleStruct { span: item.span }); + } + if !self.sess.target.arch.supports_scalable_vectors() { + this.dcx().emit_err(errors::ScalableVectorBadArch { span: attr.span }); + } } match vdata { diff --git a/compiler/rustc_ast_passes/src/errors.rs b/compiler/rustc_ast_passes/src/errors.rs index edc175b990885..4a39e22ac220d 100644 --- a/compiler/rustc_ast_passes/src/errors.rs +++ b/compiler/rustc_ast_passes/src/errors.rs @@ -1133,3 +1133,10 @@ pub(crate) struct ScalableVectorNotTupleStruct { #[primary_span] pub span: Span, } + +#[derive(Diagnostic)] +#[diag("scalable vectors are not supported on this architecture")] +pub(crate) struct ScalableVectorBadArch { + #[primary_span] + pub span: Span, +} diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index a4460a3725174..77cc6dd1036c8 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -1956,6 +1956,19 @@ impl Arch { | X86_64 | Xtensa => true, } } + + /// Whether `#[rustc_scalable_vector]` is supported for a target architecture + pub fn supports_scalable_vectors(&self) -> bool { + use Arch::*; + + match self { + AArch64 | RiscV32 | RiscV64 => true, + AmdGpu | Arm | Arm64EC | Avr | Bpf | CSky | Hexagon | LoongArch32 | LoongArch64 + | M68k | Mips | Mips32r6 | Mips64 | Mips64r6 | Msp430 | Nvptx64 | PowerPC + | PowerPC64 | S390x | Sparc | Sparc64 | SpirV | Wasm32 | Wasm64 | X86 | X86_64 + | Xtensa | Other(_) => false, + } + } } crate::target_spec_enum! { diff --git a/src/tools/compiletest/src/directives/directive_names.rs b/src/tools/compiletest/src/directives/directive_names.rs index d2a71a42e076d..2fc5c0e8ec1ee 100644 --- a/src/tools/compiletest/src/directives/directive_names.rs +++ b/src/tools/compiletest/src/directives/directive_names.rs @@ -105,6 +105,7 @@ pub(crate) const KNOWN_DIRECTIVE_NAMES: &[&str] = &[ "ignore-powerpc", "ignore-powerpc64", "ignore-remote", + "ignore-riscv32", "ignore-riscv64", "ignore-rustc-debug-assertions", "ignore-rustc_abi-x86-sse2", diff --git a/tests/ui/scalable-vectors/bad-architectures.rs b/tests/ui/scalable-vectors/bad-architectures.rs new file mode 100644 index 0000000000000..3323423316bf6 --- /dev/null +++ b/tests/ui/scalable-vectors/bad-architectures.rs @@ -0,0 +1,13 @@ +//@ ignore-aarch64 +//@ ignore-riscv32 +//@ ignore-riscv64 + +// Confirm that non-AArch64 and non-RISC-V targets error when compiling scalable vectors +// (see #153593) + +#![crate_type = "lib"] +#![feature(rustc_attrs)] + +#[rustc_scalable_vector(4)] +//~^ ERROR: scalable vectors are not supported on this architecture +struct ScalableVec(i32); diff --git a/tests/ui/scalable-vectors/bad-architectures.stderr b/tests/ui/scalable-vectors/bad-architectures.stderr new file mode 100644 index 0000000000000..94308a40e77d9 --- /dev/null +++ b/tests/ui/scalable-vectors/bad-architectures.stderr @@ -0,0 +1,8 @@ +error: scalable vectors are not supported on this architecture + --> $DIR/bad-architectures.rs:11:1 + | +LL | #[rustc_scalable_vector(4)] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/scalable-vectors/fn-trait.rs b/tests/ui/scalable-vectors/fn-trait.rs index 5203b5fa0efd7..47b29202a6716 100644 --- a/tests/ui/scalable-vectors/fn-trait.rs +++ b/tests/ui/scalable-vectors/fn-trait.rs @@ -1,3 +1,4 @@ +//@ only-aarch64 #![allow(internal_features)] #![feature(rustc_attrs)] diff --git a/tests/ui/scalable-vectors/fn-trait.stderr b/tests/ui/scalable-vectors/fn-trait.stderr index 4d00272dd1b5a..8945069b10f8c 100644 --- a/tests/ui/scalable-vectors/fn-trait.stderr +++ b/tests/ui/scalable-vectors/fn-trait.stderr @@ -1,5 +1,5 @@ error: scalable vectors cannot be tuple fields - --> $DIR/fn-trait.rs:9:8 + --> $DIR/fn-trait.rs:10:8 | LL | T: Fn(ScalableSimdFloat), | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/scalable-vectors/illegal_init.rs b/tests/ui/scalable-vectors/illegal-init.rs similarity index 94% rename from tests/ui/scalable-vectors/illegal_init.rs rename to tests/ui/scalable-vectors/illegal-init.rs index e8c0447fea422..c37a10b3f8866 100644 --- a/tests/ui/scalable-vectors/illegal_init.rs +++ b/tests/ui/scalable-vectors/illegal-init.rs @@ -1,3 +1,4 @@ +//@ only-aarch64 #![allow(incomplete_features, internal_features)] #![feature(rustc_attrs)] diff --git a/tests/ui/scalable-vectors/illegal_init.stderr b/tests/ui/scalable-vectors/illegal-init.stderr similarity index 87% rename from tests/ui/scalable-vectors/illegal_init.stderr rename to tests/ui/scalable-vectors/illegal-init.stderr index db0fffcf3b772..0cd99cf52d50f 100644 --- a/tests/ui/scalable-vectors/illegal_init.stderr +++ b/tests/ui/scalable-vectors/illegal-init.stderr @@ -1,5 +1,5 @@ error: scalable vector types cannot be initialised using their constructor - --> $DIR/illegal_init.rs:8:15 + --> $DIR/illegal-init.rs:9:15 | LL | let foo = svint32_t(1); | ^^^^^^^^^ you can create scalable vectors using intrinsics diff --git a/tests/ui/scalable-vectors/illformed-element-type.rs b/tests/ui/scalable-vectors/illformed-element-type.rs index 469ca006f5e9b..8461b0a067ff8 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.rs +++ b/tests/ui/scalable-vectors/illformed-element-type.rs @@ -1,4 +1,5 @@ //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![allow(internal_features)] #![feature(extern_types)] #![feature(never_type)] diff --git a/tests/ui/scalable-vectors/illformed-element-type.stderr b/tests/ui/scalable-vectors/illformed-element-type.stderr index f8ca8b76215f7..52a4346570702 100644 --- a/tests/ui/scalable-vectors/illformed-element-type.stderr +++ b/tests/ui/scalable-vectors/illformed-element-type.stderr @@ -1,5 +1,5 @@ error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:15:1 + --> $DIR/illformed-element-type.rs:16:1 | LL | struct TyChar(char); | ^^^^^^^^^^^^^ @@ -7,7 +7,7 @@ LL | struct TyChar(char); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:19:1 + --> $DIR/illformed-element-type.rs:20:1 | LL | struct TyConstPtr(*const u8); | ^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | struct TyConstPtr(*const u8); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:23:1 + --> $DIR/illformed-element-type.rs:24:1 | LL | struct TyMutPtr(*mut u8); | ^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | struct TyMutPtr(*mut u8); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:27:1 + --> $DIR/illformed-element-type.rs:28:1 | LL | struct TyStruct(Foo); | ^^^^^^^^^^^^^^^ @@ -31,7 +31,7 @@ LL | struct TyStruct(Foo); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:31:1 + --> $DIR/illformed-element-type.rs:32:1 | LL | struct TyEnum(Bar); | ^^^^^^^^^^^^^ @@ -39,7 +39,7 @@ LL | struct TyEnum(Bar); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:35:1 + --> $DIR/illformed-element-type.rs:36:1 | LL | struct TyUnion(Baz); | ^^^^^^^^^^^^^^ @@ -47,7 +47,7 @@ LL | struct TyUnion(Baz); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:39:1 + --> $DIR/illformed-element-type.rs:40:1 | LL | struct TyForeign(Qux); | ^^^^^^^^^^^^^^^^ @@ -55,7 +55,7 @@ LL | struct TyForeign(Qux); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:43:1 + --> $DIR/illformed-element-type.rs:44:1 | LL | struct TyArray([u32; 4]); | ^^^^^^^^^^^^^^ @@ -63,7 +63,7 @@ LL | struct TyArray([u32; 4]); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:47:1 + --> $DIR/illformed-element-type.rs:48:1 | LL | struct TySlice([u32]); | ^^^^^^^^^^^^^^ @@ -71,7 +71,7 @@ LL | struct TySlice([u32]); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:51:1 + --> $DIR/illformed-element-type.rs:52:1 | LL | struct TyRef<'a>(&'a u32); | ^^^^^^^^^^^^^^^^ @@ -79,7 +79,7 @@ LL | struct TyRef<'a>(&'a u32); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:55:1 + --> $DIR/illformed-element-type.rs:56:1 | LL | struct TyFnPtr(fn(u32) -> u32); | ^^^^^^^^^^^^^^ @@ -87,7 +87,7 @@ LL | struct TyFnPtr(fn(u32) -> u32); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:59:1 + --> $DIR/illformed-element-type.rs:60:1 | LL | struct TyDyn(dyn std::io::Write); | ^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | struct TyDyn(dyn std::io::Write); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:63:1 + --> $DIR/illformed-element-type.rs:64:1 | LL | struct TyNever(!); | ^^^^^^^^^^^^^^ @@ -103,7 +103,7 @@ LL | struct TyNever(!); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:67:1 + --> $DIR/illformed-element-type.rs:68:1 | LL | struct TyTuple((u32, u32)); | ^^^^^^^^^^^^^^ @@ -111,7 +111,7 @@ LL | struct TyTuple((u32, u32)); = help: only `u*`, `i*`, `f*` and `bool` types are accepted error: element type of a scalable vector must be a primitive scalar - --> $DIR/illformed-element-type.rs:77:1 + --> $DIR/illformed-element-type.rs:78:1 | LL | struct TyInvalidAlias(InvalidAlias); | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.rs b/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.rs index 4f89a8f9055e1..37d516144ca3a 100644 --- a/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.rs +++ b/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.rs @@ -1,4 +1,5 @@ //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![allow(internal_features)] #![feature(rustc_attrs)] diff --git a/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.stderr b/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.stderr index f5fd963204a2d..6cf1394471f37 100644 --- a/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.stderr +++ b/tests/ui/scalable-vectors/illformed-tuples-of-scalable-vectors.stderr @@ -1,35 +1,35 @@ error: scalable vectors must be tuple structs - --> $DIR/illformed-tuples-of-scalable-vectors.rs:15:1 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:16:1 | LL | struct Struct { x: ValidI64, y: ValidI64 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: all fields in a scalable vector struct must be the same type - --> $DIR/illformed-tuples-of-scalable-vectors.rs:19:39 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:20:39 | LL | struct DifferentVectorTypes(ValidI64, ValidI32); | ^^^^^^^^ error: scalable vector structs can only have scalable vector fields - --> $DIR/illformed-tuples-of-scalable-vectors.rs:23:23 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:24:23 | LL | struct NonVectorTypes(u32, u64); | ^^^ error: scalable vector structs can only have scalable vector fields - --> $DIR/illformed-tuples-of-scalable-vectors.rs:27:32 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:28:32 | LL | struct DifferentNonVectorTypes(u32, u64); | ^^^ error: scalable vector structs can only have scalable vector fields - --> $DIR/illformed-tuples-of-scalable-vectors.rs:31:34 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:32:34 | LL | struct SomeVectorTypes(ValidI64, u64); | ^^^ error: scalable vector structs cannot contain other scalable vector structs - --> $DIR/illformed-tuples-of-scalable-vectors.rs:35:20 + --> $DIR/illformed-tuples-of-scalable-vectors.rs:36:20 | LL | struct NestedTuple(ValidTuple, ValidTuple); | ^^^^^^^^^^ diff --git a/tests/ui/scalable-vectors/illformed-within-types.rs b/tests/ui/scalable-vectors/illformed-within-types.rs index 81d960e4d4e1a..d34d1ba2d7eb0 100644 --- a/tests/ui/scalable-vectors/illformed-within-types.rs +++ b/tests/ui/scalable-vectors/illformed-within-types.rs @@ -1,4 +1,5 @@ //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![allow(internal_features)] #![feature(rustc_attrs)] diff --git a/tests/ui/scalable-vectors/illformed-within-types.stderr b/tests/ui/scalable-vectors/illformed-within-types.stderr index e76ef26f2aa4b..b95452779f601 100644 --- a/tests/ui/scalable-vectors/illformed-within-types.stderr +++ b/tests/ui/scalable-vectors/illformed-within-types.stderr @@ -1,29 +1,29 @@ error: scalable vectors cannot be fields of a struct - --> $DIR/illformed-within-types.rs:9:8 + --> $DIR/illformed-within-types.rs:10:8 | LL | x: ValidI64, | ^^^^^^^^ error: scalable vectors cannot be tuple fields - --> $DIR/illformed-within-types.rs:11:15 + --> $DIR/illformed-within-types.rs:12:15 | LL | in_tuple: (ValidI64,), | ^^^^^^^^^^^ error: scalable vectors cannot be fields of a struct - --> $DIR/illformed-within-types.rs:15:20 + --> $DIR/illformed-within-types.rs:16:20 | LL | struct TupleStruct(ValidI64); | ^^^^^^^^ error: scalable vectors cannot be fields of a variant - --> $DIR/illformed-within-types.rs:19:26 + --> $DIR/illformed-within-types.rs:20:26 | LL | StructVariant { _ty: ValidI64 }, | ^^^^^^^^ error: scalable vectors cannot be fields of a variant - --> $DIR/illformed-within-types.rs:21:18 + --> $DIR/illformed-within-types.rs:22:18 | LL | TupleVariant(ValidI64), | ^^^^^^^^ diff --git a/tests/ui/scalable-vectors/illformed.rs b/tests/ui/scalable-vectors/illformed.rs index de135413a9f2c..d8730f40e1029 100644 --- a/tests/ui/scalable-vectors/illformed.rs +++ b/tests/ui/scalable-vectors/illformed.rs @@ -1,4 +1,5 @@ //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![allow(internal_features)] #![feature(rustc_attrs)] diff --git a/tests/ui/scalable-vectors/illformed.stderr b/tests/ui/scalable-vectors/illformed.stderr index bdf519c910580..ba584a4ad4d59 100644 --- a/tests/ui/scalable-vectors/illformed.stderr +++ b/tests/ui/scalable-vectors/illformed.stderr @@ -1,29 +1,29 @@ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:6:1 + --> $DIR/illformed.rs:7:1 | LL | struct NoFieldsStructWithElementCount {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:15:1 + --> $DIR/illformed.rs:16:1 | LL | struct NoFieldsUnitWithElementCount; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:20:1 + --> $DIR/illformed.rs:21:1 | LL | struct NoFieldsStructWithoutElementCount {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:29:1 + --> $DIR/illformed.rs:30:1 | LL | struct NoFieldsUnitWithoutElementCount; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:34:1 + --> $DIR/illformed.rs:35:1 | LL | / struct MultipleFieldsStructWithElementCount { LL | | @@ -34,7 +34,7 @@ LL | | } | |_^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:46:1 + --> $DIR/illformed.rs:47:1 | LL | / struct MultipleFieldsStructWithoutElementCount { LL | | @@ -44,13 +44,13 @@ LL | | } | |_^ error: scalable vectors must be tuple structs - --> $DIR/illformed.rs:58:1 + --> $DIR/illformed.rs:59:1 | LL | struct SingleFieldStruct { _ty: f64 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors must have a single field - --> $DIR/illformed.rs:6:1 + --> $DIR/illformed.rs:7:1 | LL | struct NoFieldsStructWithElementCount {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -58,7 +58,7 @@ LL | struct NoFieldsStructWithElementCount {} = help: scalable vector types' only field must be a primitive scalar type error: scalable vectors must have a single field - --> $DIR/illformed.rs:11:1 + --> $DIR/illformed.rs:12:1 | LL | struct NoFieldsTupleWithElementCount(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -66,7 +66,7 @@ LL | struct NoFieldsTupleWithElementCount(); = help: scalable vector types' only field must be a primitive scalar type error: scalable vectors must have a single field - --> $DIR/illformed.rs:15:1 + --> $DIR/illformed.rs:16:1 | LL | struct NoFieldsUnitWithElementCount; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -74,7 +74,7 @@ LL | struct NoFieldsUnitWithElementCount; = help: scalable vector types' only field must be a primitive scalar type error: scalable vectors must have a single field - --> $DIR/illformed.rs:20:1 + --> $DIR/illformed.rs:21:1 | LL | struct NoFieldsStructWithoutElementCount {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -82,7 +82,7 @@ LL | struct NoFieldsStructWithoutElementCount {} = help: tuples of scalable vectors can only contain multiple of the same scalable vector type error: scalable vectors must have a single field - --> $DIR/illformed.rs:25:1 + --> $DIR/illformed.rs:26:1 | LL | struct NoFieldsTupleWithoutElementCount(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -90,7 +90,7 @@ LL | struct NoFieldsTupleWithoutElementCount(); = help: tuples of scalable vectors can only contain multiple of the same scalable vector type error: scalable vectors must have a single field - --> $DIR/illformed.rs:29:1 + --> $DIR/illformed.rs:30:1 | LL | struct NoFieldsUnitWithoutElementCount; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -98,25 +98,25 @@ LL | struct NoFieldsUnitWithoutElementCount; = help: tuples of scalable vectors can only contain multiple of the same scalable vector type error: scalable vectors cannot have multiple fields - --> $DIR/illformed.rs:34:1 + --> $DIR/illformed.rs:35:1 | LL | struct MultipleFieldsStructWithElementCount { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vectors cannot have multiple fields - --> $DIR/illformed.rs:42:1 + --> $DIR/illformed.rs:43:1 | LL | struct MultipleFieldsTupleWithElementCount(f32, u32); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: scalable vector structs can only have scalable vector fields - --> $DIR/illformed.rs:48:5 + --> $DIR/illformed.rs:49:5 | LL | _ty: f32, | ^^^^^^^^ error: scalable vector structs can only have scalable vector fields - --> $DIR/illformed.rs:54:47 + --> $DIR/illformed.rs:55:47 | LL | struct MultipleFieldsTupleWithoutElementCount(f32, u32); | ^^^ diff --git a/tests/ui/scalable-vectors/invalid.rs b/tests/ui/scalable-vectors/invalid.rs index 90e9839c9e116..0b6a915e5ccd2 100644 --- a/tests/ui/scalable-vectors/invalid.rs +++ b/tests/ui/scalable-vectors/invalid.rs @@ -1,4 +1,5 @@ //@ edition: 2024 +//@ only-aarch64 #![allow(internal_features, unused_imports, unused_macros)] #![feature(extern_types)] #![feature(gen_blocks)] diff --git a/tests/ui/scalable-vectors/invalid.stderr b/tests/ui/scalable-vectors/invalid.stderr index d73b5abf7030f..a8ef99e2f8bc5 100644 --- a/tests/ui/scalable-vectors/invalid.stderr +++ b/tests/ui/scalable-vectors/invalid.stderr @@ -1,11 +1,11 @@ error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters - --> $DIR/invalid.rs:109:11 + --> $DIR/invalid.rs:110:11 | LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[rustc_scalable_vector]` attribute cannot be used on extern crates - --> $DIR/invalid.rs:9:1 + --> $DIR/invalid.rs:10:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -13,7 +13,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on use statements - --> $DIR/invalid.rs:13:1 + --> $DIR/invalid.rs:14:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on statics - --> $DIR/invalid.rs:17:1 + --> $DIR/invalid.rs:18:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -29,7 +29,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on constants - --> $DIR/invalid.rs:21:1 + --> $DIR/invalid.rs:22:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -37,7 +37,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on modules - --> $DIR/invalid.rs:25:1 + --> $DIR/invalid.rs:26:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -45,7 +45,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on foreign modules - --> $DIR/invalid.rs:30:1 + --> $DIR/invalid.rs:31:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -53,7 +53,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on foreign statics - --> $DIR/invalid.rs:33:5 + --> $DIR/invalid.rs:34:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -61,7 +61,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on foreign types - --> $DIR/invalid.rs:36:5 + --> $DIR/invalid.rs:37:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -69,7 +69,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on foreign functions - --> $DIR/invalid.rs:39:5 + --> $DIR/invalid.rs:40:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on type aliases - --> $DIR/invalid.rs:44:1 + --> $DIR/invalid.rs:45:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -85,7 +85,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on enums - --> $DIR/invalid.rs:48:1 + --> $DIR/invalid.rs:49:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on type parameters - --> $DIR/invalid.rs:50:10 + --> $DIR/invalid.rs:51:10 | LL | enum Bar<#[rustc_scalable_vector(4)] T> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -101,7 +101,7 @@ LL | enum Bar<#[rustc_scalable_vector(4)] T> { = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on enum variants - --> $DIR/invalid.rs:52:5 + --> $DIR/invalid.rs:53:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -109,7 +109,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on struct fields - --> $DIR/invalid.rs:58:5 + --> $DIR/invalid.rs:59:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -117,7 +117,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on unions - --> $DIR/invalid.rs:63:1 + --> $DIR/invalid.rs:64:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -125,7 +125,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on traits - --> $DIR/invalid.rs:70:1 + --> $DIR/invalid.rs:71:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on associated types - --> $DIR/invalid.rs:73:5 + --> $DIR/invalid.rs:74:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -141,7 +141,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on associated consts - --> $DIR/invalid.rs:76:5 + --> $DIR/invalid.rs:77:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -149,7 +149,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on provided trait methods - --> $DIR/invalid.rs:79:5 + --> $DIR/invalid.rs:80:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on trait aliases - --> $DIR/invalid.rs:84:1 + --> $DIR/invalid.rs:85:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -165,7 +165,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on inherent impl blocks - --> $DIR/invalid.rs:88:1 + --> $DIR/invalid.rs:89:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -173,7 +173,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on inherent methods - --> $DIR/invalid.rs:91:5 + --> $DIR/invalid.rs:92:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -181,7 +181,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on trait impl blocks - --> $DIR/invalid.rs:96:1 + --> $DIR/invalid.rs:97:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on macro defs - --> $DIR/invalid.rs:103:1 + --> $DIR/invalid.rs:104:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -197,7 +197,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:107:1 + --> $DIR/invalid.rs:108:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -205,7 +205,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on function params - --> $DIR/invalid.rs:109:11 + --> $DIR/invalid.rs:110:11 | LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -213,7 +213,7 @@ LL | fn barqux(#[rustc_scalable_vector(4)] _x: u32) {} = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:113:1 + --> $DIR/invalid.rs:114:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -221,7 +221,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:117:1 + --> $DIR/invalid.rs:118:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on functions - --> $DIR/invalid.rs:121:1 + --> $DIR/invalid.rs:122:1 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -237,7 +237,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on closures - --> $DIR/invalid.rs:126:14 + --> $DIR/invalid.rs:127:14 | LL | let _x = #[rustc_scalable_vector(4)] || { }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -245,7 +245,7 @@ LL | let _x = #[rustc_scalable_vector(4)] || { }; = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on expressions - --> $DIR/invalid.rs:128:14 + --> $DIR/invalid.rs:129:14 | LL | let _y = #[rustc_scalable_vector(4)] 3 + 4; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -253,7 +253,7 @@ LL | let _y = #[rustc_scalable_vector(4)] 3 + 4; = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on statements - --> $DIR/invalid.rs:130:5 + --> $DIR/invalid.rs:131:5 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -261,7 +261,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error: `#[rustc_scalable_vector]` attribute cannot be used on match arms - --> $DIR/invalid.rs:135:9 + --> $DIR/invalid.rs:136:9 | LL | #[rustc_scalable_vector(4)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -269,7 +269,7 @@ LL | #[rustc_scalable_vector(4)] = help: `#[rustc_scalable_vector]` can only be applied to structs error[E0539]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:142:1 + --> $DIR/invalid.rs:143:1 | LL | #[rustc_scalable_vector("4")] | ^^^^^^^^^^^^^^^^^^^^^^^^---^^ @@ -286,7 +286,7 @@ LL + #[rustc_scalable_vector] | error[E0805]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:146:1 + --> $DIR/invalid.rs:147:1 | LL | #[rustc_scalable_vector(4, 2)] | ^^^^^^^^^^^^^^^^^^^^^^^------^ @@ -303,7 +303,7 @@ LL + #[rustc_scalable_vector] | error[E0539]: malformed `rustc_scalable_vector` attribute input - --> $DIR/invalid.rs:150:1 + --> $DIR/invalid.rs:151:1 | LL | #[rustc_scalable_vector(count = "4")] | ^^^^^^^^^^^^^^^^^^^^^^^^-----------^^ @@ -320,7 +320,7 @@ LL + #[rustc_scalable_vector] | error: element count in `rustc_scalable_vector` is too large: `65536` - --> $DIR/invalid.rs:154:1 + --> $DIR/invalid.rs:155:1 | LL | #[rustc_scalable_vector(65536)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -328,7 +328,7 @@ LL | #[rustc_scalable_vector(65536)] = note: the value may not exceed `u16::MAX` error: scalable vector structs can only have scalable vector fields - --> $DIR/invalid.rs:162:18 + --> $DIR/invalid.rs:163:18 | LL | struct OkayNoArg(f32); | ^^^ diff --git a/tests/ui/scalable-vectors/wellformed-arrays.rs b/tests/ui/scalable-vectors/wellformed-arrays.rs index b8f0bf291eea4..6a26a8595fa64 100644 --- a/tests/ui/scalable-vectors/wellformed-arrays.rs +++ b/tests/ui/scalable-vectors/wellformed-arrays.rs @@ -1,5 +1,6 @@ //@ check-pass //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![feature(rustc_attrs)] #[rustc_scalable_vector(16)] diff --git a/tests/ui/scalable-vectors/wellformed.rs b/tests/ui/scalable-vectors/wellformed.rs index cb6a22d6c4338..da300d53ef88a 100644 --- a/tests/ui/scalable-vectors/wellformed.rs +++ b/tests/ui/scalable-vectors/wellformed.rs @@ -1,5 +1,6 @@ //@ check-pass //@ compile-flags: --crate-type=lib +//@ only-aarch64 #![feature(rustc_attrs)] #[rustc_scalable_vector(16)] From 2c7690e1e6b18ebf51e84e4b08a35903cee64f6b Mon Sep 17 00:00:00 2001 From: mu001999 Date: Mon, 9 Mar 2026 23:36:26 +0800 Subject: [PATCH 04/10] Mark stable features as used to avoid trigger unused_features --- compiler/rustc_passes/src/stability.rs | 6 ++++++ .../ui/lint/unused-features/stable-features.rs | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/ui/lint/unused-features/stable-features.rs diff --git a/compiler/rustc_passes/src/stability.rs b/compiler/rustc_passes/src/stability.rs index ec6d48cbea2e4..18263506a03b2 100644 --- a/compiler/rustc_passes/src/stability.rs +++ b/compiler/rustc_passes/src/stability.rs @@ -964,6 +964,9 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { let mut lang_features = UnordSet::default(); for EnabledLangFeature { gate_name, attr_sp, stable_since } in enabled_lang_features { if let Some(version) = stable_since { + // Mark the feature as enabled, to ensure that it is not marked as unused. + let _ = tcx.features().enabled(*gate_name); + // Warn if the user has enabled an already-stable lang feature. unnecessary_stable_feature_lint(tcx, *attr_sp, *gate_name, *version); } @@ -1021,6 +1024,9 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) { if let FeatureStability::AcceptedSince(since) = stability && let Some(span) = remaining_lib_features.get(&feature) { + // Mark the feature as enabled, to ensure that it is not marked as unused. + let _ = tcx.features().enabled(feature); + // Warn if the user has enabled an already-stable lib feature. if let Some(implies) = all_implications.get(&feature) { unnecessary_partially_stable_feature_lint(tcx, *span, feature, *implies, since); diff --git a/tests/ui/lint/unused-features/stable-features.rs b/tests/ui/lint/unused-features/stable-features.rs new file mode 100644 index 0000000000000..d27be14b86d5a --- /dev/null +++ b/tests/ui/lint/unused-features/stable-features.rs @@ -0,0 +1,17 @@ +//@ check-pass + +#![deny(warnings)] +#![allow(stable_features)] + +// Lang feature +#![feature(lint_reasons)] + +// Lib feature +#![feature(euclidean_division)] + +#[allow(unused_variables, reason = "my reason")] +fn main() { + let x = (); + + let _ = 42.0_f32.div_euclid(3.0); +} From dfd5e905c5f26a2ae9682468b1c30a6ccd60cc20 Mon Sep 17 00:00:00 2001 From: mu001999 Date: Mon, 9 Mar 2026 23:38:30 +0800 Subject: [PATCH 05/10] Bless other tests --- .../ui/lint/unused-features/unused-library-features.rs | 3 +-- .../unused-features/unused-library-features.stderr | 10 ++-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/ui/lint/unused-features/unused-library-features.rs b/tests/ui/lint/unused-features/unused-library-features.rs index 75afd32e56cb3..2f53ab66b160c 100644 --- a/tests/ui/lint/unused-features/unused-library-features.rs +++ b/tests/ui/lint/unused-features/unused-library-features.rs @@ -5,8 +5,7 @@ #![feature(step_trait)] //~^ ERROR feature `step_trait` is declared but not used #![feature(is_sorted)] -//~^ ERROR feature `is_sorted` is declared but not used -//~^^ WARN the feature `is_sorted` has been stable since 1.82.0 and no longer requires an attribute to enable +//~^ WARN the feature `is_sorted` has been stable since 1.82.0 and no longer requires an attribute to enable // Enabled via cfg_attr, unused #![cfg_attr(all(), feature(slice_ptr_get))] diff --git a/tests/ui/lint/unused-features/unused-library-features.stderr b/tests/ui/lint/unused-features/unused-library-features.stderr index e259058d6c33b..bf71e269e2f0f 100644 --- a/tests/ui/lint/unused-features/unused-library-features.stderr +++ b/tests/ui/lint/unused-features/unused-library-features.stderr @@ -18,17 +18,11 @@ note: the lint level is defined here LL | #![deny(unused_features)] | ^^^^^^^^^^^^^^^ -error: feature `is_sorted` is declared but not used - --> $DIR/unused-library-features.rs:7:12 - | -LL | #![feature(is_sorted)] - | ^^^^^^^^^ - error: feature `slice_ptr_get` is declared but not used - --> $DIR/unused-library-features.rs:12:28 + --> $DIR/unused-library-features.rs:11:28 | LL | #![cfg_attr(all(), feature(slice_ptr_get))] | ^^^^^^^^^^^^^ -error: aborting due to 3 previous errors; 1 warning emitted +error: aborting due to 2 previous errors; 1 warning emitted From 28131e1b8f7dfe58935cd8dbe25e70fe95781080 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 9 Mar 2026 17:18:55 +0100 Subject: [PATCH 06/10] Update `sysinfo` version to `0.38.4` --- Cargo.lock | 12 ++++++------ src/bootstrap/Cargo.lock | 12 ++++++------ src/bootstrap/Cargo.toml | 2 +- src/tools/opt-dist/Cargo.toml | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1e6d8f682d046..039dc0b0ea4d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2622,9 +2622,9 @@ dependencies = [ [[package]] name = "objc2-core-foundation" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags", ] @@ -2637,9 +2637,9 @@ checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" [[package]] name = "objc2-io-kit" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" dependencies = [ "libc", "objc2-core-foundation", @@ -5315,9 +5315,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.38.2" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8" +checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" dependencies = [ "libc", "objc2-core-foundation", diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock index f9499d9927f27..d694f8e13f111 100644 --- a/src/bootstrap/Cargo.lock +++ b/src/bootstrap/Cargo.lock @@ -472,18 +472,18 @@ dependencies = [ [[package]] name = "objc2-core-foundation" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c10c2894a6fed806ade6027bcd50662746363a9589d3ec9d9bef30a4e4bc166" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ "bitflags", ] [[package]] name = "objc2-io-kit" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71c1c64d6120e51cd86033f67176b1cb66780c2efe34dec55176f77befd93c0a" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" dependencies = [ "libc", "objc2-core-foundation", @@ -743,9 +743,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.38.2" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1efc19935b4b66baa6f654ac7924c192f55b175c00a7ab72410fc24284dacda8" +checksum = "92ab6a2f8bfe508deb3c6406578252e491d299cbbf3bc0529ecc3313aee4a52f" dependencies = [ "libc", "memchr", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 0019e9e6d92e2..7187a5a951de0 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -57,7 +57,7 @@ walkdir = "2.4" xz2 = "0.1" # Dependencies needed by the build-metrics feature -sysinfo = { version = "0.38.2", default-features = false, optional = true, features = ["system"] } +sysinfo = { version = "0.38.4", default-features = false, optional = true, features = ["system"] } # Dependencies needed by the `tracing` feature chrono = { version = "0.4", default-features = false, optional = true, features = ["now", "std"] } diff --git a/src/tools/opt-dist/Cargo.toml b/src/tools/opt-dist/Cargo.toml index b6547eff007b6..29d302b52566a 100644 --- a/src/tools/opt-dist/Cargo.toml +++ b/src/tools/opt-dist/Cargo.toml @@ -10,7 +10,7 @@ log = "0.4" anyhow = "1" humantime = "2" humansize = "2" -sysinfo = { version = "0.38.2", default-features = false, features = ["disk"] } +sysinfo = { version = "0.38.4", default-features = false, features = ["disk"] } fs_extra = "1" camino = "1" tar = "0.4" From db5599bf29565f08960c70b9d67536841e4ae978 Mon Sep 17 00:00:00 2001 From: rustbot <47979223+rustbot@users.noreply.github.com> Date: Mon, 9 Mar 2026 18:01:03 +0100 Subject: [PATCH 07/10] Update books --- src/doc/embedded-book | 2 +- src/doc/nomicon | 2 +- src/doc/reference | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 99d0341ff4e06..e88aa4403b4bf 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 99d0341ff4e06757490af8fceee790c4ede50bc0 +Subproject commit e88aa4403b4bf2071c8df9509160477e40179099 diff --git a/src/doc/nomicon b/src/doc/nomicon index b8f254a991b8b..cc6a6bae8c3bf 160000 --- a/src/doc/nomicon +++ b/src/doc/nomicon @@ -1 +1 @@ -Subproject commit b8f254a991b8b7e8f704527f0d4f343a4697dfa9 +Subproject commit cc6a6bae8c3bfa389974e533c54694662c1a9de6 diff --git a/src/doc/reference b/src/doc/reference index 50a1075e879be..c49e89cc8c7c2 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 50a1075e879be75aeec436252c84eef0fad489f4 +Subproject commit c49e89cc8c7c2c43ca625a8d5b7ad9a53a9ce978 From c5c8d6bac78d57da9e5c71969fc5e52b5f384efe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Mon, 9 Mar 2026 18:16:46 +0100 Subject: [PATCH 08/10] Ping fmease on parser modifications --- triagebot.toml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/triagebot.toml b/triagebot.toml index 8d6401c490561..55f30978f48a6 100644 --- a/triagebot.toml +++ b/triagebot.toml @@ -1012,6 +1012,13 @@ cc = ["@lcnr"] message = "HIR ty lowering was modified" cc = ["@fmease"] +[mentions."compiler/rustc_parse"] +message = """ +The parser was modified, potentially altering the grammar of (stable) Rust +which would be a breaking change. +""" +cc = ["@fmease"] + [mentions."library/core/src/mem/type_info.rs"] message = """ The reflection data structures are tied exactly to the implementation From 744c50315dc52cd6d9f09b80561c936afa2b3b96 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 9 Mar 2026 12:12:30 +0100 Subject: [PATCH 09/10] Add missing `Diag::with_span_suggestion_with_style` method --- compiler/rustc_errors/src/diagnostic.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 2aac669d744a9..18f1af36b6202 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -934,6 +934,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { self } } + with_fn! { with_span_suggestion_with_style, /// [`Diag::span_suggestion()`] but you can set the [`SuggestionStyle`]. pub fn span_suggestion_with_style( &mut self, @@ -956,7 +957,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> { applicability, }); self - } + } } with_fn! { with_span_suggestion_verbose, /// Always show the suggested change. From a4a37ed163a6c1d227b58047d91457589c611cf8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 9 Mar 2026 22:32:51 +0100 Subject: [PATCH 10/10] Use `Diag::with_span_suggestion_with_style` method in librustdoc --- .../passes/lint/redundant_explicit_links.rs | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/src/librustdoc/passes/lint/redundant_explicit_links.rs b/src/librustdoc/passes/lint/redundant_explicit_links.rs index 84dba5d2f1153..13bc4c079aa78 100644 --- a/src/librustdoc/passes/lint/redundant_explicit_links.rs +++ b/src/librustdoc/passes/lint/redundant_explicit_links.rs @@ -165,7 +165,7 @@ fn check_inline_or_reference_unknown_redundancy( fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { let Self { explicit_span, display_span, link_span, display_link } = self; - let mut diag = Diag::new(dcx, level, "redundant explicit link target") + Diag::new(dcx, level, "redundant explicit link target") .with_span_label( explicit_span, "explicit target is redundant", @@ -176,17 +176,15 @@ fn check_inline_or_reference_unknown_redundancy( ) .with_note( "when a link's destination is not specified,\nthe label is used to resolve intra-doc links" - ); - // FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method. - // FIXME2 (GuillaumeGomez): Why isn't there a `with_` equivalent for this method? - diag.span_suggestion_with_style( - link_span, - "remove explicit link target", - format!("[{}]", display_link), - Applicability::MaybeIncorrect, - SuggestionStyle::ShowAlways, - ); - diag + ) + // FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method. + .with_span_suggestion_with_style( + link_span, + "remove explicit link target", + format!("[{}]", display_link), + Applicability::MaybeIncorrect, + SuggestionStyle::ShowAlways, + ) } } @@ -267,7 +265,7 @@ fn check_reference_redundancy( fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { let Self { explicit_span, display_span, def_span, link_span, display_link } = self; - let mut diag = Diag::new(dcx, level, "redundant explicit link target") + Diag::new(dcx, level, "redundant explicit link target") .with_span_label(explicit_span, "explicit target is redundant") .with_span_label( display_span, @@ -276,17 +274,15 @@ fn check_reference_redundancy( .with_span_note(def_span, "referenced explicit link target defined here") .with_note( "when a link's destination is not specified,\nthe label is used to resolve intra-doc links" - ); - // FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method. - // FIXME2 (GuillaumeGomez): Why isn't there a `with_` equivalent for this method? - diag.span_suggestion_with_style( - link_span, - "remove explicit link target", - format!("[{}]", display_link), - Applicability::MaybeIncorrect, - SuggestionStyle::ShowAlways, - ); - diag + ) + // FIXME (GuillaumeGomez): We cannot use `derive(Diagnostic)` because of this method. + .with_span_suggestion_with_style( + link_span, + "remove explicit link target", + format!("[{}]", display_link), + Applicability::MaybeIncorrect, + SuggestionStyle::ShowAlways, + ) } }