From 67e66ac3bdf013512e57009552a233f9d5805e48 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 24 Aug 2025 15:13:16 -0700 Subject: [PATCH 1/5] upgrade to rust 1.89.0 --- .forgejo/workflows/test.yml | 2 +- Cargo.toml | 2 +- crates/fayalite/src/sim.rs | 3 +- .../ui/simvalue_is_not_internable.stderr | 40 +++++++++++-------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index b2d03ba..b0c4a59 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -38,7 +38,7 @@ jobs: z3 \ zlib1g-dev - run: | - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.82.0 + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89.0 source "$HOME/.cargo/env" echo "$PATH" >> "$GITHUB_PATH" - uses: https://git.libre-chip.org/mirrors/cache/restore@v3 diff --git a/Cargo.toml b/Cargo.toml index d681425..03c77ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" repository = "https://git.libre-chip.org/libre-chip/fayalite" keywords = ["hdl", "hardware", "semiconductors", "firrtl", "fpga"] categories = ["simulation", "development-tools", "compilers"] -rust-version = "1.82.0" +rust-version = "1.89.0" [workspace.dependencies] fayalite-proc-macros = { version = "=0.3.0", path = "crates/fayalite-proc-macros" } diff --git a/crates/fayalite/src/sim.rs b/crates/fayalite/src/sim.rs index 6659391..10ae16c 100644 --- a/crates/fayalite/src/sim.rs +++ b/crates/fayalite/src/sim.rs @@ -65,6 +65,7 @@ use std::{ mem, ops::IndexMut, pin::Pin, + ptr, rc::Rc, sync::Arc, task::Poll, @@ -7736,7 +7737,7 @@ impl Eq for SimGeneratorFn {} impl PartialEq for SimGeneratorFn { fn eq(&self, other: &Self) -> bool { let Self { args, f } = self; - *args == other.args && *f == other.f + *args == other.args && ptr::fn_addr_eq(*f, other.f) } } diff --git a/crates/fayalite/tests/ui/simvalue_is_not_internable.stderr b/crates/fayalite/tests/ui/simvalue_is_not_internable.stderr index eb8877b..6550b5f 100644 --- a/crates/fayalite/tests/ui/simvalue_is_not_internable.stderr +++ b/crates/fayalite/tests/ui/simvalue_is_not_internable.stderr @@ -4,7 +4,7 @@ error[E0277]: `Cell` cannot be shared between thr 11 | fn f(v: SimValue<()>) -> Interned> { | ^^^^^^^^^^^^^^^^^^^^^^ `Cell` cannot be shared between threads safely | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs @@ -28,7 +28,7 @@ error[E0277]: `UnsafeCell>` cannot be shared between th 11 | fn f(v: SimValue<()>) -> Interned> { | ^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell>` cannot be shared between threads safely | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs | @@ -49,29 +49,29 @@ error[E0277]: the trait bound `SimValue<()>: Intern` is not satisfied --> tests/ui/simvalue_is_not_internable.rs:12:26 | 12 | Intern::intern_sized(v) - | -------------------- ^ the trait `Hash` is not implemented for `SimValue<()>`, which is required by `SimValue<()>: Intern` + | -------------------- ^ the trait `Hash` is not implemented for `SimValue<()>` | | | required by a bound introduced by this call | - = help: the following other types implement trait `Intern`: - BitSlice - [T] - str = note: required for `SimValue<()>` to implement `Intern` +help: consider dereferencing here + | +12 | Intern::intern_sized(*v) + | + error[E0277]: the trait bound `SimValue<()>: Intern` is not satisfied --> tests/ui/simvalue_is_not_internable.rs:12:26 | 12 | Intern::intern_sized(v) - | -------------------- ^ the trait `std::cmp::Eq` is not implemented for `SimValue<()>`, which is required by `SimValue<()>: Intern` + | -------------------- ^ the trait `std::cmp::Eq` is not implemented for `SimValue<()>` | | | required by a bound introduced by this call | - = help: the following other types implement trait `Intern`: - BitSlice - [T] - str = note: required for `SimValue<()>` to implement `Intern` +help: consider dereferencing here + | +12 | Intern::intern_sized(*v) + | + error[E0277]: `Cell` cannot be shared between threads safely --> tests/ui/simvalue_is_not_internable.rs:12:26 @@ -81,7 +81,7 @@ error[E0277]: `Cell` cannot be shared between thr | | | required by a bound introduced by this call | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs @@ -101,6 +101,10 @@ note: required by a bound in `intern_sized` | fn intern(&self) -> Interned; | fn intern_sized(self) -> Interned | ------------ required by a bound in this associated function +help: consider dereferencing here + | +12 | Intern::intern_sized(*v) + | + error[E0277]: `UnsafeCell>` cannot be shared between threads safely --> tests/ui/simvalue_is_not_internable.rs:12:26 @@ -110,7 +114,7 @@ error[E0277]: `UnsafeCell>` cannot be shared between th | | | required by a bound introduced by this call | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs | @@ -129,6 +133,10 @@ note: required by a bound in `intern_sized` | fn intern(&self) -> Interned; | fn intern_sized(self) -> Interned | ------------ required by a bound in this associated function +help: consider dereferencing here + | +12 | Intern::intern_sized(*v) + | + error[E0277]: `Cell` cannot be shared between threads safely --> tests/ui/simvalue_is_not_internable.rs:12:5 @@ -136,7 +144,7 @@ error[E0277]: `Cell` cannot be shared between thr 12 | Intern::intern_sized(v) | ^^^^^^^^^^^^^^^^^^^^^^^ `Cell` cannot be shared between threads safely | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `Cell` = note: if you want to do aliasing and mutation between multiple threads, use `std::sync::RwLock` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs @@ -160,7 +168,7 @@ error[E0277]: `UnsafeCell>` cannot be shared between th 12 | Intern::intern_sized(v) | ^^^^^^^^^^^^^^^^^^^^^^^ `UnsafeCell>` cannot be shared between threads safely | - = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>`, which is required by `SimValue<()>: Sync` + = help: within `SimValue<()>`, the trait `Sync` is not implemented for `UnsafeCell>` note: required because it appears within the type `util::alternating_cell::AlternatingCell>` --> src/util/alternating_cell.rs | -- 2.47.3 From 65f9ab32f4d911d641d47511f41ef43f4e0afaa1 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 24 Aug 2025 15:36:50 -0700 Subject: [PATCH 2/5] switch to edition 2024 --- Cargo.toml | 2 +- .../src/hdl_type_common.rs | 29 +++++++++++++------ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 03c77ad..5a792c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ members = ["crates/*"] [workspace.package] version = "0.3.0" license = "LGPL-3.0-or-later" -edition = "2021" +edition = "2024" repository = "https://git.libre-chip.org/libre-chip/fayalite" keywords = ["hdl", "hardware", "semiconductors", "firrtl", "fpga"] categories = ["simulation", "development-tools", "compilers"] diff --git a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs index 2da0915..3efa555 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs @@ -3761,7 +3761,10 @@ pub(crate) trait AsTurbofish { } impl AsTurbofish for TypeGenerics<'_> { - type Turbofish<'a> = Turbofish<'a> where Self: 'a; + type Turbofish<'a> + = Turbofish<'a> + where + Self: 'a; fn as_turbofish(&self) -> Self::Turbofish<'_> { TypeGenerics::as_turbofish(self) @@ -3769,7 +3772,8 @@ impl AsTurbofish for TypeGenerics<'_> { } impl AsTurbofish for ParsedGenericsTypeGenerics<'_> { - type Turbofish<'a> = ParsedGenericsTurbofish<'a> + type Turbofish<'a> + = ParsedGenericsTurbofish<'a> where Self: 'a; @@ -3820,15 +3824,18 @@ impl SplitForImpl for Generics { } impl SplitForImpl for ParsedGenerics { - type ImplGenerics<'a> = ParsedGenericsImplGenerics<'a> + type ImplGenerics<'a> + = ParsedGenericsImplGenerics<'a> where Self: 'a; - type TypeGenerics<'a> = ParsedGenericsTypeGenerics<'a> + type TypeGenerics<'a> + = ParsedGenericsTypeGenerics<'a> where Self: 'a; - type WhereClause<'a> = ParsedGenericsWhereClause<'a> + type WhereClause<'a> + = ParsedGenericsWhereClause<'a> where Self: 'a; @@ -4045,7 +4052,8 @@ impl ToTokens for MaybeParsed { } impl AsTurbofish for MaybeParsed { - type Turbofish<'a> = MaybeParsed, U::Turbofish<'a>> + type Turbofish<'a> + = MaybeParsed, U::Turbofish<'a>> where Self: 'a; @@ -4058,13 +4066,16 @@ impl AsTurbofish for MaybeParsed { } impl SplitForImpl for MaybeParsed { - type ImplGenerics<'a> = MaybeParsed, U::ImplGenerics<'a>> + type ImplGenerics<'a> + = MaybeParsed, U::ImplGenerics<'a>> where Self: 'a; - type TypeGenerics<'a> = MaybeParsed, U::TypeGenerics<'a>> + type TypeGenerics<'a> + = MaybeParsed, U::TypeGenerics<'a>> where Self: 'a; - type WhereClause<'a> = MaybeParsed, U::WhereClause<'a>> + type WhereClause<'a> + = MaybeParsed, U::WhereClause<'a>> where Self: 'a; -- 2.47.3 From ae7c4be9dca6687c564539a0d3f623a59a020a3a Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 24 Aug 2025 15:52:36 -0700 Subject: [PATCH 3/5] remove get_many_mut since it was stabilized in std as get_disjoint_mut --- crates/fayalite/src/sim/interpreter.rs | 30 +++++++++++++------------- crates/fayalite/src/util.rs | 4 ++-- crates/fayalite/src/util/misc.rs | 16 -------------- 3 files changed, 17 insertions(+), 33 deletions(-) diff --git a/crates/fayalite/src/sim/interpreter.rs b/crates/fayalite/src/sim/interpreter.rs index de582f0..35a25d0 100644 --- a/crates/fayalite/src/sim/interpreter.rs +++ b/crates/fayalite/src/sim/interpreter.rs @@ -7,7 +7,7 @@ use crate::{ intern::{Intern, Interned, Memoize}, source_location::SourceLocation, ty::CanonicalType, - util::{get_many_mut, HashMap, HashSet}, + util::{HashMap, HashSet}, }; use bitvec::{boxed::BitBox, slice::BitSlice}; use num_bigint::BigInt; @@ -2073,21 +2073,21 @@ pub(crate) struct BorrowedStatePart<'a, K: StatePartKind> { } impl< - 'a, - K: StatePartKind< - BorrowedState<'a>: DerefMut + BorrowMut<[T]>>, - >, - T, - > BorrowedStatePart<'a, K> + 'a, + K: StatePartKind< + BorrowedState<'a>: DerefMut + BorrowMut<[T]>>, + >, + T, +> BorrowedStatePart<'a, K> { - pub(crate) fn get_many_mut( + pub(crate) fn get_disjoint_mut( &mut self, indexes: [StatePartIndex; N], ) -> [&mut T; N] { - get_many_mut( - (*self.value).borrow_mut(), - indexes.map(|v| v.value as usize), - ) + (*self.value) + .borrow_mut() + .get_disjoint_mut(indexes.map(|v| v.value as usize)) + .expect("indexes are disjoint") } } @@ -2568,7 +2568,7 @@ impl_insns! { src: StatePartIndex, } => { if dest != src { - let [dest, src] = state.big_slots.get_many_mut([dest, src]); + let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]); dest.clone_from(src); } next!(); @@ -2590,7 +2590,7 @@ impl_insns! { } => { if let Some(src) = state.eval_array_indexed(src) { if dest != src { - let [dest, src] = state.big_slots.get_many_mut([dest, src]); + let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]); dest.clone_from(src); } } else { @@ -2619,7 +2619,7 @@ impl_insns! { } => { if let Some(dest) = state.eval_array_indexed(dest) { if dest != src { - let [dest, src] = state.big_slots.get_many_mut([dest, src]); + let [dest, src] = state.big_slots.get_disjoint_mut([dest, src]); dest.clone_from(src); } } diff --git a/crates/fayalite/src/util.rs b/crates/fayalite/src/util.rs index 233867e..4670a1f 100644 --- a/crates/fayalite/src/util.rs +++ b/crates/fayalite/src/util.rs @@ -35,8 +35,8 @@ pub use scoped_ref::ScopedRef; #[doc(inline)] pub use misc::{ - get_many_mut, interned_bit, iter_eq_by, BitSliceWriteWithBase, DebugAsDisplay, - DebugAsRawString, MakeMutSlice, RcWriter, + BitSliceWriteWithBase, DebugAsDisplay, DebugAsRawString, MakeMutSlice, RcWriter, interned_bit, + iter_eq_by, }; pub mod job_server; diff --git a/crates/fayalite/src/util/misc.rs b/crates/fayalite/src/util/misc.rs index f482eaa..99b7343 100644 --- a/crates/fayalite/src/util/misc.rs +++ b/crates/fayalite/src/util/misc.rs @@ -163,22 +163,6 @@ impl fmt::UpperHex for BitSliceWriteWithBase<'_> { } } -#[inline] -#[track_caller] -pub fn get_many_mut(slice: &mut [T], indexes: [usize; N]) -> [&mut T; N] { - for i in 0..N { - for j in 0..i { - assert!(indexes[i] != indexes[j], "duplicate index"); - } - assert!(indexes[i] < slice.len(), "index out of bounds"); - } - // Safety: checked that no indexes are duplicates and no indexes are out of bounds - unsafe { - let base = slice.as_mut_ptr(); // convert to a raw pointer before loop to avoid aliasing with &mut [T] - std::array::from_fn(|i| &mut *base.add(indexes[i])) - } -} - #[derive(Clone, Default)] pub struct RcWriter(Rc>>); -- 2.47.3 From ef85d11327bb7dba05c82f41dc197f45dbf150a8 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 24 Aug 2025 16:14:03 -0700 Subject: [PATCH 4/5] try to get actions to run --- .forgejo/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.forgejo/workflows/test.yml b/.forgejo/workflows/test.yml index b0c4a59..610f22b 100644 --- a/.forgejo/workflows/test.yml +++ b/.forgejo/workflows/test.yml @@ -4,6 +4,7 @@ on: [push, pull_request] jobs: deps: + runs-on: debian-12 uses: ./.forgejo/workflows/deps.yml test: runs-on: debian-12 -- 2.47.3 From 4008c311bf46f6fe18a32e3d7b6c9375945ed769 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Sun, 24 Aug 2025 16:35:21 -0700 Subject: [PATCH 5/5] format code after switching to edition 2024 --- .../src/hdl_bundle.rs | 15 +++--- .../fayalite-proc-macros-impl/src/hdl_enum.rs | 14 +++--- .../src/hdl_type_alias.rs | 9 ++-- .../src/hdl_type_common.rs | 20 ++++---- crates/fayalite-proc-macros-impl/src/lib.rs | 7 ++- .../fayalite-proc-macros-impl/src/module.rs | 9 ++-- .../src/module/transform_body.rs | 17 +++---- .../expand_aggregate_literals.rs | 11 ++--- .../src/module/transform_body/expand_match.rs | 18 +++---- .../src/process_cfg.rs | 8 ++-- crates/fayalite-visit-gen/src/lib.rs | 2 +- crates/fayalite/src/annotations.rs | 6 +-- crates/fayalite/src/array.rs | 10 ++-- crates/fayalite/src/bundle.rs | 6 +-- crates/fayalite/src/cli.rs | 8 ++-- crates/fayalite/src/clock.rs | 2 +- crates/fayalite/src/enum_.rs | 18 +++---- crates/fayalite/src/expr.rs | 13 +++-- crates/fayalite/src/expr/ops.rs | 4 +- crates/fayalite/src/firrtl.rs | 23 +++++---- crates/fayalite/src/int.rs | 14 ++---- crates/fayalite/src/int/uint_in_range.rs | 48 +++++++++++-------- crates/fayalite/src/memory.rs | 2 +- crates/fayalite/src/module.rs | 20 ++++---- .../src/module/transform/deduce_resets.rs | 16 +++++-- .../src/module/transform/simplify_enums.rs | 6 +-- .../src/module/transform/simplify_memories.rs | 4 +- crates/fayalite/src/module/transform/visit.rs | 3 +- crates/fayalite/src/phantom_const.rs | 7 ++- crates/fayalite/src/prelude.rs | 18 +++---- crates/fayalite/src/reset.rs | 4 +- crates/fayalite/src/sim.rs | 32 +++++++------ crates/fayalite/src/sim/value.rs | 2 +- crates/fayalite/src/sim/vcd.rs | 2 +- crates/fayalite/src/ty.rs | 10 ++-- crates/fayalite/src/util/const_bool.rs | 2 +- crates/fayalite/src/util/const_usize.rs | 2 +- 37 files changed, 213 insertions(+), 199 deletions(-) diff --git a/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs b/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs index 7441cb3..d881ecd 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_bundle.rs @@ -1,21 +1,22 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ + Errors, HdlAttr, PairsIterExt, hdl_type_common::{ - common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField, - ParsedFieldsNamed, ParsedGenerics, SplitForImpl, TypesParser, WrappedInConst, + ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedField, ParsedFieldsNamed, ParsedGenerics, + SplitForImpl, TypesParser, WrappedInConst, common_derives, get_target, }, - kw, Errors, HdlAttr, PairsIterExt, + kw, }; use proc_macro2::TokenStream; -use quote::{format_ident, quote_spanned, ToTokens}; +use quote::{ToTokens, format_ident, quote_spanned}; use syn::{ - parse_quote, parse_quote_spanned, + AngleBracketedGenericArguments, Attribute, Field, FieldMutability, Fields, FieldsNamed, + GenericParam, Generics, Ident, ItemStruct, Path, Token, Type, Visibility, parse_quote, + parse_quote_spanned, punctuated::{Pair, Punctuated}, spanned::Spanned, token::Brace, - AngleBracketedGenericArguments, Attribute, Field, FieldMutability, Fields, FieldsNamed, - GenericParam, Generics, Ident, ItemStruct, Path, Token, Type, Visibility, }; #[derive(Clone, Debug)] diff --git a/crates/fayalite-proc-macros-impl/src/hdl_enum.rs b/crates/fayalite-proc-macros-impl/src/hdl_enum.rs index e072135..a891f5c 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_enum.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_enum.rs @@ -1,20 +1,20 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ + Errors, HdlAttr, PairsIterExt, hdl_type_common::{ - common_derives, get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, - ParsedType, SplitForImpl, TypesParser, WrappedInConst, + ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType, SplitForImpl, + TypesParser, WrappedInConst, common_derives, get_target, }, - kw, Errors, HdlAttr, PairsIterExt, + kw, }; use proc_macro2::TokenStream; -use quote::{format_ident, quote_spanned, ToTokens}; +use quote::{ToTokens, format_ident, quote_spanned}; use syn::{ - parse_quote_spanned, + Attribute, Field, FieldMutability, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, + ItemEnum, ItemStruct, Token, Type, Variant, Visibility, parse_quote_spanned, punctuated::{Pair, Punctuated}, token::{Brace, Paren}, - Attribute, Field, FieldMutability, Fields, FieldsNamed, FieldsUnnamed, Generics, Ident, - ItemEnum, ItemStruct, Token, Type, Variant, Visibility, }; crate::options! { diff --git a/crates/fayalite-proc-macros-impl/src/hdl_type_alias.rs b/crates/fayalite-proc-macros-impl/src/hdl_type_alias.rs index 97501e7..d4a035b 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_type_alias.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_type_alias.rs @@ -1,15 +1,16 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ + Errors, HdlAttr, hdl_type_common::{ - get_target, ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType, - TypesParser, + ItemOptions, MakeHdlTypeExpr, MaybeParsed, ParsedGenerics, ParsedType, TypesParser, + get_target, }, - kw, Errors, HdlAttr, + kw, }; use proc_macro2::TokenStream; use quote::ToTokens; -use syn::{parse_quote_spanned, Attribute, Generics, Ident, ItemType, Token, Type, Visibility}; +use syn::{Attribute, Generics, Ident, ItemType, Token, Type, Visibility, parse_quote_spanned}; #[derive(Clone, Debug)] pub(crate) struct ParsedTypeAlias { diff --git a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs index 3efa555..1206f11 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs @@ -1,21 +1,21 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information -use crate::{fold::impl_fold, kw, Errors, HdlAttr, PairsIterExt}; +use crate::{Errors, HdlAttr, PairsIterExt, fold::impl_fold, kw}; use proc_macro2::{Span, TokenStream}; -use quote::{format_ident, quote_spanned, ToTokens}; +use quote::{ToTokens, format_ident, quote_spanned}; use std::{collections::HashMap, fmt, mem}; use syn::{ - parse::{Parse, ParseStream}, - parse_quote, parse_quote_spanned, - punctuated::{Pair, Punctuated}, - spanned::Spanned, - token::{Brace, Bracket, Paren}, AngleBracketedGenericArguments, Attribute, Block, ConstParam, Expr, ExprBlock, ExprGroup, ExprIndex, ExprParen, ExprPath, ExprTuple, Field, FieldMutability, Fields, FieldsNamed, FieldsUnnamed, GenericArgument, GenericParam, Generics, Ident, ImplGenerics, Index, ItemStruct, Path, PathArguments, PathSegment, PredicateType, QSelf, Stmt, Token, Turbofish, Type, TypeGenerics, TypeGroup, TypeParam, TypeParen, TypePath, TypeTuple, Visibility, WhereClause, WherePredicate, + parse::{Parse, ParseStream}, + parse_quote, parse_quote_spanned, + punctuated::{Pair, Punctuated}, + spanned::Spanned, + token::{Brace, Bracket, Paren}, }; crate::options! { @@ -299,7 +299,7 @@ impl ParseTypes for ParsedExpr { return Ok(ParsedExpr::Delimited(ParsedExprDelimited { delim: ExprDelimiter::Group(*group_token), expr: parser.parse(expr)?, - })) + })); } Expr::Paren(ExprParen { attrs, @@ -309,7 +309,7 @@ impl ParseTypes for ParsedExpr { return Ok(ParsedExpr::Delimited(ParsedExprDelimited { delim: ExprDelimiter::Paren(*paren_token), expr: parser.parse(expr)?, - })) + })); } Expr::Path(ExprPath { attrs, @@ -1902,8 +1902,8 @@ pub(crate) mod known_items { use proc_macro2::{Ident, Span, TokenStream}; use quote::ToTokens; use syn::{ - parse::{Parse, ParseStream}, Path, PathArguments, PathSegment, Token, + parse::{Parse, ParseStream}, }; macro_rules! impl_known_item_body { diff --git a/crates/fayalite-proc-macros-impl/src/lib.rs b/crates/fayalite-proc-macros-impl/src/lib.rs index 4f7c4f0..def91eb 100644 --- a/crates/fayalite-proc-macros-impl/src/lib.rs +++ b/crates/fayalite-proc-macros-impl/src/lib.rs @@ -2,13 +2,13 @@ // See Notices.txt for copyright information #![cfg_attr(test, recursion_limit = "512")] use proc_macro2::{Span, TokenStream}; -use quote::{quote, ToTokens}; +use quote::{ToTokens, quote}; use std::{ - collections::{hash_map::Entry, HashMap}, + collections::{HashMap, hash_map::Entry}, io::{ErrorKind, Write}, }; use syn::{ - bracketed, + AttrStyle, Attribute, Error, Ident, Item, ItemFn, LitBool, LitStr, Meta, Token, bracketed, ext::IdentExt, parenthesized, parse::{Parse, ParseStream, Parser}, @@ -16,7 +16,6 @@ use syn::{ punctuated::{Pair, Punctuated}, spanned::Spanned, token::{Bracket, Paren}, - AttrStyle, Attribute, Error, Ident, Item, ItemFn, LitBool, LitStr, Meta, Token, }; mod fold; diff --git a/crates/fayalite-proc-macros-impl/src/module.rs b/crates/fayalite-proc-macros-impl/src/module.rs index 62b7837..c7caa16 100644 --- a/crates/fayalite-proc-macros-impl/src/module.rs +++ b/crates/fayalite-proc-macros-impl/src/module.rs @@ -1,19 +1,20 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ + Errors, HdlAttr, PairsIterExt, hdl_type_common::{ParsedGenerics, SplitForImpl}, kw, module::transform_body::{HdlLet, HdlLetKindIO}, - options, Errors, HdlAttr, PairsIterExt, + options, }; use proc_macro2::TokenStream; -use quote::{format_ident, quote, quote_spanned, ToTokens}; +use quote::{ToTokens, format_ident, quote, quote_spanned}; use std::collections::HashSet; use syn::{ - parse_quote, - visit::{visit_pat, Visit}, Attribute, Block, ConstParam, Error, FnArg, GenericParam, Generics, Ident, ItemFn, ItemStruct, LifetimeParam, ReturnType, Signature, TypeParam, Visibility, WhereClause, WherePredicate, + parse_quote, + visit::{Visit, visit_pat}, }; mod transform_body; diff --git a/crates/fayalite-proc-macros-impl/src/module/transform_body.rs b/crates/fayalite-proc-macros-impl/src/module/transform_body.rs index a0f8eb0..6859f69 100644 --- a/crates/fayalite-proc-macros-impl/src/module/transform_body.rs +++ b/crates/fayalite-proc-macros-impl/src/module/transform_body.rs @@ -1,27 +1,28 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ - fold::{impl_fold, DoFold}, + Errors, HdlAttr, + fold::{DoFold, impl_fold}, hdl_type_common::{ - known_items, ParseFailed, ParseTypes, ParsedGenerics, ParsedType, TypesParser, + ParseFailed, ParseTypes, ParsedGenerics, ParsedType, TypesParser, known_items, }, is_hdl_attr, kw, - module::{check_name_conflicts_with_module_builder, ModuleIO, ModuleIOKind, ModuleKind}, - options, Errors, HdlAttr, + module::{ModuleIO, ModuleIOKind, ModuleKind, check_name_conflicts_with_module_builder}, + options, }; use num_bigint::BigInt; use proc_macro2::{Span, TokenStream}; -use quote::{quote, quote_spanned, ToTokens}; +use quote::{ToTokens, quote, quote_spanned}; use std::{borrow::Borrow, convert::Infallible}; use syn::{ - fold::{fold_expr, fold_expr_lit, fold_expr_unary, fold_local, fold_stmt, Fold}, + Attribute, Block, Error, Expr, ExprIf, ExprLet, ExprLit, ExprRepeat, ExprUnary, + GenericArgument, Ident, Item, Lit, LitStr, Local, LocalInit, Pat, Token, Type, UnOp, + fold::{Fold, fold_expr, fold_expr_lit, fold_expr_unary, fold_local, fold_stmt}, parenthesized, parse::{Parse, ParseStream}, parse_quote, parse_quote_spanned, spanned::Spanned, token::Paren, - Attribute, Block, Error, Expr, ExprIf, ExprLet, ExprLit, ExprRepeat, ExprUnary, - GenericArgument, Ident, Item, Lit, LitStr, Local, LocalInit, Pat, Token, Type, UnOp, }; mod expand_aggregate_literals; diff --git a/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_aggregate_literals.rs b/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_aggregate_literals.rs index 61f6c75..1aabb19 100644 --- a/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_aggregate_literals.rs +++ b/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_aggregate_literals.rs @@ -2,19 +2,18 @@ // See Notices.txt for copyright information use crate::{ - kw, + HdlAttr, kw, module::transform_body::{ - expand_match::{parse_enum_path, EnumPath}, ExprOptions, Visitor, + expand_match::{EnumPath, parse_enum_path}, }, - HdlAttr, }; use quote::{format_ident, quote_spanned}; use std::mem; use syn::{ - parse_quote_spanned, punctuated::Punctuated, spanned::Spanned, token::Paren, Expr, ExprArray, - ExprCall, ExprGroup, ExprMethodCall, ExprParen, ExprPath, ExprRepeat, ExprStruct, ExprTuple, - FieldValue, Token, TypePath, + Expr, ExprArray, ExprCall, ExprGroup, ExprMethodCall, ExprParen, ExprPath, ExprRepeat, + ExprStruct, ExprTuple, FieldValue, Token, TypePath, parse_quote_spanned, + punctuated::Punctuated, spanned::Spanned, token::Paren, }; impl Visitor<'_> { diff --git a/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_match.rs b/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_match.rs index 68218c1..069f00d 100644 --- a/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_match.rs +++ b/crates/fayalite-proc-macros-impl/src/module/transform_body/expand_match.rs @@ -1,25 +1,25 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use crate::{ - fold::{impl_fold, DoFold}, + Errors, HdlAttr, PairsIterExt, + fold::{DoFold, impl_fold}, kw, module::transform_body::{ - empty_let, with_debug_clone_and_fold, wrap_ty_with_expr, ExprOptions, Visitor, + ExprOptions, Visitor, empty_let, with_debug_clone_and_fold, wrap_ty_with_expr, }, - Errors, HdlAttr, PairsIterExt, }; use proc_macro2::{Span, TokenStream}; -use quote::{format_ident, quote_spanned, ToTokens, TokenStreamExt}; +use quote::{ToTokens, TokenStreamExt, format_ident, quote_spanned}; use std::collections::BTreeSet; use syn::{ - fold::{fold_arm, fold_expr_match, fold_local, fold_pat, Fold}, + Arm, Attribute, Expr, ExprMatch, FieldPat, Ident, Local, Member, Pat, PatIdent, PatOr, + PatParen, PatPath, PatRest, PatStruct, PatTuple, PatTupleStruct, PatWild, Path, PathSegment, + Token, TypePath, + fold::{Fold, fold_arm, fold_expr_match, fold_local, fold_pat}, parse_quote_spanned, punctuated::Punctuated, spanned::Spanned, token::{Brace, Paren}, - Arm, Attribute, Expr, ExprMatch, FieldPat, Ident, Local, Member, Pat, PatIdent, PatOr, - PatParen, PatPath, PatRest, PatStruct, PatTuple, PatTupleStruct, PatWild, Path, PathSegment, - Token, TypePath, }; macro_rules! visit_trait { @@ -444,7 +444,7 @@ trait ParseMatchPat: Sized { fn struct_(state: &mut HdlMatchParseState<'_>, v: MatchPatStruct) -> Result; fn tuple(state: &mut HdlMatchParseState<'_>, v: MatchPatTuple) -> Result; fn enum_variant(state: &mut HdlMatchParseState<'_>, v: MatchPatEnumVariant) - -> Result; + -> Result; fn parse(state: &mut HdlMatchParseState<'_>, pat: Pat) -> Result { match pat { Pat::Ident(PatIdent { diff --git a/crates/fayalite-proc-macros-impl/src/process_cfg.rs b/crates/fayalite-proc-macros-impl/src/process_cfg.rs index 5cff08f..bcf2fa1 100644 --- a/crates/fayalite-proc-macros-impl/src/process_cfg.rs +++ b/crates/fayalite-proc-macros-impl/src/process_cfg.rs @@ -5,8 +5,8 @@ use crate::{Cfg, CfgAttr, Cfgs, Errors}; use proc_macro2::Ident; use std::{collections::VecDeque, marker::PhantomData}; use syn::{ - punctuated::{Pair, Punctuated}, Token, + punctuated::{Pair, Punctuated}, }; struct State { @@ -131,9 +131,9 @@ trait PhaseDispatch { type Args; type Output; fn dispatch_collect(self, args: Self::Args) - -> Self::Output; + -> Self::Output; fn dispatch_process(self, args: Self::Args) - -> Self::Output; + -> Self::Output; } trait Phase: Sized + 'static { @@ -2510,7 +2510,7 @@ pub(crate) fn process_cfgs(item: syn::Item, cfgs: Cfgs) -> syn::Result> Iterator for IterIntoAnnotations { } impl< - T: FusedIterator< - Item: IntoAnnotations>, - >, - > FusedIterator for IterIntoAnnotations + T: FusedIterator>>, +> FusedIterator for IterIntoAnnotations { } diff --git a/crates/fayalite/src/array.rs b/crates/fayalite/src/array.rs index 6d9b043..c953aea 100644 --- a/crates/fayalite/src/array.rs +++ b/crates/fayalite/src/array.rs @@ -3,22 +3,22 @@ use crate::{ expr::{ - ops::{ArrayLiteral, ExprFromIterator, ExprIntoIterator, ExprPartialEq}, CastToBits, Expr, HdlPartialEq, ReduceBits, ToExpr, + ops::{ArrayLiteral, ExprFromIterator, ExprIntoIterator, ExprPartialEq}, }, - int::{Bool, DynSize, KnownSize, Size, SizeType, DYN_SIZE}, + int::{Bool, DYN_SIZE, DynSize, KnownSize, Size, SizeType}, intern::{Intern, Interned, LazyInterned}, module::transform::visit::{Fold, Folder, Visit, Visitor}, sim::value::{SimValue, SimValuePartialEq}, source_location::SourceLocation, ty::{ - serde_impls::SerdeCanonicalType, CanonicalType, MatchVariantWithoutScope, StaticType, Type, - TypeProperties, TypeWithDeref, + CanonicalType, MatchVariantWithoutScope, StaticType, Type, TypeProperties, TypeWithDeref, + serde_impls::SerdeCanonicalType, }, util::ConstUsize, }; use bitvec::slice::BitSlice; -use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::Error}; use std::{iter::FusedIterator, ops::Index}; #[derive(Copy, Clone, PartialEq, Eq, Hash)] diff --git a/crates/fayalite/src/bundle.rs b/crates/fayalite/src/bundle.rs index 240c0c6..30a70d5 100644 --- a/crates/fayalite/src/bundle.rs +++ b/crates/fayalite/src/bundle.rs @@ -3,16 +3,16 @@ use crate::{ expr::{ - ops::{ArrayLiteral, BundleLiteral, ExprPartialEq}, CastToBits, Expr, ReduceBits, ToExpr, + ops::{ArrayLiteral, BundleLiteral, ExprPartialEq}, }, int::{Bool, DynSize}, intern::{Intern, Interned}, sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType}, source_location::SourceLocation, ty::{ - impl_match_variant_as_self, CanonicalType, MatchVariantWithoutScope, OpaqueSimValue, - StaticType, Type, TypeProperties, TypeWithDeref, + CanonicalType, MatchVariantWithoutScope, OpaqueSimValue, StaticType, Type, TypeProperties, + TypeWithDeref, impl_match_variant_as_self, }, util::HashMap, }; diff --git a/crates/fayalite/src/cli.rs b/crates/fayalite/src/cli.rs index 1f208a8..6fb4b5e 100644 --- a/crates/fayalite/src/cli.rs +++ b/crates/fayalite/src/cli.rs @@ -8,10 +8,10 @@ use crate::{ util::{job_server::AcquiredJob, streaming_read_utf8::streaming_read_utf8}, }; use clap::{ - builder::{OsStringValueParser, TypedValueParser}, Parser, Subcommand, ValueEnum, ValueHint, + builder::{OsStringValueParser, TypedValueParser}, }; -use eyre::{eyre, Report}; +use eyre::{Report, eyre}; use serde::{Deserialize, Serialize}; use std::{ error, @@ -301,7 +301,9 @@ impl VerilogArgs { input.split_once(file_separator_prefix) { let Some((next_file_name, rest)) = rest.split_once(file_separator_suffix) else { - return Err(CliError(eyre!("parsing firtool's output failed: found {file_separator_prefix:?} but no {file_separator_suffix:?}"))); + return Err(CliError(eyre!( + "parsing firtool's output failed: found {file_separator_prefix:?} but no {file_separator_suffix:?}" + ))); }; input = rest; (chunk, Some(next_file_name.as_ref())) diff --git a/crates/fayalite/src/clock.rs b/crates/fayalite/src/clock.rs index f0623d4..66b0e20 100644 --- a/crates/fayalite/src/clock.rs +++ b/crates/fayalite/src/clock.rs @@ -6,7 +6,7 @@ use crate::{ int::Bool, reset::{Reset, ResetType}, source_location::SourceLocation, - ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties}, + ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self}, }; use bitvec::slice::BitSlice; diff --git a/crates/fayalite/src/enum_.rs b/crates/fayalite/src/enum_.rs index 36b5aa7..283e4ff 100644 --- a/crates/fayalite/src/enum_.rs +++ b/crates/fayalite/src/enum_.rs @@ -3,15 +3,15 @@ use crate::{ expr::{ - ops::{ExprPartialEq, VariantAccess}, Expr, ToExpr, + ops::{ExprPartialEq, VariantAccess}, }, hdl, int::{Bool, UIntValue}, intern::{Intern, Interned}, module::{ - connect, enum_match_variants_helper, incomplete_wire, wire, - EnumMatchVariantAndInactiveScopeImpl, EnumMatchVariantsIterImpl, Scope, + EnumMatchVariantAndInactiveScopeImpl, EnumMatchVariantsIterImpl, Scope, connect, + enum_match_variants_helper, incomplete_wire, wire, }, sim::value::{SimValue, SimValuePartialEq}, source_location::SourceLocation, @@ -254,12 +254,12 @@ impl Enum { pub trait EnumType: Type< - BaseType = Enum, - MaskType = Bool, - MatchActiveScope = Scope, - MatchVariantAndInactiveScope = EnumMatchVariantAndInactiveScope, - MatchVariantsIter = EnumMatchVariantsIter, -> + BaseType = Enum, + MaskType = Bool, + MatchActiveScope = Scope, + MatchVariantAndInactiveScope = EnumMatchVariantAndInactiveScope, + MatchVariantsIter = EnumMatchVariantsIter, + > { type SimBuilder: From; fn variants(&self) -> Interned<[EnumVariant]>; diff --git a/crates/fayalite/src/expr.rs b/crates/fayalite/src/expr.rs index e070674..89e60cd 100644 --- a/crates/fayalite/src/expr.rs +++ b/crates/fayalite/src/expr.rs @@ -13,8 +13,8 @@ use crate::{ intern::{Intern, Interned}, memory::{DynPortType, MemPort, PortType}, module::{ - transform::visit::{Fold, Folder, Visit, Visitor}, Instance, ModuleIO, + transform::visit::{Fold, Folder, Visit, Visitor}, }, phantom_const::PhantomConst, reg::Reg, @@ -283,7 +283,10 @@ impl fmt::Debug for Expr { } = self; let expr_ty = __ty.canonical(); let enum_ty = __enum.to_expr().__ty; - assert_eq!(expr_ty, enum_ty, "expr ty mismatch:\nExpr {{\n__enum: {__enum:?},\n__ty: {__ty:?},\n__flow: {__flow:?}\n}}"); + assert_eq!( + expr_ty, enum_ty, + "expr ty mismatch:\nExpr {{\n__enum: {__enum:?},\n__ty: {__ty:?},\n__flow: {__flow:?}\n}}" + ); } self.__enum.fmt(f) } @@ -529,11 +532,7 @@ impl Flow { } } pub const fn flip_if(self, flipped: bool) -> Flow { - if flipped { - self.flip() - } else { - self - } + if flipped { self.flip() } else { self } } } diff --git a/crates/fayalite/src/expr/ops.rs b/crates/fayalite/src/expr/ops.rs index e794a68..4f482ab 100644 --- a/crates/fayalite/src/expr/ops.rs +++ b/crates/fayalite/src/expr/ops.rs @@ -7,12 +7,12 @@ use crate::{ clock::{Clock, ToClock}, enum_::{Enum, EnumType, EnumVariant}, expr::{ + CastBitsTo as _, CastTo, CastToBits as _, Expr, ExprEnum, Flow, HdlPartialEq, + HdlPartialOrd, NotALiteralExpr, ReduceBits, ToExpr, ToLiteralBits, target::{ GetTarget, Target, TargetPathArrayElement, TargetPathBundleField, TargetPathDynArrayElement, TargetPathElement, }, - CastBitsTo as _, CastTo, CastToBits as _, Expr, ExprEnum, Flow, HdlPartialEq, - HdlPartialOrd, NotALiteralExpr, ReduceBits, ToExpr, ToLiteralBits, }, int::{ Bool, BoolOrIntType, DynSize, IntType, KnownSize, SInt, SIntType, SIntValue, Size, UInt, diff --git a/crates/fayalite/src/firrtl.rs b/crates/fayalite/src/firrtl.rs index d33c7a9..b766cf6 100644 --- a/crates/fayalite/src/firrtl.rs +++ b/crates/fayalite/src/firrtl.rs @@ -11,32 +11,32 @@ use crate::{ clock::Clock, enum_::{Enum, EnumType, EnumVariant}, expr::{ + CastBitsTo, Expr, ExprEnum, ops::{self, VariantAccess}, target::{ Target, TargetBase, TargetPathArrayElement, TargetPathBundleField, TargetPathElement, }, - CastBitsTo, Expr, ExprEnum, }, formal::FormalKind, int::{Bool, DynSize, IntType, SIntValue, UInt, UIntValue}, intern::{Intern, Interned}, memory::{Mem, PortKind, PortName, ReadUnderWrite}, module::{ - transform::{ - simplify_enums::{simplify_enums, SimplifyEnumsError, SimplifyEnumsKind}, - simplify_memories::simplify_memories, - }, AnnotatedModuleIO, Block, ExternModuleBody, ExternModuleParameter, ExternModuleParameterValue, Module, ModuleBody, NameOptId, NormalModuleBody, Stmt, StmtConnect, StmtDeclaration, StmtFormal, StmtIf, StmtInstance, StmtMatch, StmtReg, StmtWire, + transform::{ + simplify_enums::{SimplifyEnumsError, SimplifyEnumsKind, simplify_enums}, + simplify_memories::simplify_memories, + }, }, reset::{AsyncReset, Reset, ResetType, SyncReset}, source_location::SourceLocation, ty::{CanonicalType, Type}, util::{ - const_str_array_is_strictly_ascending, BitSliceWriteWithBase, DebugAsRawString, - GenericConstBool, HashMap, HashSet, + BitSliceWriteWithBase, DebugAsRawString, GenericConstBool, HashMap, HashSet, + const_str_array_is_strictly_ascending, }, }; use bitvec::slice::BitSlice; @@ -925,7 +925,10 @@ impl<'a> Exporter<'a> { }, ) in expr.field_values().into_iter().zip(ty.fields()) { - debug_assert!(!flipped, "can't have bundle literal with flipped field -- this should have been caught in BundleLiteral::new_unchecked"); + debug_assert!( + !flipped, + "can't have bundle literal with flipped field -- this should have been caught in BundleLiteral::new_unchecked" + ); let name = bundle_ns.borrow_mut().get(name); let field_value = self.expr(Expr::canonical(field_value), definitions, const_ty); definitions.add_definition_line(format_args!("connect {ident}.{name}, {field_value}")); @@ -1261,7 +1264,9 @@ impl<'a> Exporter<'a> { "UInt<0>(0)".into() }; for (variant_index, variant) in ty.variants().into_iter().enumerate() { - let when_cond = format!("eq(UInt<{discriminant_bit_width}>({variant_index}), tail({value_str}, {body_bit_width}))"); + let when_cond = format!( + "eq(UInt<{discriminant_bit_width}>({variant_index}), tail({value_str}, {body_bit_width}))" + ); if variant_index == ty.variants().len() - 1 { definitions.add_definition_line(format_args!("{extra_indent}else:")); } else if variant_index == 0 { diff --git a/crates/fayalite/src/int.rs b/crates/fayalite/src/int.rs index d8364b1..c491cdc 100644 --- a/crates/fayalite/src/int.rs +++ b/crates/fayalite/src/int.rs @@ -4,22 +4,22 @@ use crate::{ array::ArrayType, expr::{ - target::{GetTarget, Target}, Expr, NotALiteralExpr, ToExpr, ToLiteralBits, + target::{GetTarget, Target}, }, hdl, intern::{Intern, Interned, Memoize}, sim::value::{SimValue, ToSimValueWithType}, source_location::SourceLocation, - ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties}, - util::{interned_bit, ConstBool, ConstUsize, GenericConstBool, GenericConstUsize}, + ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self}, + util::{ConstBool, ConstUsize, GenericConstBool, GenericConstUsize, interned_bit}, }; use bitvec::{order::Lsb0, slice::BitSlice, vec::BitVec, view::BitView}; use num_bigint::{BigInt, BigUint, Sign}; use num_traits::{One, Signed, Zero}; use serde::{ - de::{DeserializeOwned, Error, Visitor}, Deserialize, Deserializer, Serialize, Serializer, + de::{DeserializeOwned, Error, Visitor}, }; use std::{ borrow::{BorrowMut, Cow}, @@ -224,11 +224,7 @@ impl Size for T { } fn try_from_usize(v: usize) -> Option { - if v == T::VALUE { - Some(T::SIZE) - } else { - None - } + if v == T::VALUE { Some(T::SIZE) } else { None } } } diff --git a/crates/fayalite/src/int/uint_in_range.rs b/crates/fayalite/src/int/uint_in_range.rs index 0e2d07e..ae80a93 100644 --- a/crates/fayalite/src/int/uint_in_range.rs +++ b/crates/fayalite/src/int/uint_in_range.rs @@ -4,20 +4,20 @@ use crate::{ bundle::{Bundle, BundleField, BundleType, BundleTypePropertiesBuilder, NoBuilder}, expr::{ - ops::{ExprCastTo, ExprPartialEq, ExprPartialOrd}, CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd, + ops::{ExprCastTo, ExprPartialEq, ExprPartialOrd}, }, int::{Bool, DynSize, KnownSize, Size, SizeType, UInt, UIntType}, intern::{Intern, Interned}, phantom_const::PhantomConst, sim::value::{SimValue, SimValuePartialEq, ToSimValueWithType}, source_location::SourceLocation, - ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties}, + ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self}, }; use bitvec::{order::Lsb0, slice::BitSlice, view::BitView}; use serde::{ - de::{value::UsizeDeserializer, Error, Visitor}, Deserialize, Deserializer, Serialize, Serializer, + de::{Error, Visitor, value::UsizeDeserializer}, }; use std::{fmt, marker::PhantomData, ops::Index}; @@ -45,15 +45,18 @@ impl Type for UIntInRangeMaskType { fn from_canonical(canonical_type: CanonicalType) -> Self { let fields = Bundle::from_canonical(canonical_type).fields(); - let [BundleField { - name: value_name, - flipped: false, - ty: value, - }, BundleField { - name: range_name, - flipped: false, - ty: range, - }] = *fields + let [ + BundleField { + name: value_name, + flipped: false, + ty: value, + }, + BundleField { + name: range_name, + flipped: false, + ty: range, + }, + ] = *fields else { panic!("expected UIntInRangeMaskType"); }; @@ -323,15 +326,18 @@ macro_rules! define_uint_in_range_type { fn from_canonical(canonical_type: CanonicalType) -> Self { let fields = Bundle::from_canonical(canonical_type).fields(); - let [BundleField { - name: value_name, - flipped: false, - ty: value, - }, BundleField { - name: range_name, - flipped: false, - ty: range, - }] = *fields + let [ + BundleField { + name: value_name, + flipped: false, + ty: value, + }, + BundleField { + name: range_name, + flipped: false, + ty: range, + }, + ] = *fields else { panic!("expected {}", stringify!($UIntInRange)); }; diff --git a/crates/fayalite/src/memory.rs b/crates/fayalite/src/memory.rs index 622ffc6..a146ac6 100644 --- a/crates/fayalite/src/memory.rs +++ b/crates/fayalite/src/memory.rs @@ -7,7 +7,7 @@ use crate::{ array::{Array, ArrayType}, bundle::{Bundle, BundleType}, clock::Clock, - expr::{ops::BundleLiteral, repeat, Expr, Flow, ToExpr, ToLiteralBits}, + expr::{Expr, Flow, ToExpr, ToLiteralBits, ops::BundleLiteral, repeat}, hdl, int::{Bool, DynSize, Size, UInt, UIntType}, intern::{Intern, Interned}, diff --git a/crates/fayalite/src/module.rs b/crates/fayalite/src/module.rs index 920b0af..aaa9340 100644 --- a/crates/fayalite/src/module.rs +++ b/crates/fayalite/src/module.rs @@ -8,12 +8,12 @@ use crate::{ clock::{Clock, ClockDomain}, enum_::{Enum, EnumMatchVariantsIter, EnumType}, expr::{ + Expr, Flow, ToExpr, ops::VariantAccess, target::{ GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField, TargetPathElement, }, - Expr, Flow, ToExpr, }, formal::FormalKind, int::{Bool, DynSize, Size}, @@ -1459,7 +1459,9 @@ impl TargetState { }) .reduce(TargetWritten::conditional_merge_written) else { - unreachable!("merge_conditional_sub_blocks_into_block must be called with at least one sub-block"); + unreachable!( + "merge_conditional_sub_blocks_into_block must be called with at least one sub-block" + ); }; let mut written_in_blocks = written_in_blocks.borrow_mut(); if target_block >= written_in_blocks.len() { @@ -2290,14 +2292,12 @@ pub fn annotate(target: Expr, annotations: impl IntoAnnotations) { } TargetBase::MemPort(v) => { ModuleBuilder::with(|m| { - RefCell::borrow_mut(unwrap!(unwrap!(m - .impl_ - .borrow_mut() - .body - .builder_normal_body_opt()) - .body - .memory_map - .get_mut(&v.mem_name()))) + RefCell::borrow_mut(unwrap!( + unwrap!(m.impl_.borrow_mut().body.builder_normal_body_opt()) + .body + .memory_map + .get_mut(&v.mem_name()) + )) .port_annotations .extend(annotations) }); diff --git a/crates/fayalite/src/module/transform/deduce_resets.rs b/crates/fayalite/src/module/transform/deduce_resets.rs index 5fb829e..a708986 100644 --- a/crates/fayalite/src/module/transform/deduce_resets.rs +++ b/crates/fayalite/src/module/transform/deduce_resets.rs @@ -6,12 +6,12 @@ use crate::{ bundle::{BundleField, BundleType}, enum_::{EnumType, EnumVariant}, expr::{ + ExprEnum, ops::{self, ArrayLiteral}, target::{ Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField, TargetPathDynArrayElement, TargetPathElement, }, - ExprEnum, }, formal::FormalKind, int::{SIntValue, UIntValue}, @@ -41,10 +41,16 @@ impl fmt::Display for DeduceResetsError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { DeduceResetsError::ResetIsNotDrivenByAsyncOrSync { source_location } => { - write!(f, "deduce_reset failed: Reset signal is not driven by any AsyncReset or SyncReset signals: {source_location}") + write!( + f, + "deduce_reset failed: Reset signal is not driven by any AsyncReset or SyncReset signals: {source_location}" + ) } DeduceResetsError::ResetIsDrivenByBothAsyncAndSync { source_location } => { - write!(f, "deduce_reset failed: Reset signal is driven by both AsyncReset and SyncReset signals: {source_location}") + write!( + f, + "deduce_reset failed: Reset signal is driven by both AsyncReset and SyncReset signals: {source_location}" + ) } } } @@ -2099,7 +2105,7 @@ impl RunPass

