From a4c76309a321ef84ed8601c66cd75f3f83a268a0 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 1 Oct 2024 08:59:21 +0900 Subject: [PATCH 1/2] Use `std::cell::sync::LazyCell` --- macro/Cargo.toml | 1 - macro/src/utility.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/macro/Cargo.toml b/macro/Cargo.toml index c282b1931a..24f7345ce3 100644 --- a/macro/Cargo.toml +++ b/macro/Cargo.toml @@ -15,7 +15,6 @@ proc-macro = true [dependencies] comrak = { version = "0.28.0", default-features = false } convert_case = "0.6.0" -once_cell = "1.20.1" proc-macro2 = "1" quote = "1" regex = "1.11.0" diff --git a/macro/src/utility.rs b/macro/src/utility.rs index 3fd1431fff..d780fe7031 100644 --- a/macro/src/utility.rs +++ b/macro/src/utility.rs @@ -1,7 +1,7 @@ -use once_cell::sync::Lazy; use regex::{Captures, Regex}; +use std::cell::LazyCell; -static NAME_PATTERN: Lazy = Lazy::new(|| { +static NAME_PATTERN: LazyCell = LazyCell::new(|| { Regex::new(r#"(bf_16|f_16|f_32|f_64|i_8|i_16|i_32|i_64|float_8_e_[0-9]_m_[0-9](_fn)?)"#) .unwrap() }); From 89a1af18164a8d3eb3da91f0330f74be2b9e06d7 Mon Sep 17 00:00:00 2001 From: Yota Toyama Date: Tue, 1 Oct 2024 09:18:27 +0900 Subject: [PATCH 2/2] Fix --- Cargo.lock | 79 ------------------------ macro/src/dialect/operation/attribute.rs | 4 +- macro/src/utility.rs | 4 +- melior/Cargo.toml | 2 - 4 files changed, 4 insertions(+), 85 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a21660332..14262d2905 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,12 +11,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - [[package]] name = "bindgen" version = "0.69.4" @@ -152,12 +146,6 @@ dependencies = [ "unicode-segmentation", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - [[package]] name = "darling" version = "0.20.9" @@ -193,20 +181,6 @@ dependencies = [ "syn", ] -[[package]] -name = "dashmap" -version = "6.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" -dependencies = [ - "cfg-if", - "crossbeam-utils", - "hashbrown", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "derive_builder" version = "0.20.0" @@ -290,12 +264,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - [[package]] name = "home" version = "0.5.9" @@ -378,16 +346,6 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.21" @@ -398,12 +356,10 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" name = "melior" version = "0.19.0" dependencies = [ - "dashmap", "indoc", "insta", "melior-macro", "mlir-sys", - "once_cell", "pretty_assertions", ] @@ -415,7 +371,6 @@ dependencies = [ "convert_case", "melior", "mlir-sys", - "once_cell", "pretty_assertions", "proc-macro2", "quote", @@ -465,19 +420,6 @@ dependencies = [ "portable-atomic", ] -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - [[package]] name = "paste" version = "1.0.15" @@ -528,15 +470,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "redox_syscall" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" version = "1.11.0" @@ -585,12 +518,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - [[package]] name = "shlex" version = "1.3.0" @@ -613,12 +540,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - [[package]] name = "strsim" version = "0.11.1" diff --git a/macro/src/dialect/operation/attribute.rs b/macro/src/dialect/operation/attribute.rs index 9da7bcf32d..3cdf5fe966 100644 --- a/macro/src/dialect/operation/attribute.rs +++ b/macro/src/dialect/operation/attribute.rs @@ -3,10 +3,10 @@ use crate::dialect::{ operation::operation_field::OperationField, utility::{generate_result_type, sanitize_snake_case_identifier}, }; -use once_cell::sync::Lazy; use proc_macro2::{Span, TokenStream}; use quote::quote; use std::collections::HashMap; +use std::sync::LazyLock; use syn::{parse_quote, Ident, Type}; use tblgen::{error::TableGenError, Record}; @@ -28,7 +28,7 @@ macro_rules! melior_attribute { }; } -static ATTRIBUTE_TYPES: Lazy> = Lazy::new(|| { +static ATTRIBUTE_TYPES: LazyLock> = LazyLock::new(|| { let mut map = HashMap::new(); macro_rules! initialize_attributes { diff --git a/macro/src/utility.rs b/macro/src/utility.rs index d780fe7031..7c68cd4fa4 100644 --- a/macro/src/utility.rs +++ b/macro/src/utility.rs @@ -1,7 +1,7 @@ use regex::{Captures, Regex}; -use std::cell::LazyCell; +use std::sync::LazyLock; -static NAME_PATTERN: LazyCell = LazyCell::new(|| { +static NAME_PATTERN: LazyLock = LazyLock::new(|| { Regex::new(r#"(bf_16|f_16|f_32|f_64|i_8|i_16|i_32|i_64|float_8_e_[0-9]_m_[0-9](_fn)?)"#) .unwrap() }); diff --git a/melior/Cargo.toml b/melior/Cargo.toml index dd8853bafd..69f81754e6 100644 --- a/melior/Cargo.toml +++ b/melior/Cargo.toml @@ -12,10 +12,8 @@ keywords = ["mlir", "llvm"] ods-dialects = [] [dependencies] -dashmap = "6.1.0" melior-macro = { version = "0.12.0", path = "../macro" } mlir-sys = "0.3.0" -once_cell = "1" [dev-dependencies] indoc = "2.0.5"