diff --git a/Cargo.lock b/Cargo.lock index 1e6d8f682d046..ba41143ff61d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -376,12 +376,41 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "bytecheck" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0caa33a2c0edca0419d15ac723dff03f1956f7978329b1e3b5fdaaaed9d3ca8b" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "rancor", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89385e82b5d1821d2219e0b095efa2cc1f246cbf99080f3be46a1a85c0d392d9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "bytecount" version = "0.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "175812e0be2bccb6abe50bb8d566126198344f707e304f45c648fd8f2cc0365e" +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + [[package]] name = "camino" version = "1.2.1" @@ -2476,6 +2505,26 @@ dependencies = [ name = "miropt-test-tools" version = "0.1.0" +[[package]] +name = "munge" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e17401f259eba956ca16491461b6e8f72913a0a114e39736ce404410f915a0c" +dependencies = [ + "munge_macro", +] + +[[package]] +name = "munge_macro" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4568f25ccbd45ab5d5603dc34318c1ec56b117531781260002151b8530a9f931" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -2622,9 +2671,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 +2686,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", @@ -3047,6 +3096,26 @@ dependencies = [ "cc", ] +[[package]] +name = "ptr_meta" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9a0cf95a1196af61d4f1cbdab967179516d9a4a4312af1f31948f8f6224a79" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7347867d0a7e1208d93b46767be83e2b8f978c3dad35f775ac8d8847551d6fe1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "pulldown-cmark" version = "0.11.3" @@ -3092,6 +3161,15 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "rancor" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a063ea72381527c2a0561da9c80000ef822bdd7c3241b1cc1b12100e3df081ee" +dependencies = [ + "ptr_meta", +] + [[package]] name = "rand" version = "0.8.5" @@ -3275,6 +3353,15 @@ dependencies = [ name = "remote-test-server" version = "0.1.0" +[[package]] +name = "rend" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadadef317c2f20755a64d7fdc48f9e7178ee6b0e1f7fce33fa60f1d68a276e6" +dependencies = [ + "bytecheck", +] + [[package]] name = "replace-version-placeholder" version = "0.1.0" @@ -3283,6 +3370,36 @@ dependencies = [ "walkdir", ] +[[package]] +name = "rkyv" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a30e631b7f4a03dee9056b8ef6982e8ba371dd5bedb74d3ec86df4499132c70" +dependencies = [ + "bytecheck", + "bytes", + "hashbrown 0.16.1", + "indexmap", + "munge", + "ptr_meta", + "rancor", + "rend", + "rkyv_derive", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8100bb34c0a1d0f907143db3149e6b4eea3c33b9ee8b189720168e818303986f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] + [[package]] name = "run_make_support" version = "0.0.0" @@ -4790,6 +4907,7 @@ name = "rustdoc-json-types" version = "0.1.0" dependencies = [ "bincode", + "rkyv", "rustc-hash 2.1.1", "serde", "serde_derive", @@ -5128,6 +5246,12 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + [[package]] name = "similar" version = "2.7.0" @@ -5315,9 +5439,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/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/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/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 3b0e7b2e30afe..b8638d5413be1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -3319,7 +3319,7 @@ impl Step for CrateRustdocJsonTypes { builder.kind, "src/rustdoc-json-types", SourceType::InTree, - &[], + &["rkyv_0_8".to_owned()], ); // FIXME: this looks very wrong, libtest doesn't accept `-C` arguments and the quotes are fishy. 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 diff --git a/src/rustdoc-json-types/Cargo.toml b/src/rustdoc-json-types/Cargo.toml index a38d34ef0e7d9..7e4e53ccaf0de 100644 --- a/src/rustdoc-json-types/Cargo.toml +++ b/src/rustdoc-json-types/Cargo.toml @@ -8,11 +8,13 @@ path = "lib.rs" [features] default = ["rustc-hash"] +rkyv_0_8 = ["dep:rkyv"] [dependencies] serde = "1.0" serde_derive = "1.0" rustc-hash = { version = "2.0", optional = true } +rkyv = { version = "0.8", optional = true } [dev-dependencies] serde_json = "1.0" diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 54fb833f40b64..09b8dbb3292ea 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -3,7 +3,11 @@ //! These types are the public API exposed through the `--output-format json` flag. The [`Crate`] //! struct is the root of the JSON blob and all other items are contained within. //! -//! We expose a `rustc-hash` feature that is disabled by default. This feature switches the +//! # Feature Flags +//! +//! ## `rustc-hash` +//! +//! We expose a `rustc-hash` feature, disabled by default. This feature switches the //! [`std::collections::HashMap`] for [`rustc_hash::FxHashMap`] to improve the performance of said //! `HashMap` in specific situations. //! @@ -12,8 +16,79 @@ //! turning this feature on, as [`FxHashMap`][2] only concerns itself with hash speed, and may //! increase the number of collisions. //! +//! ## `rkyv_0_8` +//! +//! We expose a `rkyv_0_8` feature, disabled by default. When enabled, it derives `rkyv`'s +//! [`Archive`](rkyv::Archive), [`Serialize`](rkyv::Serialize) and [`Deserialize`](rkyv::Deserialize) +//! traits for all types in this crate. Furthermore, it exposes the corresponding `Archived*` types +//! (e.g. [`ArchivedId`] for [`Id`]). +//! +//! `rkyv` lets you works with JSON output without paying the deserialization cost _upfront_, +//! thanks to [zero-copy deserialization][3]. +//! You can perform various types of analyses on the `Archived*` version of the relevant types, +//! incurring the full deserialization cost only for the subset of items you actually need. +//! //! [1]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/rustc-hash.20and.20performance.20of.20rustdoc-types/near/474855731 //! [2]: https://crates.io/crates/rustc-hash +//! [3]: https://rkyv.org/zero-copy-deserialization.html + +// # On `rkyv` Derives +// +// In most cases, it's enough to add `#[derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize)]` +// on top of a type to derive the relevant `rkyv` traits. +// +// There are a few exceptions, though, where more complex macro options are required. +// The following sections break down the patterns that are showcased by `rkyv'`s +// [JSON schema example](https://github.com/rkyv/rkyv/blob/985b0230a0b9cb9fce4a4ee9facb6af148e27c8e/rkyv/examples/json_like_schema.rs). +// +// ## Recursive Types +// +// Let's look at the `Type` enum as an example. It stores a `Box` in its `Slice` variant. +// A "vanilla" `rkyv` annotation will cause an overflow in the compiler when +// building the crate, since the bounds generated by the macro will be self-referential and thus +// trap the compiler into a never-ending loop. +// +// To prevent this issue, `#[rkyv(omit_bounds)]` must be added to the relevant field. +// +// ## Co-Recursive Types +// +// The same problem occurs if a type is co-recursive—i.e. it doesn't _directly_ store a pointer +// to another instance of the same type, but one of its fields does, transitively. +// +// For example, let's look at `Path`: +// +// - `Path` has a field of type `Option>` +// - One of the variants in `GenericArgs` has a field of type `Vec` +// - One of the variants of `GenericArg` has a field of type `Type` +// - `Type::ResolvedPath` stores a `Path` instance +// +// The same logic of the recursive case applies here: we must use `#[rkyv(omit_bounds)]` to break the cycle. +// +// ## Additional Bounds +// +// Whenever `#[rkyv(omit_bounds)]` is added to a field or variant, `rkyv` omits _all_ traits bounds for that +// field in the generated impl. This may result in compilation errors due to insufficient bounds in the +// generated code. +// +// To add _some_ bounds back, `rkyv` exposes four knobs: +// +// - `#[rkyv(archive_bounds(..))]` to add predicates to all generated impls +// - `#[rkyv(serialize_bounds(..))]` to add predicates to just the `Serialize` impl +// - `#[rkyv(deserialize_bounds(..))]` to add predicates to just the `Deserialize` impl +// - `#[rkyv(bytecheck(bounds(..)))]` to add predicates to just the `CheckBytes` impl +// +// In particular, we use the following annotations in this crate: +// +// - `serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, __S::Error: rkyv::rancor::Source)` for serializing +// variable-length types like `Vec`. `rkyv`'s zero-copy format requires the serializer to be able +// to write bytes (`Writer`) and allocate scratch space (`Allocator`) for these types +// ([`rkyv`'s `Vec` impl bounds](https://docs.rs/rkyv/0.8.15/rkyv/trait.Serialize.html#impl-Serialize%3CS%3E-for-Vec%3CT%3E)). +// The `Error: Source` bound lets error types compose. +// - `deserialize_bounds(__D::Error: rkyv::rancor::Source)` so that errors from deserializing fields behind +// `omit_bounds` (e.g. `Box`, `Vec`) can compose via the `Source` trait. +// - `bytecheck(bounds(__C: rkyv::validation::ArchiveContext, __C::Error: rkyv::rancor::Source))` for validating +// archived data. Checking that bytes represent a valid archived value requires an `ArchiveContext` that tracks +// validation state (e.g. subtree ranges, to prevent overlapping/out-of-bounds archived data). #[cfg(not(feature = "rustc-hash"))] use std::collections::HashMap; @@ -46,6 +121,8 @@ pub const FORMAT_VERSION: u32 = 57; /// about the language items in the local crate, as well as info about external items to allow /// tools to find or link to them. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Crate { /// The id of the root [`Module`] item of the local crate. pub root: Id, @@ -69,6 +146,8 @@ pub struct Crate { /// Information about a target #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Target { /// The target triple for which this documentation was generated pub triple: String, @@ -99,6 +178,8 @@ pub struct Target { /// [1]: https://doc.rust-lang.org/stable/reference/attributes/codegen.html#the-target_feature-attribute /// [2]: https://doc.rust-lang.org/reference/conditional-compilation.html#target_feature #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct TargetFeature { /// The name of this target feature. pub name: String, @@ -123,6 +204,8 @@ pub struct TargetFeature { /// Metadata of a crate, either the same crate on which `rustdoc` was invoked, or its dependency. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct ExternalCrate { /// The name of the crate. /// @@ -140,6 +223,7 @@ pub struct ExternalCrate { /// /// This will typically be a `.rlib` or `.rmeta`. It can be used to determine which crate /// this was in terms of whatever build-system invoked rustc. + #[cfg_attr(feature = "rkyv_0_8", rkyv(with = rkyv::with::AsString))] pub path: PathBuf, } @@ -150,6 +234,8 @@ pub struct ExternalCrate { /// question, or can be used by a tool that takes the json output of multiple crates to find /// the actual item definition with all the relevant info. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct ItemSummary { /// Can be used to look up the name and html_root_url of the crate this item came from in the /// `external_crates` map. @@ -171,6 +257,8 @@ pub struct ItemSummary { /// The `Item` data type holds fields that can apply to any of these, /// and leaves kind-specific details (like function args or enum variants) to the `inner` field. #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Item { /// The unique identifier of this item. Can be used to find this item in various mappings. pub id: Id, @@ -209,6 +297,8 @@ pub struct Item { } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] /// An attribute, e.g. `#[repr(C)]` /// @@ -256,6 +346,8 @@ pub enum Attribute { } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] /// The contents of a `#[repr(...)]` attribute. /// /// Used in [`Attribute::Repr`]. @@ -275,6 +367,8 @@ pub struct AttributeRepr { } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] /// The kind of `#[repr]`. /// @@ -294,8 +388,11 @@ pub enum ReprKind { /// A range of source code. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Span { /// The path to the source file for this span relative to the path `rustdoc` was invoked with. + #[cfg_attr(feature = "rkyv_0_8", rkyv(with = rkyv::with::AsString))] pub filename: PathBuf, /// One indexed Line and Column of the first character of the `Span`. pub begin: (usize, usize), @@ -305,6 +402,8 @@ pub struct Span { /// Information about the deprecation of an [`Item`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Deprecation { /// Usually a version number when this [`Item`] first became deprecated. pub since: Option, @@ -314,6 +413,8 @@ pub struct Deprecation { /// Visibility of an [`Item`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum Visibility { /// Explicitly public visibility set with `pub`. @@ -337,6 +438,8 @@ pub enum Visibility { /// Dynamic trait object type (`dyn Trait`). #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct DynTrait { /// All the traits implemented. One of them is the vtable, and the rest must be auto traits. pub traits: Vec, @@ -352,6 +455,8 @@ pub struct DynTrait { /// A trait and potential HRTBs #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct PolyTrait { /// The path to the trait. #[serde(rename = "trait")] @@ -371,6 +476,18 @@ pub struct PolyTrait { /// ^^^^^ /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(serialize_bounds( + __S: rkyv::ser::Writer + rkyv::ser::Allocator, + __S::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(deserialize_bounds( + __D::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(bytecheck(bounds( + __C: rkyv::validation::ArchiveContext, +))))] #[serde(rename_all = "snake_case")] pub enum GenericArgs { /// `<'a, 32, B: Copy, C = u32>` @@ -387,8 +504,10 @@ pub enum GenericArgs { /// `Fn(A, B) -> C` Parenthesized { /// The input types, enclosed in parentheses. + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] inputs: Vec, /// The output type provided after the `->`, if present. + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] output: Option, }, /// `T::method(..)` @@ -399,6 +518,8 @@ pub enum GenericArgs { /// /// Part of [`GenericArgs`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum GenericArg { /// A lifetime argument. @@ -429,6 +550,8 @@ pub enum GenericArg { /// A constant. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Constant { /// The stringified expression of this constant. Note that its mapping to the original /// source code is unstable and it's not guaranteed that it'll match the source code. @@ -448,10 +571,24 @@ pub struct Constant { /// ^^^^^^^^^^ ^^^^^^^^^^^^^^^ /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(serialize_bounds( + __S: rkyv::ser::Writer + rkyv::ser::Allocator, + __S::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(deserialize_bounds( + __D::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(bytecheck(bounds( + __C: rkyv::validation::ArchiveContext, + <__C as rkyv::rancor::Fallible>::Error: rkyv::rancor::Source, +))))] pub struct AssocItemConstraint { /// The name of the associated type/constant. pub name: String, /// Arguments provided to the associated type/constant. + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] pub args: Option>, /// The kind of bound applied to the associated type/constant. pub binding: AssocItemConstraintKind, @@ -459,6 +596,8 @@ pub struct AssocItemConstraint { /// The way in which an associate type/constant is bound. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum AssocItemConstraintKind { /// The required value/type is specified exactly. e.g. @@ -487,6 +626,8 @@ pub enum AssocItemConstraintKind { /// should treat them as opaque keys to lookup items, and avoid attempting /// to parse them, or otherwise depend on any implementation details. #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)))] // FIXME(aDotInTheVoid): Consider making this non-public in rustdoc-types. pub struct Id(pub u32); @@ -494,6 +635,9 @@ pub struct Id(pub u32); /// /// Part of [`ItemSummary`]. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(compare(PartialEq)))] #[serde(rename_all = "snake_case")] pub enum ItemKind { /// A module declaration, e.g. `mod foo;` or `mod foo {}` @@ -569,6 +713,8 @@ pub enum ItemKind { /// /// Part of [`Item`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum ItemEnum { /// A module declaration, e.g. `mod foo;` or `mod foo {}` @@ -717,6 +863,8 @@ impl ItemEnum { /// A module declaration, e.g. `mod foo;` or `mod foo {}`. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Module { /// Whether this is the root item of a crate. /// @@ -732,6 +880,8 @@ pub struct Module { /// A `union`. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Union { /// The generic parameters and where clauses on this union. pub generics: Generics, @@ -749,6 +899,8 @@ pub struct Union { /// A `struct`. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Struct { /// The kind of the struct (e.g. unit, tuple-like or struct-like) and the data specific to it, /// i.e. fields. @@ -762,6 +914,8 @@ pub struct Struct { /// The kind of a [`Struct`] and the data specific to it, i.e. fields. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum StructKind { /// A struct with no fields and no parentheses. @@ -799,6 +953,8 @@ pub enum StructKind { /// An `enum`. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Enum { /// Information about the type parameters and `where` clauses of the enum. pub generics: Generics, @@ -814,6 +970,8 @@ pub struct Enum { /// A variant of an enum. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Variant { /// Whether the variant is plain, a tuple-like, or struct-like. Contains the fields. pub kind: VariantKind, @@ -823,6 +981,8 @@ pub struct Variant { /// The kind of an [`Enum`] [`Variant`] and the data specific to it, i.e. fields. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum VariantKind { /// A variant with no parentheses @@ -866,6 +1026,8 @@ pub enum VariantKind { /// The value that distinguishes a variant in an [`Enum`] from other variants. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Discriminant { /// The expression that produced the discriminant. /// @@ -884,6 +1046,8 @@ pub struct Discriminant { /// A set of fundamental properties of a function. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct FunctionHeader { /// Is this function marked as `const`? pub is_const: bool, @@ -904,6 +1068,8 @@ pub struct FunctionHeader { /// See the [Rustonomicon section](https://doc.rust-lang.org/nightly/nomicon/ffi.html#ffi-and-unwinding) /// on unwinding for more info. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub enum Abi { // We only have a concrete listing here for stable ABI's because there are so many // See rustc_ast_passes::feature_gate::PostExpansionVisitor::check_abi for the list @@ -931,6 +1097,8 @@ pub enum Abi { /// A function declaration (including methods and other associated functions). #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Function { /// Information about the function signature, or declaration. pub sig: FunctionSignature, @@ -944,6 +1112,8 @@ pub struct Function { /// Generic parameters accepted by an item and `where` clauses imposed on it and the parameters. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Generics { /// A list of generic parameter definitions (e.g. ``). pub params: Vec, @@ -953,6 +1123,8 @@ pub struct Generics { /// One generic parameter accepted by an item. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct GenericParamDef { /// Name of the parameter. /// ```rust @@ -967,6 +1139,18 @@ pub struct GenericParamDef { /// The kind of a [`GenericParamDef`]. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(serialize_bounds( + __S: rkyv::ser::Writer + rkyv::ser::Allocator, + __S::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(deserialize_bounds( + __D::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(bytecheck(bounds( + __C: rkyv::validation::ArchiveContext, +))))] #[serde(rename_all = "snake_case")] pub enum GenericParamDefKind { /// Denotes a lifetime parameter. @@ -989,6 +1173,7 @@ pub enum GenericParamDefKind { /// fn default2() -> [T; 2] where T: Clone { todo!() } /// // ^^^^^^^ /// ``` + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] bounds: Vec, /// The default type for this parameter, if provided, e.g. /// @@ -996,6 +1181,7 @@ pub enum GenericParamDefKind { /// trait PartialEq {} /// // ^^^^ /// ``` + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] default: Option, /// This is normally `false`, which means that this generic parameter is /// declared in the Rust source text. @@ -1027,6 +1213,7 @@ pub enum GenericParamDefKind { Const { /// The type of the constant as declared. #[serde(rename = "type")] + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] type_: Type, /// The stringified expression for the default value, if provided. It's not guaranteed that /// it'll match the actual source code for the default value. @@ -1040,6 +1227,8 @@ pub enum GenericParamDefKind { /// // ^^^^^^^^^^ /// ``` #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum WherePredicate { /// A type is expected to comply with a set of bounds @@ -1086,6 +1275,8 @@ pub enum WherePredicate { /// Either a trait bound or a lifetime bound. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum GenericBound { /// A trait bound. @@ -1116,6 +1307,8 @@ pub enum GenericBound { /// A set of modifiers applied to a trait. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum TraitBoundModifier { /// Marks the absence of a modifier. @@ -1131,6 +1324,8 @@ pub enum TraitBoundModifier { /// One precise capturing argument. See [the rust reference](https://doc.rust-lang.org/reference/types/impl-trait.html#precise-capturing). #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum PreciseCapturingArg { /// A lifetime. @@ -1148,6 +1343,8 @@ pub enum PreciseCapturingArg { /// Either a type or a constant, usually stored as the right-hand side of an equation in places like /// [`AssocItemConstraint`] #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum Term { /// A type. @@ -1172,6 +1369,18 @@ pub enum Term { /// A type. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(serialize_bounds( + __S: rkyv::ser::Writer + rkyv::ser::Allocator, + __S::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(deserialize_bounds( + __D::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(bytecheck(bounds( + __C: rkyv::validation::ArchiveContext, +))))] #[serde(rename_all = "snake_case")] pub enum Type { /// Structs, enums, unions and type aliases, e.g. `std::option::Option` @@ -1183,15 +1392,16 @@ pub enum Type { /// Built-in numeric types (e.g. `u32`, `f32`), `bool`, `char`. Primitive(String), /// A function pointer type, e.g. `fn(u32) -> u32`, `extern "C" fn() -> *const u8` - FunctionPointer(Box), + FunctionPointer(#[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] Box), /// A tuple type, e.g. `(String, u32, Box)` - Tuple(Vec), + Tuple(#[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] Vec), /// An unsized slice type, e.g. `[u32]`. - Slice(Box), + Slice(#[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] Box), /// An array type, e.g. `[u32; 15]` Array { /// The type of the contained element. #[serde(rename = "type")] + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] type_: Box, /// The stringified expression that is the length of the array. /// @@ -1204,6 +1414,7 @@ pub enum Type { Pat { /// The base type, e.g. the `u32` in `u32 is 1..` #[serde(rename = "type")] + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] type_: Box, #[doc(hidden)] __pat_unstable_do_not_use: String, @@ -1218,6 +1429,7 @@ pub enum Type { is_mutable: bool, /// The type of the pointee. #[serde(rename = "type")] + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] type_: Box, }, /// `&'a mut String`, `&str`, etc. @@ -1228,6 +1440,7 @@ pub enum Type { is_mutable: bool, /// The type of the pointee, e.g. the `i32` in `&'a mut i32` #[serde(rename = "type")] + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] type_: Box, }, /// Associated types like `::Name` and `T::Item` where @@ -1246,6 +1459,7 @@ pub enum Type { /// as BetterIterator>::Item<'static> /// // ^^^^^^^^^ /// ``` + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] args: Option>, /// The type with which this type is associated. /// @@ -1253,6 +1467,7 @@ pub enum Type { /// as Iterator>::Item /// // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /// ``` + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] self_type: Box, /// `None` iff this is an *inherent* associated type. #[serde(rename = "trait")] @@ -1262,6 +1477,19 @@ pub enum Type { /// A type that has a simple path to it. This is the kind of type of structs, unions, enums, etc. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(serialize_bounds( + __S: rkyv::ser::Writer + rkyv::ser::Allocator, + __S::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(deserialize_bounds( + __D::Error: rkyv::rancor::Source, +)))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(bytecheck(bounds( + __C: rkyv::validation::ArchiveContext, + <__C as rkyv::rancor::Fallible>::Error: rkyv::rancor::Source, +))))] pub struct Path { /// The path of the type. /// @@ -1285,11 +1513,14 @@ pub struct Path { /// std::borrow::Cow<'static, str> /// // ^^^^^^^^^^^^^^ /// ``` + #[cfg_attr(feature = "rkyv_0_8", rkyv(omit_bounds))] pub args: Option>, } /// A type that is a function pointer. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct FunctionPointer { /// The signature of the function. pub sig: FunctionSignature, @@ -1306,6 +1537,8 @@ pub struct FunctionPointer { /// The signature of a function. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct FunctionSignature { /// List of argument names and their type. /// @@ -1324,6 +1557,8 @@ pub struct FunctionSignature { /// A `trait` declaration. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Trait { /// Whether the trait is marked `auto` and is thus implemented automatically /// for all applicable types. @@ -1348,6 +1583,8 @@ pub struct Trait { /// /// See [the tracking issue](https://github.com/rust-lang/rust/issues/41517) #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct TraitAlias { /// Information about the type parameters and `where` clauses of the alias. pub generics: Generics, @@ -1357,6 +1594,8 @@ pub struct TraitAlias { /// An `impl` block. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Impl { /// Whether this impl is for an unsafe trait. pub is_unsafe: bool, @@ -1395,6 +1634,8 @@ pub struct Impl { /// A `use` statement. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub struct Use { /// The full path being imported. @@ -1413,6 +1654,8 @@ pub struct Use { /// A procedural macro. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct ProcMacro { /// How this macro is supposed to be called: `foo!()`, `#[foo]` or `#[derive(foo)]` pub kind: MacroKind, @@ -1436,6 +1679,8 @@ pub struct ProcMacro { /// The way a [`ProcMacro`] is declared to be used. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] #[serde(rename_all = "snake_case")] pub enum MacroKind { /// A bang macro `foo!()`. @@ -1448,6 +1693,8 @@ pub enum MacroKind { /// A type alias declaration, e.g. `type Pig = std::borrow::Cow<'static, str>;` #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct TypeAlias { /// The type referred to by this alias. #[serde(rename = "type")] @@ -1458,6 +1705,8 @@ pub struct TypeAlias { /// A `static` declaration. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Static { /// The type of the static. #[serde(rename = "type")] @@ -1488,6 +1737,8 @@ pub struct Static { /// A primitive type declaration. Declarations of this kind can only come from the core library. #[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[cfg_attr(feature = "rkyv_0_8", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize))] +#[cfg_attr(feature = "rkyv_0_8", rkyv(derive(Debug)))] pub struct Primitive { /// The name of the type. pub name: String, diff --git a/src/rustdoc-json-types/tests.rs b/src/rustdoc-json-types/tests.rs index b9363fcf1b714..e878350e43b9b 100644 --- a/src/rustdoc-json-types/tests.rs +++ b/src/rustdoc-json-types/tests.rs @@ -38,3 +38,118 @@ fn test_union_info_roundtrip() { let decoded: ItemEnum = bincode::deserialize(&encoded).unwrap(); assert_eq!(u, decoded); } + +#[cfg(feature = "rkyv_0_8")] +mod rkyv { + use std::fmt::Debug; + + use rkyv::Archive; + use rkyv::api::high::{HighDeserializer, HighSerializer}; + use rkyv::bytecheck::CheckBytes; + use rkyv::rancor::Strategy; + use rkyv::ser::allocator::ArenaHandle; + use rkyv::util::AlignedVec; + use rkyv::validation::Validator; + use rkyv::validation::archive::ArchiveValidator; + use rkyv::validation::shared::SharedValidator; + + use crate::*; + + #[test] + /// A test to exercise the (de)serialization roundtrip for a representative selection of types, + /// covering most of the rkyv-specific attributes we had to had. + fn test_rkyv_roundtrip() { + // Standard derives: a plain struct and union, mirroring the existing serde/bincode tests. + let s = ItemEnum::Struct(Struct { + generics: Generics { params: vec![], where_predicates: vec![] }, + kind: StructKind::Plain { fields: vec![Id(1), Id(2)], has_stripped_fields: false }, + impls: vec![Id(3)], + }); + rkyv_roundtrip(&s); + + let u = ItemEnum::Union(Union { + generics: Generics { params: vec![], where_predicates: vec![] }, + has_stripped_fields: false, + fields: vec![Id(1)], + impls: vec![], + }); + rkyv_roundtrip(&u); + + // Extra trait derives, via rkyv(derive(PartialEq, Eq, PartialOrd, Ord, Hash)), on the archived type. + rkyv_roundtrip(&Id(99)); + + // Recursive cycle-breaking: `BorrowedRef` has omit_bounds on its `Box` field. + let ty = Type::BorrowedRef { + lifetime: Some("'a".to_string()), + is_mutable: false, + type_: Box::new(Type::Primitive("str".to_string())), + }; + rkyv_roundtrip(&ty); + + // `Slice` and `Tuple` are tuple-variant fields with omit_bounds on the unnamed field, + // which required special syntax (attribute inside the parentheses) to compile. + let ty = Type::Slice(Box::new(Type::Tuple(vec![ + Type::Primitive("u32".to_string()), + Type::Generic("T".to_string()), + ]))); + rkyv_roundtrip(&ty); + + // `Path` has serialize_bounds/deserialize_bounds and omit_bounds on its `args` field. + // `GenericArgs::AngleBracketed` exercises the full recursive chain: `Path` -> `GenericArgs` -> `GenericArg` -> `Type`. + let path = Path { + path: "std::option::Option".to_string(), + id: Id(42), + args: Some(Box::new(GenericArgs::AngleBracketed { + args: vec![GenericArg::Type(Type::Primitive("u32".to_string()))], + constraints: vec![], + })), + }; + rkyv_roundtrip(&path); + + // `FunctionPointer` is a `Box` behind `omit_bounds` in `Type`. + // It transitively contains `Type` via `FunctionSignature`, exercising the cycle from the other direction. + let fp = Type::FunctionPointer(Box::new(FunctionPointer { + sig: FunctionSignature { + inputs: vec![("x".to_string(), Type::Primitive("i32".to_string()))], + output: Some(Type::Primitive("bool".to_string())), + is_c_variadic: false, + }, + generic_params: vec![], + header: FunctionHeader { + is_const: false, + is_unsafe: false, + is_async: false, + abi: Abi::Rust, + }, + })); + rkyv_roundtrip(&fp); + } + + /// A helper function for roundtrip testing of rkyv-powered deserialization. + fn rkyv_roundtrip(value: &T) + where + T: PartialEq + + Debug + + Archive + + for<'a> rkyv::Serialize< + HighSerializer, rkyv::rancor::Error>, + >, + T::Archived: rkyv::Deserialize> + + Debug + + for<'a> CheckBytes< + Strategy, SharedValidator>, rkyv::rancor::Error>, + >, + { + let bytes = + rkyv::api::high::to_bytes_in::<_, rkyv::rancor::Error>(value, AlignedVec::new()) + .unwrap(); + let archived = rkyv::api::high::access::(&bytes) + .expect("Failed to access archived data"); + let deserialized: T = rkyv::api::deserialize_using::<_, _, rkyv::rancor::Error>( + archived, + &mut rkyv::de::Pool::new(), + ) + .unwrap(); + assert_eq!(value, &deserialized); + } +} 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/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" 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)] diff --git a/triagebot.toml b/triagebot.toml index f2bfa0084d878..a3a5928a8f366 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