for StmtDeclaration { ) -> Result, DeduceResetsError> { let (annotations, reg) = match self { StmtDeclaration::Wire(v) => { - return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Wire)) + return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Wire)); } &StmtDeclaration::Reg(StmtReg { annotations, reg }) => (annotations, AnyReg::from(reg)), &StmtDeclaration::RegSync(StmtReg { annotations, reg }) => { @@ -2109,7 +2115,7 @@ impl RunPass

for StmtDeclaration { (annotations, AnyReg::from(reg)) } StmtDeclaration::Instance(v) => { - return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Instance)) + return Ok(v.run_pass(pass_args)?.map(StmtDeclaration::Instance)); } }; let annotations = annotations.run_pass(pass_args.as_mut())?; diff --git a/crates/fayalite/src/module/transform/simplify_enums.rs b/crates/fayalite/src/module/transform/simplify_enums.rs index 333451d..3a6ffde 100644 --- a/crates/fayalite/src/module/transform/simplify_enums.rs +++ b/crates/fayalite/src/module/transform/simplify_enums.rs @@ -5,16 +5,16 @@ use crate::{ bundle::{Bundle, BundleField, BundleType}, enum_::{Enum, EnumType, EnumVariant}, expr::{ - ops::{self, EnumLiteral}, CastBitsTo, CastTo, CastToBits, Expr, ExprEnum, HdlPartialEq, ToExpr, + ops::{self, EnumLiteral}, }, hdl, int::UInt, intern::{Intern, Interned, Memoize}, memory::{DynPortType, Mem, MemPort}, module::{ - transform::visit::{Fold, Folder}, Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtIf, StmtMatch, StmtWire, + transform::visit::{Fold, Folder}, }, source_location::SourceLocation, ty::{CanonicalType, Type}, @@ -810,7 +810,7 @@ impl Folder for State { .unwrap() .gen_name(&format!( "{}_{}", - memory.scoped_name().1 .0, + memory.scoped_name().1.0, port.port_name() )), port.source_location(), diff --git a/crates/fayalite/src/module/transform/simplify_memories.rs b/crates/fayalite/src/module/transform/simplify_memories.rs index 6357843..1b0ad30 100644 --- a/crates/fayalite/src/module/transform/simplify_memories.rs +++ b/crates/fayalite/src/module/transform/simplify_memories.rs @@ -9,8 +9,8 @@ use crate::{ intern::{Intern, Interned}, memory::{Mem, MemPort, PortType}, module::{ - transform::visit::{Fold, Folder}, Block, Id, Module, NameId, ScopedNameId, Stmt, StmtConnect, StmtWire, + transform::visit::{Fold, Folder}, }, source_location::SourceLocation, ty::{CanonicalType, Type}, @@ -634,7 +634,7 @@ impl ModuleState { split_state: &SplitState<'_>, ) -> Mem { let mem_name = NameId( - Intern::intern_owned(format!("{}{mem_name_path}", input_mem.scoped_name().1 .0)), + Intern::intern_owned(format!("{}{mem_name_path}", input_mem.scoped_name().1.0)), Id::new(), ); let mem_name = ScopedNameId(input_mem.scoped_name().0, mem_name); diff --git a/crates/fayalite/src/module/transform/visit.rs b/crates/fayalite/src/module/transform/visit.rs index 526a62c..c0bfa9d 100644 --- a/crates/fayalite/src/module/transform/visit.rs +++ b/crates/fayalite/src/module/transform/visit.rs @@ -11,12 +11,11 @@ use crate::{ clock::Clock, enum_::{Enum, EnumType, EnumVariant}, expr::{ - ops, + Expr, ExprEnum, ops, target::{ Target, TargetBase, TargetChild, TargetPathArrayElement, TargetPathBundleField, TargetPathDynArrayElement, TargetPathElement, }, - Expr, ExprEnum, }, formal::FormalKind, int::{Bool, SIntType, SIntValue, Size, UIntType, UIntValue}, diff --git a/crates/fayalite/src/phantom_const.rs b/crates/fayalite/src/phantom_const.rs index c481692..44b36ca 100644 --- a/crates/fayalite/src/phantom_const.rs +++ b/crates/fayalite/src/phantom_const.rs @@ -3,23 +3,22 @@ use crate::{ expr::{ - ops::{ExprPartialEq, ExprPartialOrd}, Expr, ToExpr, + ops::{ExprPartialEq, ExprPartialOrd}, }, int::Bool, intern::{Intern, Interned, InternedCompare, LazyInterned, LazyInternedTrait, Memoize}, sim::value::{SimValue, SimValuePartialEq, ToSimValue, ToSimValueWithType}, source_location::SourceLocation, ty::{ - impl_match_variant_as_self, + CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self, serde_impls::{SerdeCanonicalType, SerdePhantomConst}, - CanonicalType, StaticType, Type, TypeProperties, }, }; use bitvec::slice::BitSlice; use serde::{ - de::{DeserializeOwned, Error}, Deserialize, Deserializer, Serialize, Serializer, + de::{DeserializeOwned, Error}, }; use std::{ any::Any, diff --git a/crates/fayalite/src/prelude.rs b/crates/fayalite/src/prelude.rs index 519210f..d3b6c71 100644 --- a/crates/fayalite/src/prelude.rs +++ b/crates/fayalite/src/prelude.rs @@ -1,6 +1,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information pub use crate::{ + __, annotations::{ BlackBoxInlineAnnotation, BlackBoxPathAnnotation, CustomFirrtlAnnotation, DocStringAnnotation, DontTouchAnnotation, SVAttributeAnnotation, @@ -11,33 +12,32 @@ pub use crate::{ clock::{Clock, ClockDomain, ToClock}, enum_::{Enum, HdlNone, HdlOption, HdlSome}, expr::{ - repeat, CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd, MakeUninitExpr, - ReduceBits, ToExpr, + CastBitsTo, CastTo, CastToBits, Expr, HdlPartialEq, HdlPartialOrd, MakeUninitExpr, + ReduceBits, ToExpr, repeat, }, formal::{ - all_const, all_seq, any_const, any_seq, formal_global_clock, formal_reset, hdl_assert, - hdl_assert_with_enable, hdl_assume, hdl_assume_with_enable, hdl_cover, - hdl_cover_with_enable, MakeFormalExpr, + MakeFormalExpr, all_const, all_seq, any_const, any_seq, formal_global_clock, formal_reset, + hdl_assert, hdl_assert_with_enable, hdl_assume, hdl_assume_with_enable, hdl_cover, + hdl_cover_with_enable, }, hdl, hdl_module, int::{Bool, DynSize, KnownSize, SInt, SIntType, SIntValue, Size, UInt, UIntType, UIntValue}, memory::{Mem, MemBuilder, ReadUnderWrite}, module::{ - annotate, connect, connect_any, incomplete_wire, instance, memory, memory_array, - memory_with_init, reg_builder, wire, Instance, Module, ModuleBuilder, + Instance, Module, ModuleBuilder, annotate, connect, connect_any, incomplete_wire, instance, + memory, memory_array, memory_with_init, reg_builder, wire, }, phantom_const::PhantomConst, reg::Reg, reset::{AsyncReset, Reset, SyncReset, ToAsyncReset, ToReset, ToSyncReset}, sim::{ + ExternModuleSimulationState, Simulation, time::{SimDuration, SimInstant}, value::{SimValue, ToSimValue, ToSimValueWithType}, - ExternModuleSimulationState, Simulation, }, source_location::SourceLocation, ty::{AsMask, CanonicalType, Type}, util::{ConstUsize, GenericConstUsize}, wire::Wire, - __, }; pub use bitvec::{slice::BitSlice, vec::BitVec}; diff --git a/crates/fayalite/src/reset.rs b/crates/fayalite/src/reset.rs index 312a8ea..f3392a2 100644 --- a/crates/fayalite/src/reset.rs +++ b/crates/fayalite/src/reset.rs @@ -2,10 +2,10 @@ // See Notices.txt for copyright information use crate::{ clock::Clock, - expr::{ops, Expr, ToExpr}, + expr::{Expr, ToExpr, ops}, int::{Bool, SInt, UInt}, source_location::SourceLocation, - ty::{impl_match_variant_as_self, CanonicalType, StaticType, Type, TypeProperties}, + ty::{CanonicalType, StaticType, Type, TypeProperties, impl_match_variant_as_self}, }; use bitvec::slice::BitSlice; diff --git a/crates/fayalite/src/sim.rs b/crates/fayalite/src/sim.rs index 10ae16c..d0daf34 100644 --- a/crates/fayalite/src/sim.rs +++ b/crates/fayalite/src/sim.rs @@ -7,12 +7,11 @@ use crate::{ bundle::{BundleField, BundleType}, enum_::{EnumType, EnumVariant}, expr::{ - ops, + ExprEnum, Flow, ToLiteralBits, ops, target::{ GetTarget, Target, TargetBase, TargetPathArrayElement, TargetPathBundleField, TargetPathElement, }, - ExprEnum, Flow, ToLiteralBits, }, int::{BoolOrIntType, UIntValue}, intern::{ @@ -20,10 +19,10 @@ use crate::{ }, memory::PortKind, module::{ - transform::deduce_resets::deduce_resets, AnnotatedModuleIO, Block, ExternModuleBody, Id, - InstantiatedModule, ModuleBody, NameId, NormalModuleBody, ScopedNameId, Stmt, StmtConnect, - StmtDeclaration, StmtFormal, StmtIf, StmtInstance, StmtMatch, StmtReg, StmtWire, - TargetInInstantiatedModule, + AnnotatedModuleIO, Block, ExternModuleBody, Id, InstantiatedModule, ModuleBody, NameId, + NormalModuleBody, ScopedNameId, Stmt, StmtConnect, StmtDeclaration, StmtFormal, StmtIf, + StmtInstance, StmtMatch, StmtReg, StmtWire, TargetInInstantiatedModule, + transform::deduce_resets::deduce_resets, }, prelude::*, reset::{ResetType, ResetTypeDispatch}, @@ -4569,7 +4568,7 @@ impl Compiler { ) }) .unzip(); - let name = mem.scoped_name().1 .0; + let name = mem.scoped_name().1.0; let id = TraceMemoryId(self.memories.len()); let stride = mem.array_type().element().bit_width(); let trace = TraceMem { @@ -5597,7 +5596,7 @@ trait TraceWriterDynTrait: fmt::Debug + 'static { fn set_signal_clock_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>; fn set_signal_sync_reset_dyn(&mut self, id: TraceScalarId, value: bool) -> std::io::Result<()>; fn set_signal_async_reset_dyn(&mut self, id: TraceScalarId, value: bool) - -> std::io::Result<()>; + -> std::io::Result<()>; fn set_signal_enum_discriminant_dyn( &mut self, id: TraceScalarId, @@ -6284,8 +6283,8 @@ impl EarliestWaitTargets { fn iter<'a>( &'a self, ) -> impl Clone - + Iterator, &'a SimValue>> - + 'a { + + Iterator, &'a SimValue>> + + 'a { self.settle .then_some(WaitTarget::Settle) .into_iter() @@ -6728,7 +6727,10 @@ impl SimulationImpl { let this = &mut *self; let mut sim = this.sim.borrow_mut(); let sim = &mut *sim; - assert!(cx.waker().will_wake(&sim.generator_waker), "can't use ExternModuleSimulationState's methods outside of ExternModuleSimulation"); + assert!( + cx.waker().will_wake(&sim.generator_waker), + "can't use ExternModuleSimulationState's methods outside of ExternModuleSimulation" + ); this.targets.convert_earlier_instants_to_settle(sim.instant); if this.targets.is_empty() { this.targets.settle = true; @@ -7753,9 +7755,9 @@ impl Clone for SimGeneratorFn { impl Copy for SimGeneratorFn {} impl< - T: fmt::Debug + Clone + Eq + Hash + Send + Sync + 'static, - Fut: IntoFuture + 'static, - > ExternModuleSimGenerator for SimGeneratorFn + T: fmt::Debug + Clone + Eq + Hash + Send + Sync + 'static, + Fut: IntoFuture + 'static, +> ExternModuleSimGenerator for SimGeneratorFn { fn run<'a>(&'a self, sim: ExternModuleSimulationState) -> impl IntoFuture + 'a { (self.f)(self.args.clone(), sim) @@ -7764,7 +7766,7 @@ impl< trait DynExternModuleSimGenerator: Any + Send + Sync + SupportsPtrEqWithTypeId + fmt::Debug { fn dyn_run<'a>(&'a self, sim: ExternModuleSimulationState) - -> Box + 'a>; + -> Box + 'a>; } impl DynExternModuleSimGenerator for T { diff --git a/crates/fayalite/src/sim/value.rs b/crates/fayalite/src/sim/value.rs index 8dace78..70cb943 100644 --- a/crates/fayalite/src/sim/value.rs +++ b/crates/fayalite/src/sim/value.rs @@ -11,8 +11,8 @@ use crate::{ reset::{AsyncReset, Reset, SyncReset}, ty::{CanonicalType, StaticType, Type}, util::{ - alternating_cell::{AlternatingCell, AlternatingCellMethods}, ConstUsize, + alternating_cell::{AlternatingCell, AlternatingCellMethods}, }, }; use bitvec::{slice::BitSlice, vec::BitVec}; diff --git a/crates/fayalite/src/sim/vcd.rs b/crates/fayalite/src/sim/vcd.rs index fcf6743..4a2b564 100644 --- a/crates/fayalite/src/sim/vcd.rs +++ b/crates/fayalite/src/sim/vcd.rs @@ -7,12 +7,12 @@ use crate::{ int::UInt, intern::{Intern, Interned}, sim::{ - time::{SimDuration, SimInstant}, TraceArray, TraceAsyncReset, TraceBool, TraceBundle, TraceClock, TraceDecl, TraceEnumDiscriminant, TraceEnumWithFields, TraceFieldlessEnum, TraceInstance, TraceLocation, TraceMem, TraceMemPort, TraceMemoryId, TraceMemoryLocation, TraceModule, TraceModuleIO, TraceReg, TraceSInt, TraceScalar, TraceScalarId, TraceScope, TraceSyncReset, TraceUInt, TraceWire, TraceWriter, TraceWriterDecls, + time::{SimDuration, SimInstant}, }, util::HashMap, }; diff --git a/crates/fayalite/src/ty.rs b/crates/fayalite/src/ty.rs index 8f41c5c..787869d 100644 --- a/crates/fayalite/src/ty.rs +++ b/crates/fayalite/src/ty.rs @@ -16,7 +16,7 @@ use crate::{ util::ConstUsize, }; use bitvec::slice::BitSlice; -use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer}; +use serde::{Deserialize, Deserializer, Serialize, Serializer, de::DeserializeOwned}; use std::{fmt, hash::Hash, iter::FusedIterator, ops::Index, sync::Arc}; pub(crate) mod serde_impls; @@ -334,16 +334,16 @@ pub trait Type: type MatchVariant: 'static + Send + Sync; type MatchActiveScope; type MatchVariantAndInactiveScope: MatchVariantAndInactiveScope< - MatchVariant = Self::MatchVariant, - MatchActiveScope = Self::MatchActiveScope, - >; + MatchVariant = Self::MatchVariant, + MatchActiveScope = Self::MatchActiveScope, + >; type MatchVariantsIter: Iterator + ExactSizeIterator + FusedIterator + DoubleEndedIterator; #[track_caller] fn match_variants(this: Expr, source_location: SourceLocation) - -> Self::MatchVariantsIter; + -> Self::MatchVariantsIter; fn mask_type(&self) -> Self::MaskType; fn canonical(&self) -> CanonicalType; fn from_canonical(canonical_type: CanonicalType) -> Self; diff --git a/crates/fayalite/src/util/const_bool.rs b/crates/fayalite/src/util/const_bool.rs index 7def3b5..050f6a7 100644 --- a/crates/fayalite/src/util/const_bool.rs +++ b/crates/fayalite/src/util/const_bool.rs @@ -1,8 +1,8 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use serde::{ - de::{DeserializeOwned, Error, Unexpected}, Deserialize, Deserializer, Serialize, Serializer, + de::{DeserializeOwned, Error, Unexpected}, }; use std::{fmt::Debug, hash::Hash, mem::ManuallyDrop, ptr}; diff --git a/crates/fayalite/src/util/const_usize.rs b/crates/fayalite/src/util/const_usize.rs index e098a12..d76f7a7 100644 --- a/crates/fayalite/src/util/const_usize.rs +++ b/crates/fayalite/src/util/const_usize.rs @@ -1,8 +1,8 @@ // SPDX-License-Identifier: LGPL-3.0-or-later // See Notices.txt for copyright information use serde::{ - de::{DeserializeOwned, Error, Unexpected}, Deserialize, Deserializer, Serialize, Serializer, + de::{DeserializeOwned, Error, Unexpected}, }; use std::{fmt::Debug, hash::Hash}; -- 2.47.3