diff options
| author | bors <bors@rust-lang.org> | 2025-07-22 15:25:31 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-22 15:25:31 +0000 |
| commit | 2e5367566819ca7878baa9600ae7a93eb0e37bbf (patch) | |
| tree | 6b65029625eb4b6e726b826197e617728788430e /library/stdarch/crates/stdarch-gen-arm/src | |
| parent | 35487a2e7c80012129c38f55c970109a1538c91f (diff) | |
| parent | 9b7d31c851cabc2e6e541d3cf146787d597a9166 (diff) | |
| download | rust-2e5367566819ca7878baa9600ae7a93eb0e37bbf.tar.gz rust-2e5367566819ca7878baa9600ae7a93eb0e37bbf.zip | |
Auto merge of #144222 - Kobzol:stdarch-push, r=folkertdev
stdarch subtree update Subtree update of `stdarch` to https://github.com/rust-lang/stdarch/commit/5531955678494ee28ec02130a6d94082ad4532da. Created using https://github.com/rust-lang/josh-sync. I saw that there were non-trivial changes made to `std_detect` in `stdarch` recently. So I want to get them merged here before we move forward with https://github.com/rust-lang/rust/pull/143412. r? `@folkertdev`
Diffstat (limited to 'library/stdarch/crates/stdarch-gen-arm/src')
4 files changed, 21 insertions, 29 deletions
diff --git a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs index 56c94602fff..d5644ef27d4 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/expression.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/expression.rs @@ -1,5 +1,4 @@ use itertools::Itertools; -use lazy_static::lazy_static; use proc_macro2::{Literal, Punct, Spacing, TokenStream}; use quote::{ToTokens, TokenStreamExt, format_ident, quote}; use regex::Regex; @@ -7,6 +6,7 @@ use serde::de::{self, MapAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; use std::fmt; use std::str::FromStr; +use std::sync::LazyLock; use crate::intrinsic::Intrinsic; use crate::wildstring::WildStringPart; @@ -374,10 +374,8 @@ impl FromStr for Expression { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { - lazy_static! { - static ref MACRO_RE: Regex = - Regex::new(r"^(?P<name>[\w\d_]+)!\((?P<ex>.*?)\);?$").unwrap(); - } + static MACRO_RE: LazyLock<Regex> = + LazyLock::new(|| Regex::new(r"^(?P<name>[\w\d_]+)!\((?P<ex>.*?)\);?$").unwrap()); if s == "SvUndef" { Ok(Expression::SvUndef) diff --git a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs index 5cf39b2e11a..3f3bfed132c 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/load_store_tests.rs @@ -2,6 +2,7 @@ use std::fs::File; use std::io::Write; use std::path::PathBuf; use std::str::FromStr; +use std::sync::LazyLock; use crate::format_code; use crate::input::InputType; @@ -10,7 +11,6 @@ use crate::typekinds::BaseType; use crate::typekinds::{ToRepr, TypeKind}; use itertools::Itertools; -use lazy_static::lazy_static; use proc_macro2::TokenStream; use quote::{format_ident, quote}; @@ -639,8 +639,8 @@ impl LdIntrCharacteristics { } } -lazy_static! { - static ref PREAMBLE: String = format!( +static PREAMBLE: LazyLock<String> = LazyLock::new(|| { + format!( r#"#![allow(unused)] use super::*; @@ -801,13 +801,11 @@ fn assert_vector_matches_u64(vector: svuint64_t, expected: svuint64_t) {{ assert!(!svptest_any(defined, cmp)) }} "# - ); -} + ) +}); -lazy_static! { - static ref MANUAL_TESTS: String = format!( - "#[simd_test(enable = \"sve\")] -unsafe fn test_ffr() {{ +const MANUAL_TESTS: &str = "#[simd_test(enable = \"sve\")] +unsafe fn test_ffr() { svsetffr(); let ffr = svrdffr(); assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svindex_u8(1, 0)); @@ -816,7 +814,5 @@ unsafe fn test_ffr() {{ svwrffr(pred); let ffr = svrdffr_z(svptrue_b8()); assert_vector_matches_u8(svdup_n_u8_z(ffr, 1), svdup_n_u8_z(pred, 1)); -}} -" - ); } +"; diff --git a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs index 7c697cb7c0c..bd47ff2bd15 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/typekinds.rs @@ -1,10 +1,10 @@ -use lazy_static::lazy_static; use proc_macro2::TokenStream; use quote::{ToTokens, TokenStreamExt, quote}; use regex::Regex; use serde_with::{DeserializeFromStr, SerializeDisplay}; use std::fmt; use std::str::FromStr; +use std::sync::LazyLock; use crate::context; use crate::expression::{Expression, FnCall}; @@ -496,9 +496,9 @@ impl FromStr for VectorType { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?:(?:sv(?P<sv_ty>(?:uint|int|bool|float)(?:\d+)?))|(?:(?P<ty>(?:uint|int|bool|poly|float)(?:\d+)?)x(?P<lanes>(?:\d+)?)))(?:x(?P<tuple_size>2|3|4))?_t$").unwrap(); - } + static RE: LazyLock<Regex> = LazyLock::new(|| { + Regex::new(r"^(?:(?:sv(?P<sv_ty>(?:uint|int|bool|float)(?:\d+)?))|(?:(?P<ty>(?:uint|int|bool|poly|float)(?:\d+)?)x(?P<lanes>(?:\d+)?)))(?:x(?P<tuple_size>2|3|4))?_t$").unwrap() + }); if let Some(c) = RE.captures(s) { let (base_type, lanes) = Self::sanitise_lanes( @@ -698,9 +698,8 @@ impl FromStr for BaseType { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?P<kind>[a-zA-Z]+)(?P<size>\d+)?(_t)?$").unwrap(); - } + static RE: LazyLock<Regex> = + LazyLock::new(|| Regex::new(r"^(?P<kind>[a-zA-Z]+)(?P<size>\d+)?(_t)?$").unwrap()); if let Some(c) = RE.captures(s) { let kind = c["kind"].parse()?; diff --git a/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs b/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs index 25aa8034892..6c40d88df45 100644 --- a/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs +++ b/library/stdarch/crates/stdarch-gen-arm/src/wildcards.rs @@ -1,8 +1,7 @@ -use lazy_static::lazy_static; use regex::Regex; use serde_with::{DeserializeFromStr, SerializeDisplay}; -use std::fmt; use std::str::FromStr; +use std::{fmt, sync::LazyLock}; use crate::{ fn_suffix::SuffixKind, @@ -66,9 +65,9 @@ impl FromStr for Wildcard { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { - lazy_static! { - static ref RE: Regex = Regex::new(r"^(?P<wildcard>\w+?)(?:_x(?P<tuple_size>[2-4]))?(?:\[(?P<index>\d+)\])?(?:\.(?P<modifiers>\w+))?(?:\s+as\s+(?P<scale_to>.*?))?$").unwrap(); - } + static RE: LazyLock<Regex> = LazyLock::new(|| { + Regex::new(r"^(?P<wildcard>\w+?)(?:_x(?P<tuple_size>[2-4]))?(?:\[(?P<index>\d+)\])?(?:\.(?P<modifiers>\w+))?(?:\s+as\s+(?P<scale_to>.*?))?$").unwrap() + }); if let Some(c) = RE.captures(s) { let wildcard_name = &c["wildcard"]; |
