diff --git a/cranelift/codegen/meta/src/gen_inst.rs b/cranelift/codegen/meta/src/gen_inst.rs index ab0db7c757a8..1b4612f108d9 100644 --- a/cranelift/codegen/meta/src/gen_inst.rs +++ b/cranelift/codegen/meta/src/gen_inst.rs @@ -312,7 +312,7 @@ fn gen_instruction_data_impl(formats: &[Rc], fmt: &mut Format (Some("args.as_slice(pool)"), "args.len(pool)") } else if format.num_value_operands == 1 { members.push("ref arg"); - (Some("std::slice::from_ref(arg)"), "1") + (Some("core::slice::from_ref(arg)"), "1") } else if format.num_value_operands > 0 { members.push("ref args"); (Some("args"), "args.len()") @@ -324,7 +324,7 @@ fn gen_instruction_data_impl(formats: &[Rc], fmt: &mut Format 0 => None, 1 => { members.push("ref destination"); - Some(("std::slice::from_ref(destination)", "1")) + Some(("core::slice::from_ref(destination)", "1")) } _ => { members.push("ref blocks"); diff --git a/cranelift/codegen/shared/src/lib.rs b/cranelift/codegen/shared/src/lib.rs index 2a03a8323439..8aa30263357e 100644 --- a/cranelift/codegen/shared/src/lib.rs +++ b/cranelift/codegen/shared/src/lib.rs @@ -2,9 +2,10 @@ //! `cranelift-codegen-meta` libraries. #![deny(missing_docs)] +#![no_std] pub mod constant_hash; pub mod constants; /// Version number of this crate. -pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const VERSION: &str = core::env!("CARGO_PKG_VERSION"); diff --git a/cranelift/codegen/src/ctxhash.rs b/cranelift/codegen/src/ctxhash.rs index 98931566aad3..ea7de766006e 100644 --- a/cranelift/codegen/src/ctxhash.rs +++ b/cranelift/codegen/src/ctxhash.rs @@ -4,8 +4,8 @@ //! node-internal data references some other storage (e.g., offsets into //! an array or pool of shared data). +use core::hash::{Hash, Hasher}; use hashbrown::hash_table::HashTable; -use std::hash::{Hash, Hasher}; /// Trait that allows for equality comparison given some external /// context. @@ -92,7 +92,7 @@ impl CtxHashMap { match self.raw.find_mut(hash as u64, |bucket| { hash == bucket.hash && ctx.ctx_eq(&bucket.k, &k) }) { - Some(bucket) => Some(std::mem::replace(&mut bucket.v, v)), + Some(bucket) => Some(core::mem::replace(&mut bucket.v, v)), None => { let data = BucketData { hash, k, v }; self.raw diff --git a/cranelift/codegen/src/data_value.rs b/cranelift/codegen/src/data_value.rs index 4eeb8c117ace..a2e69a724e1b 100644 --- a/cranelift/codegen/src/data_value.rs +++ b/cranelift/codegen/src/data_value.rs @@ -247,13 +247,13 @@ impl DataValue { /// Write a [DataValue] to a memory location in native-endian byte order. pub unsafe fn write_value_to(&self, p: *mut u128) { let size = self.ty().bytes() as usize; - self.write_to_slice_ne(unsafe { std::slice::from_raw_parts_mut(p as *mut u8, size) }); + self.write_to_slice_ne(unsafe { core::slice::from_raw_parts_mut(p as *mut u8, size) }); } /// Read a [DataValue] from a memory location using a given [Type] in native-endian byte order. pub unsafe fn read_value_from(p: *const u128, ty: Type) -> Self { DataValue::read_from_slice_ne( - unsafe { std::slice::from_raw_parts(p as *const u8, ty.bytes() as usize) }, + unsafe { core::slice::from_raw_parts(p as *const u8, ty.bytes() as usize) }, ty, ) } @@ -290,7 +290,7 @@ pub enum DataValueCastFailure { // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for DataValueCastFailure {} +impl core::error::Error for DataValueCastFailure {} impl Display for DataValueCastFailure { fn fmt(&self, f: &mut Formatter) -> fmt::Result { diff --git a/cranelift/codegen/src/dominator_tree.rs b/cranelift/codegen/src/dominator_tree.rs index 10ab9c891ebb..23d099a4251a 100644 --- a/cranelift/codegen/src/dominator_tree.rs +++ b/cranelift/codegen/src/dominator_tree.rs @@ -94,7 +94,7 @@ impl SpanningTree { } } -impl std::ops::Index for SpanningTree { +impl core::ops::Index for SpanningTree { type Output = SpanningTreeNode; fn index(&self, idx: u32) -> &Self::Output { @@ -102,7 +102,7 @@ impl std::ops::Index for SpanningTree { } } -impl std::ops::IndexMut for SpanningTree { +impl core::ops::IndexMut for SpanningTree { fn index_mut(&mut self, idx: u32) -> &mut Self::Output { &mut self.nodes[idx as usize] } @@ -439,7 +439,7 @@ impl DominatorTree { } let semi_candidate = self.eval(self.nodes[pred].pre_number, last_linked); - semi = std::cmp::min(semi, semi_candidate); + semi = core::cmp::min(semi, semi_candidate); } let w_node = &mut self.stree[w]; diff --git a/cranelift/codegen/src/egraph.rs b/cranelift/codegen/src/egraph.rs index 9993f7941f10..46fdaf36985b 100644 --- a/cranelift/codegen/src/egraph.rs +++ b/cranelift/codegen/src/egraph.rs @@ -660,7 +660,7 @@ where let old_vals = ctx.func.dfg.inst_results(inst); let new_vals = if let Some(val) = new_val.as_ref() { - std::slice::from_ref(val) + core::slice::from_ref(val) } else { ctx.func.dfg.inst_results(new_inst) }; @@ -1075,7 +1075,7 @@ impl<'a> CtxEq<(Type, InstructionData), (Type, InstructionData)> for GVNContext< impl<'a> CtxHash<(Type, InstructionData)> for GVNContext<'a> { fn ctx_hash(&self, state: &mut H, (ty, inst): &(Type, InstructionData)) { - std::hash::Hash::hash(&ty, state); + core::hash::Hash::hash(&ty, state); inst.hash(state, self.value_lists); } } diff --git a/cranelift/codegen/src/egraph/cost.rs b/cranelift/codegen/src/egraph/cost.rs index 1ff56fcd61f9..062196964c96 100644 --- a/cranelift/codegen/src/egraph/cost.rs +++ b/cranelift/codegen/src/egraph/cost.rs @@ -48,7 +48,7 @@ impl core::fmt::Debug for Cost { impl Ord for Cost { #[inline] - fn cmp(&self, other: &Self) -> std::cmp::Ordering { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { // We make sure that the high bits are the op cost and the low bits are // the depth. This means that we can use normal integer comparison to // order by op cost and then depth. @@ -65,7 +65,7 @@ impl Ord for Cost { impl PartialOrd for Cost { #[inline] - fn partial_cmp(&self, other: &Self) -> Option { + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } @@ -172,24 +172,24 @@ impl Cost { } } -impl std::iter::Sum for Cost { +impl core::iter::Sum for Cost { fn sum>(iter: I) -> Self { iter.fold(Self::zero(), |a, b| a + b) } } -impl std::default::Default for Cost { +impl core::default::Default for Cost { fn default() -> Cost { Cost::zero() } } -impl std::ops::Add for Cost { +impl core::ops::Add for Cost { type Output = Cost; fn add(self, other: Cost) -> Cost { let op_cost = self.op_cost().saturating_add(other.op_cost()); - let depth = std::cmp::max(self.depth(), other.depth()); + let depth = core::cmp::max(self.depth(), other.depth()); Cost::new(op_cost, depth) } } diff --git a/cranelift/codegen/src/egraph/elaborate.rs b/cranelift/codegen/src/egraph/elaborate.rs index d9d156eb41c8..9328354b2dc2 100644 --- a/cranelift/codegen/src/egraph/elaborate.rs +++ b/cranelift/codegen/src/egraph/elaborate.rs @@ -82,7 +82,7 @@ impl PartialOrd for BestEntry { impl Ord for BestEntry { #[inline] - fn cmp(&self, other: &Self) -> std::cmp::Ordering { + fn cmp(&self, other: &Self) -> core::cmp::Ordering { self.0.cmp(&other.0).then_with(|| { // Note that this comparison is reversed. When costs are equal, // prefer the value with the bigger index. This is a heuristic that @@ -321,9 +321,9 @@ impl<'a> Elaborator<'a> { debug_assert!(!best[x].1.is_reserved_value()); debug_assert!(!best[y].1.is_reserved_value()); best[value] = if use_worst { - std::cmp::max(best[x], best[y]) + core::cmp::max(best[x], best[y]) } else { - std::cmp::min(best[x], best[y]) + core::cmp::min(best[x], best[y]) }; trace!( " -> best of union({:?}, {:?}) = {:?}", diff --git a/cranelift/codegen/src/incremental_cache.rs b/cranelift/codegen/src/incremental_cache.rs index 9b9d935241e8..a597d18869ce 100644 --- a/cranelift/codegen/src/incremental_cache.rs +++ b/cranelift/codegen/src/incremental_cache.rs @@ -111,7 +111,7 @@ pub trait CacheKvStore { #[derive(Clone, Hash, PartialEq, Eq)] pub struct CacheKeyHash([u8; 32]); -impl std::fmt::Display for CacheKeyHash { +impl core::fmt::Display for CacheKeyHash { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { write!(f, "CacheKeyHash:{:?}", self.0) } diff --git a/cranelift/codegen/src/ir/condcodes.rs b/cranelift/codegen/src/ir/condcodes.rs index e791649bb69c..009f95bf391c 100644 --- a/cranelift/codegen/src/ir/condcodes.rs +++ b/cranelift/codegen/src/ir/condcodes.rs @@ -344,7 +344,7 @@ impl FromStr for FloatCC { #[cfg(test)] mod tests { use super::*; - use std::string::ToString; + use alloc::string::ToString; #[test] fn int_complement() { diff --git a/cranelift/codegen/src/ir/constant.rs b/cranelift/codegen/src/ir/constant.rs index a9ac61e06a02..67310cd9462f 100644 --- a/cranelift/codegen/src/ir/constant.rs +++ b/cranelift/codegen/src/ir/constant.rs @@ -272,7 +272,7 @@ impl ConstantPool { #[cfg(test)] mod tests { use super::*; - use std::string::ToString; + use alloc::string::ToString; #[test] fn empty() { diff --git a/cranelift/codegen/src/ir/extname.rs b/cranelift/codegen/src/ir/extname.rs index f29d854b1a44..d28ebcb4e7b2 100644 --- a/cranelift/codegen/src/ir/extname.rs +++ b/cranelift/codegen/src/ir/extname.rs @@ -99,7 +99,7 @@ pub struct TestcaseName(Box<[u8]>); impl fmt::Display for TestcaseName { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.write_char('%')?; - f.write_str(std::str::from_utf8(&self.0).unwrap()) + f.write_str(core::str::from_utf8(&self.0).unwrap()) } } diff --git a/cranelift/codegen/src/ir/instructions.rs b/cranelift/codegen/src/ir/instructions.rs index 2b94d9da1e33..80c04e48e6fb 100644 --- a/cranelift/codegen/src/ir/instructions.rs +++ b/cranelift/codegen/src/ir/instructions.rs @@ -429,7 +429,7 @@ impl InstructionData { exception_tables: &'a ir::ExceptionTables, ) -> &'a [BlockCall] { match self { - Self::Jump { destination, .. } => std::slice::from_ref(destination), + Self::Jump { destination, .. } => core::slice::from_ref(destination), Self::Brif { blocks, .. } => blocks.as_slice(), Self::BranchTable { table, .. } => jump_tables.get(*table).unwrap().all_branches(), Self::TryCall { exception, .. } | Self::TryCallIndirect { exception, .. } => { @@ -451,7 +451,7 @@ impl InstructionData { exception_tables: &'a mut ir::ExceptionTables, ) -> &'a mut [BlockCall] { match self { - Self::Jump { destination, .. } => std::slice::from_mut(destination), + Self::Jump { destination, .. } => core::slice::from_mut(destination), Self::Brif { blocks, .. } => blocks.as_mut_slice(), Self::BranchTable { table, .. } => { jump_tables.get_mut(*table).unwrap().all_branches_mut() @@ -1162,7 +1162,7 @@ mod tests { fn inst_data_size() { // The size of `InstructionData` is performance sensitive, so make sure // we don't regress it unintentionally. - assert_eq!(std::mem::size_of::(), 16); + assert_eq!(core::mem::size_of::(), 16); } #[test] diff --git a/cranelift/codegen/src/ir/jumptable.rs b/cranelift/codegen/src/ir/jumptable.rs index 5a26ef4e4768..5bdad87d941f 100644 --- a/cranelift/codegen/src/ir/jumptable.rs +++ b/cranelift/codegen/src/ir/jumptable.rs @@ -31,7 +31,7 @@ impl JumpTableData { /// Create a new jump table with the provided blocks. pub fn new(def: BlockCall, table: &[BlockCall]) -> Self { Self { - table: std::iter::once(def).chain(table.iter().copied()).collect(), + table: core::iter::once(def).chain(table.iter().copied()).collect(), } } @@ -114,8 +114,8 @@ mod tests { use crate::entity::EntityRef; use crate::ir::instructions::ValueListPool; use crate::ir::{Block, BlockArg, BlockCall, Value}; + use alloc::string::ToString; use alloc::vec::Vec; - use std::string::ToString; #[test] fn empty() { diff --git a/cranelift/codegen/src/ir/memtype.rs b/cranelift/codegen/src/ir/memtype.rs index 4df26f1647e5..b7b0d7e2db1e 100644 --- a/cranelift/codegen/src/ir/memtype.rs +++ b/cranelift/codegen/src/ir/memtype.rs @@ -108,14 +108,14 @@ pub enum MemoryTypeData { Empty, } -impl std::default::Default for MemoryTypeData { +impl core::default::Default for MemoryTypeData { fn default() -> Self { Self::Empty } } -impl std::fmt::Display for MemoryTypeData { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Display for MemoryTypeData { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { match self { Self::Struct { size, fields } => { write!(f, "struct {size} {{")?; diff --git a/cranelift/codegen/src/ir/pcc.rs b/cranelift/codegen/src/ir/pcc.rs index 4fb88fd02ebf..8b9a3cc6bb6e 100644 --- a/cranelift/codegen/src/ir/pcc.rs +++ b/cranelift/codegen/src/ir/pcc.rs @@ -77,14 +77,14 @@ use crate::ir::types::*; use crate::isa::TargetIsa; use crate::machinst::{BlockIndex, LowerBackend, VCode}; use crate::trace; +use core::fmt; use regalloc2::Function as _; -use std::fmt; #[cfg(feature = "enable-serde")] use serde_derive::{Deserialize, Serialize}; /// The result of checking proof-carrying-code facts. -pub type PccResult = std::result::Result; +pub type PccResult = core::result::Result; /// An error or inconsistency discovered when checking proof-carrying /// code. @@ -332,7 +332,7 @@ impl Expr { } else { Expr { base: BaseExpr::min(&lhs.base, &rhs.base), - offset: std::cmp::min(lhs.offset, rhs.offset), + offset: core::cmp::min(lhs.offset, rhs.offset), } } } @@ -347,7 +347,7 @@ impl Expr { } else { Expr { base: BaseExpr::max(&lhs.base, &rhs.base), - offset: std::cmp::max(lhs.offset, rhs.offset), + offset: core::cmp::max(lhs.offset, rhs.offset), } } } @@ -651,8 +651,8 @@ impl Fact { }, ) if bw_lhs == bw_rhs && max_lhs >= min_rhs && max_rhs >= min_lhs => Fact::Range { bit_width: *bw_lhs, - min: std::cmp::max(*min_lhs, *min_rhs), - max: std::cmp::min(*max_lhs, *max_rhs), + min: core::cmp::max(*min_lhs, *min_rhs), + max: core::cmp::min(*max_lhs, *max_rhs), }, ( @@ -693,8 +693,8 @@ impl Fact { { Fact::Mem { ty: *ty_lhs, - min_offset: std::cmp::max(*min_offset_lhs, *min_offset_rhs), - max_offset: std::cmp::min(*max_offset_lhs, *max_offset_rhs), + min_offset: core::cmp::max(*min_offset_lhs, *min_offset_rhs), + max_offset: core::cmp::min(*max_offset_lhs, *max_offset_rhs), nullable: *nullable_lhs && *nullable_rhs, } } @@ -910,7 +910,7 @@ impl<'a> FactContext<'a> { ) if bw_lhs == bw_rhs && add_width >= *bw_lhs => { let computed_min = min_lhs.checked_add(*min_rhs)?; let computed_max = max_lhs.checked_add(*max_rhs)?; - let computed_max = std::cmp::min(max_value_for_width(add_width), computed_max); + let computed_max = core::cmp::min(max_value_for_width(add_width), computed_max); Some(Fact::Range { bit_width: *bw_lhs, min: computed_min, diff --git a/cranelift/codegen/src/isa/aarch64/abi.rs b/cranelift/codegen/src/isa/aarch64/abi.rs index 20f8476a604a..8f1afce63a87 100644 --- a/cranelift/codegen/src/isa/aarch64/abi.rs +++ b/cranelift/codegen/src/isa/aarch64/abi.rs @@ -12,11 +12,11 @@ use crate::isa::unwind::UnwindInst; use crate::isa::winch; use crate::machinst::*; use crate::settings; +use alloc::borrow::ToOwned; use alloc::boxed::Box; use alloc::vec::Vec; use regalloc2::{MachineEnv, PReg, PRegSet}; use smallvec::{SmallVec, smallvec}; -use std::borrow::ToOwned; use std::sync::OnceLock; // We use a generic implementation that factors out AArch64 and x64 ABI commonalities, because @@ -348,7 +348,7 @@ impl ABIMachineSpec for AArch64MachineDeps { } else { // Every arg takes a minimum slot of 8 bytes. (16-byte stack // alignment happens separately after all args.) - std::cmp::max(size, 8) + core::cmp::max(size, 8) }; if !is_winch_return { diff --git a/cranelift/codegen/src/isa/aarch64/inst/imms.rs b/cranelift/codegen/src/isa/aarch64/inst/imms.rs index e408f26985a9..fcd67deed576 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/imms.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/imms.rs @@ -4,7 +4,7 @@ use crate::ir::types::*; use crate::isa::aarch64::inst::{OperandSize, ScalarSize}; use crate::machinst::PrettyPrint; -use std::string::String; +use alloc::string::String; /// An immediate that represents the NZCV flags. #[derive(Clone, Copy, Debug)] diff --git a/cranelift/codegen/src/isa/aarch64/inst/mod.rs b/cranelift/codegen/src/isa/aarch64/inst/mod.rs index cc5ff8eb3aec..90ba2ef0c75d 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/mod.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/mod.rs @@ -9,11 +9,11 @@ use crate::{CodegenError, CodegenResult, settings}; use crate::machinst::{PrettyPrint, Reg, RegClass, Writable}; +use alloc::string::{String, ToString}; use alloc::vec::Vec; +use core::fmt::Write; use core::slice; use smallvec::{SmallVec, smallvec}; -use std::fmt::Write; -use std::string::{String, ToString}; pub(crate) mod regs; pub(crate) use self::regs::*; @@ -3109,6 +3109,6 @@ mod tests { } else { 32 }; - assert_eq!(expected, std::mem::size_of::()); + assert_eq!(expected, core::mem::size_of::()); } } diff --git a/cranelift/codegen/src/isa/aarch64/inst/regs.rs b/cranelift/codegen/src/isa/aarch64/inst/regs.rs index f5a6eb526daf..7db69df4ebe4 100644 --- a/cranelift/codegen/src/isa/aarch64/inst/regs.rs +++ b/cranelift/codegen/src/isa/aarch64/inst/regs.rs @@ -8,7 +8,7 @@ use crate::machinst::{Reg, RegClass, Writable}; use regalloc2::PReg; use regalloc2::VReg; -use std::string::{String, ToString}; +use alloc::string::{String, ToString}; //============================================================================= // Registers, the Universe thereof, and printing diff --git a/cranelift/codegen/src/isa/aarch64/lower/isle.rs b/cranelift/codegen/src/isa/aarch64/lower/isle.rs index b372ace5cb2d..3e82af2a9c8e 100644 --- a/cranelift/codegen/src/isa/aarch64/lower/isle.rs +++ b/cranelift/codegen/src/isa/aarch64/lower/isle.rs @@ -31,10 +31,10 @@ use crate::{ abi::ArgPair, ty_bits, }, }; +use alloc::boxed::Box; +use alloc::vec::Vec; use core::u32; use regalloc2::PReg; -use std::boxed::Box; -use std::vec::Vec; type BoxCallInfo = Box>; type BoxCallIndInfo = Box>; @@ -237,7 +237,7 @@ impl Context for IsleContext<'_, '_, MInst, AArch64Backend> { fn lshl_from_u64(&mut self, ty: Type, n: u64) -> Option { let shiftimm = ShiftOpShiftImm::maybe_from_shift(n)?; let shiftee_bits = ty_bits(ty); - if shiftee_bits <= std::u8::MAX as usize { + if shiftee_bits <= core::u8::MAX as usize { let shiftimm = shiftimm.mask(shiftee_bits as u8); Some(ShiftOpAndAmt::new(ShiftOp::LSL, shiftimm)) } else { @@ -248,7 +248,7 @@ impl Context for IsleContext<'_, '_, MInst, AArch64Backend> { fn ashr_from_u64(&mut self, ty: Type, n: u64) -> Option { let shiftimm = ShiftOpShiftImm::maybe_from_shift(n)?; let shiftee_bits = ty_bits(ty); - if shiftee_bits <= std::u8::MAX as usize { + if shiftee_bits <= core::u8::MAX as usize { let shiftimm = shiftimm.mask(shiftee_bits as u8); Some(ShiftOpAndAmt::new(ShiftOp::ASR, shiftimm)) } else { diff --git a/cranelift/codegen/src/isa/aarch64/mod.rs b/cranelift/codegen/src/isa/aarch64/mod.rs index 892911edd833..2f80ad9fa29b 100644 --- a/cranelift/codegen/src/isa/aarch64/mod.rs +++ b/cranelift/codegen/src/isa/aarch64/mod.rs @@ -12,10 +12,10 @@ use crate::machinst::{ }; use crate::result::CodegenResult; use crate::settings as shared_settings; +use alloc::string::String; use alloc::{boxed::Box, vec::Vec}; use core::fmt; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::{Aarch64Architecture, Architecture, OperatingSystem, Triple}; // New backend: diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index 8728c299c1b4..2bc2033983ef 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -23,7 +23,7 @@ //! # #[macro_use] extern crate target_lexicon; //! use cranelift_codegen::isa; //! use cranelift_codegen::settings::{self, Configurable}; -//! use std::str::FromStr; +//! use core::str::FromStr; //! use target_lexicon::Triple; //! //! let shared_builder = settings::builder(); @@ -55,11 +55,11 @@ use crate::settings; use crate::settings::Configurable; use crate::settings::SetResult; use crate::{Reg, flowgraph}; +use alloc::string::String; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use core::fmt; use core::fmt::{Debug, Formatter}; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::{Architecture, PointerWidth, Triple, triple}; // This module is made public here for benchmarking purposes. No guarantees are @@ -146,7 +146,7 @@ pub enum LookupError { // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for LookupError {} +impl core::error::Error for LookupError {} impl fmt::Display for LookupError { fn fmt(&self, f: &mut Formatter) -> fmt::Result { diff --git a/cranelift/codegen/src/isa/pulley_shared/abi.rs b/cranelift/codegen/src/isa/pulley_shared/abi.rs index 3529408fb50e..de32099a14a7 100644 --- a/cranelift/codegen/src/isa/pulley_shared/abi.rs +++ b/cranelift/codegen/src/isa/pulley_shared/abi.rs @@ -9,12 +9,12 @@ use crate::{ machinst::*, settings, }; +use alloc::borrow::ToOwned; use alloc::vec::Vec; use core::marker::PhantomData; use cranelift_bitset::ScalarBitSet; use regalloc2::{MachineEnv, PReg, PRegSet}; use smallvec::{SmallVec, smallvec}; -use std::borrow::ToOwned; use std::sync::OnceLock; /// Support for the Pulley ABI from the callee side (within a function body). @@ -130,7 +130,7 @@ where // Compute size and 16-byte stack alignment happens // separately after all args. let size = reg_ty.bits() / 8; - let size = std::cmp::max(size, 8); + let size = core::cmp::max(size, 8); // Align. debug_assert!(size.is_power_of_two()); diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/args.rs b/cranelift/codegen/src/isa/pulley_shared/inst/args.rs index 6ddd6a09dc98..e97e3303ef99 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst/args.rs +++ b/cranelift/codegen/src/isa/pulley_shared/inst/args.rs @@ -3,9 +3,9 @@ use super::*; use crate::ir::ExternalName; use crate::machinst::abi::StackAMode; +use core::fmt; use pulley_interpreter::encode; use pulley_interpreter::regs::Reg as _; -use std::fmt; /// A macro for defining a newtype of `Reg` that enforces some invariant about /// the wrapped `Reg` (such as that it is of a particular register class). @@ -61,7 +61,7 @@ macro_rules! newtype_of_reg { // NB: We cannot implement `DerefMut` because that would let people do // nasty stuff like `*my_xreg.deref_mut() = some_freg`, breaking the // invariants that `XReg` provides. - impl std::ops::Deref for $newtype_reg { + impl core::ops::Deref for $newtype_reg { type Target = Reg; fn deref(&self) -> &Reg { diff --git a/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs b/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs index 9bf27e8b8aca..d76705a7fb9f 100644 --- a/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs +++ b/cranelift/codegen/src/isa/pulley_shared/inst/mod.rs @@ -611,7 +611,7 @@ const TRAP_OPCODE: &'static [u8] = &[ #[test] fn test_trap_encoding() { - let mut dst = std::vec::Vec::new(); + let mut dst = alloc::vec::Vec::new(); pulley_interpreter::encode::trap(&mut dst); assert_eq!(dst, TRAP_OPCODE); } diff --git a/cranelift/codegen/src/isa/pulley_shared/mod.rs b/cranelift/codegen/src/isa/pulley_shared/mod.rs index c3f16efa2b33..0b781e467a08 100644 --- a/cranelift/codegen/src/isa/pulley_shared/mod.rs +++ b/cranelift/codegen/src/isa/pulley_shared/mod.rs @@ -17,11 +17,11 @@ use crate::{ settings::{self as shared_settings, Flags}, }; use alloc::boxed::Box; +use alloc::string::String; use alloc::vec::Vec; use core::fmt::Debug; use core::marker::PhantomData; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::{Architecture, Triple}; pub use settings::Flags as PulleyFlags; diff --git a/cranelift/codegen/src/isa/riscv64/abi.rs b/cranelift/codegen/src/isa/riscv64/abi.rs index 129255219225..f53eee9a53a0 100644 --- a/cranelift/codegen/src/isa/riscv64/abi.rs +++ b/cranelift/codegen/src/isa/riscv64/abi.rs @@ -19,8 +19,8 @@ use alloc::boxed::Box; use alloc::vec::Vec; use regalloc2::{MachineEnv, PReg, PRegSet}; +use alloc::borrow::ToOwned; use smallvec::{SmallVec, smallvec}; -use std::borrow::ToOwned; use std::sync::OnceLock; /// Support for the Riscv64 ABI from the callee side (within a function body). @@ -59,7 +59,7 @@ impl RiscvFlags { // Due to a limitation in regalloc2, we can't support types // larger than 1024 bytes. So limit that here. - return std::cmp::min(size, 1024); + return core::cmp::min(size, 1024); } return 0; @@ -165,7 +165,7 @@ impl ABIMachineSpec for Riscv64MachineDeps { // Compute size and 16-byte stack alignment happens // separately after all args. let size = reg_ty.bits() / 8; - let size = std::cmp::max(size, 8); + let size = core::cmp::max(size, 8); // Align. debug_assert!(size.is_power_of_two()); next_stack = align_to(next_stack, size); diff --git a/cranelift/codegen/src/isa/riscv64/inst/args.rs b/cranelift/codegen/src/isa/riscv64/inst/args.rs index a4cca654296e..918a4854b3a3 100644 --- a/cranelift/codegen/src/isa/riscv64/inst/args.rs +++ b/cranelift/codegen/src/isa/riscv64/inst/args.rs @@ -8,7 +8,7 @@ use crate::isa::riscv64::lower::isle::generated_code::{ }; use crate::machinst::isle::WritableReg; -use std::fmt::Result; +use core::fmt::Result; /// A macro for defining a newtype of `Reg` that enforces some invariant about /// the wrapped `Reg` (such as that it is of a particular register class). @@ -53,7 +53,7 @@ macro_rules! newtype_of_reg { // NB: We cannot implement `DerefMut` because that would let people do // nasty stuff like `*my_xreg.deref_mut() = some_freg`, breaking the // invariants that `XReg` provides. - impl std::ops::Deref for $newtype_reg { + impl core::ops::Deref for $newtype_reg { type Target = Reg; fn deref(&self) -> &Reg { @@ -651,7 +651,7 @@ impl Display for FpuOPWidth { impl TryFrom for FpuOPWidth { type Error = &'static str; - fn try_from(value: Type) -> std::result::Result { + fn try_from(value: Type) -> core::result::Result { match value { F16 => Ok(FpuOPWidth::H), F32 => Ok(FpuOPWidth::S), diff --git a/cranelift/codegen/src/isa/riscv64/inst/emit_tests.rs b/cranelift/codegen/src/isa/riscv64/inst/emit_tests.rs index 9ad30a98d0be..3b0cf59b633f 100644 --- a/cranelift/codegen/src/isa/riscv64/inst/emit_tests.rs +++ b/cranelift/codegen/src/isa/riscv64/inst/emit_tests.rs @@ -1,6 +1,6 @@ use crate::isa::riscv64::inst::*; use crate::isa::riscv64::lower::isle::generated_code::FpuOPWidth; -use std::borrow::Cow; +use alloc::borrow::Cow; fn fa7() -> Reg { f_reg(17) diff --git a/cranelift/codegen/src/isa/riscv64/inst/imms.rs b/cranelift/codegen/src/isa/riscv64/inst/imms.rs index 1b9621231a1b..92a8ceb60b83 100644 --- a/cranelift/codegen/src/isa/riscv64/inst/imms.rs +++ b/cranelift/codegen/src/isa/riscv64/inst/imms.rs @@ -2,7 +2,7 @@ // Some variants are never constructed, but we still want them as options in the future. use super::Inst; -use std::fmt::{Debug, Display, Formatter, Result}; +use core::fmt::{Debug, Display, Formatter, Result}; #[derive(Copy, Clone, Debug, Default)] pub struct Imm12 { diff --git a/cranelift/codegen/src/isa/riscv64/inst/mod.rs b/cranelift/codegen/src/isa/riscv64/inst/mod.rs index 2521e8d358b9..9349d64cd08f 100644 --- a/cranelift/codegen/src/isa/riscv64/inst/mod.rs +++ b/cranelift/codegen/src/isa/riscv64/inst/mod.rs @@ -12,12 +12,12 @@ use crate::{CodegenError, CodegenResult, settings}; pub use crate::ir::condcodes::FloatCC; +use alloc::boxed::Box; +use alloc::string::{String, ToString}; use alloc::vec::Vec; +use core::fmt::Write; use regalloc2::RegClass; use smallvec::{SmallVec, smallvec}; -use std::boxed::Box; -use std::fmt::Write; -use std::string::{String, ToString}; pub mod regs; pub use self::regs::*; @@ -38,7 +38,7 @@ use crate::isa::riscv64::abi::Riscv64MachineDeps; #[cfg(test)] mod emit_tests; -use std::fmt::{Display, Formatter}; +use core::fmt::{Display, Formatter}; pub(crate) type VecU8 = Vec; @@ -85,7 +85,7 @@ impl CondBrTarget { } impl Display for CondBrTarget { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { match self { CondBrTarget::Label(l) => write!(f, "{}", l.to_string()), CondBrTarget::Fallthrough => write!(f, "0"), diff --git a/cranelift/codegen/src/isa/riscv64/lower/isle.rs b/cranelift/codegen/src/isa/riscv64/lower/isle.rs index 87bf480f2f5f..a2a7d0c196e6 100644 --- a/cranelift/codegen/src/isa/riscv64/lower/isle.rs +++ b/cranelift/codegen/src/isa/riscv64/lower/isle.rs @@ -21,9 +21,9 @@ use crate::{ isa::riscv64::inst::*, machinst::{ArgPair, CallArgList, CallRetList, InstOutput}, }; +use alloc::boxed::Box; +use alloc::vec::Vec; use regalloc2::PReg; -use std::boxed::Box; -use std::vec::Vec; use wasmtime_math::{f32_cvt_to_int_bounds, f64_cvt_to_int_bounds}; type BoxCallInfo = Box>; diff --git a/cranelift/codegen/src/isa/riscv64/mod.rs b/cranelift/codegen/src/isa/riscv64/mod.rs index 873b69851090..ca0a1a13e2e9 100644 --- a/cranelift/codegen/src/isa/riscv64/mod.rs +++ b/cranelift/codegen/src/isa/riscv64/mod.rs @@ -13,10 +13,10 @@ use crate::machinst::{ use crate::result::CodegenResult; use crate::settings::{self as shared_settings, Flags}; use crate::{CodegenError, ir}; +use alloc::string::String; use alloc::{boxed::Box, vec::Vec}; use core::fmt; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::{Architecture, Triple}; mod abi; pub(crate) mod inst; diff --git a/cranelift/codegen/src/isa/s390x/abi.rs b/cranelift/codegen/src/isa/s390x/abi.rs index 7b8ad6da166e..738e037047d3 100644 --- a/cranelift/codegen/src/isa/s390x/abi.rs +++ b/cranelift/codegen/src/isa/s390x/abi.rs @@ -144,10 +144,10 @@ use crate::isa::s390x::{inst::*, settings as s390x_settings}; use crate::isa::unwind::UnwindInst; use crate::machinst::*; use crate::settings; +use alloc::borrow::ToOwned; use alloc::vec::Vec; use regalloc2::{MachineEnv, PRegSet}; use smallvec::{SmallVec, smallvec}; -use std::borrow::ToOwned; use std::sync::OnceLock; // We use a generic implementation that factors out ABI commonalities. @@ -399,11 +399,11 @@ impl ABIMachineSpec for S390xMachineDeps { // Compute size. Every argument or return value takes a slot of // at least 8 bytes. let size = (ty_bits(param.value_type) / 8) as u32; - let slot_size = std::cmp::max(size, 8); + let slot_size = core::cmp::max(size, 8); // Align the stack slot. debug_assert!(slot_size.is_power_of_two()); - let slot_align = std::cmp::min(slot_size, 8); + let slot_align = core::cmp::min(slot_size, 8); next_stack = align_to(next_stack, slot_align); // If the type is actually of smaller size (and the argument diff --git a/cranelift/codegen/src/isa/s390x/inst/imms.rs b/cranelift/codegen/src/isa/s390x/inst/imms.rs index 8ceebbcdac15..9559f34ac7f8 100644 --- a/cranelift/codegen/src/isa/s390x/inst/imms.rs +++ b/cranelift/codegen/src/isa/s390x/inst/imms.rs @@ -1,7 +1,7 @@ //! S390x ISA definitions: immediate constants. use crate::machinst::PrettyPrint; -use std::string::String; +use alloc::string::String; /// An unsigned 12-bit immediate. #[derive(Clone, Copy, Debug)] diff --git a/cranelift/codegen/src/isa/s390x/inst/mod.rs b/cranelift/codegen/src/isa/s390x/inst/mod.rs index 1e9c0aeb72be..762f6c58d27e 100644 --- a/cranelift/codegen/src/isa/s390x/inst/mod.rs +++ b/cranelift/codegen/src/isa/s390x/inst/mod.rs @@ -7,10 +7,10 @@ use crate::isa::{CallConv, FunctionAlignment}; use crate::machinst::*; use crate::{CodegenError, CodegenResult, settings}; use alloc::boxed::Box; +use alloc::string::{String, ToString}; use alloc::vec::Vec; +use core::fmt::Write; use smallvec::SmallVec; -use std::fmt::Write; -use std::string::{String, ToString}; pub mod regs; pub use self::regs::*; pub mod imms; @@ -55,7 +55,7 @@ pub struct ReturnCallInfo { fn inst_size_test() { // This test will help with unintentionally growing the size // of the Inst enum. - assert_eq!(32, std::mem::size_of::()); + assert_eq!(32, core::mem::size_of::()); } /// A register pair. Enum so it can be destructured in ISLE. diff --git a/cranelift/codegen/src/isa/s390x/lower/isle.rs b/cranelift/codegen/src/isa/s390x/lower/isle.rs index b4bbbc7ec9c1..561fabd9561e 100644 --- a/cranelift/codegen/src/isa/s390x/lower/isle.rs +++ b/cranelift/codegen/src/isa/s390x/lower/isle.rs @@ -23,10 +23,10 @@ use crate::{ ArgPair, CallArgList, CallRetList, InstOutput, MachInst, VCodeConstant, VCodeConstantData, }, }; +use alloc::boxed::Box; +use alloc::vec::Vec; +use core::cell::Cell; use regalloc2::PReg; -use std::boxed::Box; -use std::cell::Cell; -use std::vec::Vec; type BoxCallInfo = Box>; type BoxReturnCallInfo = Box>; @@ -631,7 +631,7 @@ impl generated_code::Context for IsleContext<'_, '_, MInst, S390xBackend> { #[inline] fn fcvt_to_sint_lb32(&mut self, size: u8) -> u64 { let lb = (-2.0_f32).powi((size - 1).into()); - std::cmp::max(lb.to_bits() + 1, (lb - 1.0).to_bits()) as u64 + core::cmp::max(lb.to_bits() + 1, (lb - 1.0).to_bits()) as u64 } #[inline] @@ -642,7 +642,7 @@ impl generated_code::Context for IsleContext<'_, '_, MInst, S390xBackend> { #[inline] fn fcvt_to_sint_lb64(&mut self, size: u8) -> u64 { let lb = (-2.0_f64).powi((size - 1).into()); - std::cmp::max(lb.to_bits() + 1, (lb - 1.0).to_bits()) + core::cmp::max(lb.to_bits() + 1, (lb - 1.0).to_bits()) } #[inline] diff --git a/cranelift/codegen/src/isa/s390x/mod.rs b/cranelift/codegen/src/isa/s390x/mod.rs index 8768b4eebf84..6bc40484153d 100644 --- a/cranelift/codegen/src/isa/s390x/mod.rs +++ b/cranelift/codegen/src/isa/s390x/mod.rs @@ -12,10 +12,10 @@ use crate::machinst::{ }; use crate::result::CodegenResult; use crate::settings as shared_settings; +use alloc::string::String; use alloc::{boxed::Box, vec::Vec}; use core::fmt; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::{Architecture, Triple}; // New backend: diff --git a/cranelift/codegen/src/isa/unwind/systemv.rs b/cranelift/codegen/src/isa/unwind/systemv.rs index d85694e87852..5989e0b2a12b 100644 --- a/cranelift/codegen/src/isa/unwind/systemv.rs +++ b/cranelift/codegen/src/isa/unwind/systemv.rs @@ -23,10 +23,10 @@ pub enum RegisterMappingError { // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for RegisterMappingError {} +impl core::error::Error for RegisterMappingError {} -impl std::fmt::Display for RegisterMappingError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Display for RegisterMappingError { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { match self { RegisterMappingError::MissingBank => write!(f, "unable to find bank for register info"), RegisterMappingError::UnsupportedArchitecture => write!( diff --git a/cranelift/codegen/src/isa/winch.rs b/cranelift/codegen/src/isa/winch.rs index c37ddd373ee0..df8fdce35223 100644 --- a/cranelift/codegen/src/isa/winch.rs +++ b/cranelift/codegen/src/isa/winch.rs @@ -8,7 +8,7 @@ pub(super) fn reverse_stack(mut args: ArgsAccumulator, next_stack: u32, uses_ext for slot in slots.iter_mut() { if let ABIArgSlot::Stack { offset, ty, .. } = slot { let size = if uses_extension { - i64::from(std::cmp::max(ty.bytes(), 8)) + i64::from(core::cmp::max(ty.bytes(), 8)) } else { i64::from(ty.bytes()) }; diff --git a/cranelift/codegen/src/isa/x64/abi.rs b/cranelift/codegen/src/isa/x64/abi.rs index 81897510640d..b3a8dfed44a0 100644 --- a/cranelift/codegen/src/isa/x64/abi.rs +++ b/cranelift/codegen/src/isa/x64/abi.rs @@ -9,13 +9,13 @@ use crate::isa::{CallConv, unwind::UnwindInst, x64::inst::*, x64::settings as x6 use crate::machinst::abi::*; use crate::machinst::*; use crate::settings; +use alloc::borrow::ToOwned; use alloc::boxed::Box; use alloc::vec::Vec; use args::*; use cranelift_assembler_x64 as asm; use regalloc2::{MachineEnv, PReg, PRegSet}; use smallvec::{SmallVec, smallvec}; -use std::borrow::ToOwned; use std::sync::OnceLock; /// Support for the x64 ABI from the callee side (within a function body). @@ -358,7 +358,7 @@ impl ABIMachineSpec for X64ABIMachineSpec { { size } else { - let size = std::cmp::max(size, 8); + let size = core::cmp::max(size, 8); // Align. debug_assert!(size.is_power_of_two()); diff --git a/cranelift/codegen/src/isa/x64/inst/args.rs b/cranelift/codegen/src/isa/x64/inst/args.rs index c34983643e87..233299966a16 100644 --- a/cranelift/codegen/src/isa/x64/inst/args.rs +++ b/cranelift/codegen/src/isa/x64/inst/args.rs @@ -7,8 +7,8 @@ use crate::ir::types::*; use crate::isa::x64::inst::Inst; use crate::isa::x64::inst::regs::pretty_print_reg; use crate::machinst::*; -use std::fmt; -use std::string::String; +use alloc::string::String; +use core::fmt; /// An extension trait for converting `Writable{Xmm,Gpr}` to `Writable`. pub trait ToWritableReg { @@ -87,7 +87,7 @@ macro_rules! newtype_of_reg { // NB: We cannot implement `DerefMut` because that would let people do // nasty stuff like `*my_gpr.deref_mut() = some_xmm_reg`, breaking the // invariants that `Gpr` provides. - impl std::ops::Deref for $newtype_reg { + impl core::ops::Deref for $newtype_reg { type Target = Reg; fn deref(&self) -> &Reg { diff --git a/cranelift/codegen/src/isa/x64/inst/emit.rs b/cranelift/codegen/src/isa/x64/inst/emit.rs index 406f9961f7ca..363f9194bd6f 100644 --- a/cranelift/codegen/src/isa/x64/inst/emit.rs +++ b/cranelift/codegen/src/isa/x64/inst/emit.rs @@ -735,7 +735,7 @@ pub(crate) fn emit( // Emit jump table (table of 32-bit offsets). sink.bind_label(start_of_jumptable, state.ctrl_plane_mut()); let jt_off = sink.cur_offset(); - for &target in targets.iter().chain(std::iter::once(default_target)) { + for &target in targets.iter().chain(core::iter::once(default_target)) { let word_off = sink.cur_offset(); // off_into_table is an addend here embedded in the label to be later patched at // the end of codegen. The offset is initially relative to this jump table entry; diff --git a/cranelift/codegen/src/isa/x64/inst/external.rs b/cranelift/codegen/src/isa/x64/inst/external.rs index 2394103a63f6..8d41f2e6d484 100644 --- a/cranelift/codegen/src/isa/x64/inst/external.rs +++ b/cranelift/codegen/src/isa/x64/inst/external.rs @@ -5,9 +5,9 @@ use super::{ SyntheticAmode, VCodeConstant, WritableGpr, WritableXmm, Xmm, args::FromWritableReg, }; use crate::{Reg, Writable, ir::TrapCode}; +use alloc::string::String; use cranelift_assembler_x64 as asm; use regalloc2::{PReg, RegClass}; -use std::string::String; /// Define the types of registers Cranelift will use. #[derive(Clone, Debug)] diff --git a/cranelift/codegen/src/isa/x64/inst/mod.rs b/cranelift/codegen/src/isa/x64/inst/mod.rs index 298dc938b235..8bff031e3fc4 100644 --- a/cranelift/codegen/src/isa/x64/inst/mod.rs +++ b/cranelift/codegen/src/isa/x64/inst/mod.rs @@ -11,13 +11,13 @@ use crate::isa::{CallConv, FunctionAlignment}; use crate::{CodegenError, CodegenResult, settings}; use crate::{machinst::*, trace}; use alloc::boxed::Box; +use alloc::string::{String, ToString}; use alloc::vec; use alloc::vec::Vec; +use core::fmt::{self, Write}; use core::slice; use cranelift_assembler_x64 as asm; use smallvec::{SmallVec, smallvec}; -use std::fmt::{self, Write}; -use std::string::{String, ToString}; pub mod args; mod emit; @@ -60,7 +60,7 @@ pub struct ReturnCallInfo { fn inst_size_test() { // This test will help with unintentionally growing the size // of the Inst enum. - assert_eq!(48, std::mem::size_of::()); + assert_eq!(48, core::mem::size_of::()); } impl Inst { @@ -1384,7 +1384,7 @@ impl MachInst for Inst { } fn gen_nop(preferred_size: usize) -> Inst { - Inst::nop(std::cmp::min(preferred_size, 9) as u8) + Inst::nop(core::cmp::min(preferred_size, 9) as u8) } fn gen_nop_units() -> Vec> { diff --git a/cranelift/codegen/src/isa/x64/inst/regs.rs b/cranelift/codegen/src/isa/x64/inst/regs.rs index f4c0fc2abbfc..b1416e88df5c 100644 --- a/cranelift/codegen/src/isa/x64/inst/regs.rs +++ b/cranelift/codegen/src/isa/x64/inst/regs.rs @@ -6,10 +6,10 @@ //! Note also that we make use of pinned VRegs to refer to PRegs. use crate::machinst::Reg; +use alloc::string::String; use alloc::string::ToString; use cranelift_assembler_x64::{gpr, xmm}; use regalloc2::{PReg, RegClass, VReg}; -use std::string::String; // Constructors for Regs. diff --git a/cranelift/codegen/src/isa/x64/lower.rs b/cranelift/codegen/src/isa/x64/lower.rs index 522a155ff1f4..a000f8ece143 100644 --- a/cranelift/codegen/src/isa/x64/lower.rs +++ b/cranelift/codegen/src/isa/x64/lower.rs @@ -16,7 +16,7 @@ use crate::machinst::lower::*; use crate::machinst::*; use crate::result::CodegenResult; use crate::settings::Flags; -use std::boxed::Box; +use alloc::boxed::Box; use target_lexicon::Triple; /// Identifier for a particular input of an instruction. diff --git a/cranelift/codegen/src/isa/x64/lower/isle.rs b/cranelift/codegen/src/isa/x64/lower/isle.rs index 073284605ef7..57bfa06ee7fd 100644 --- a/cranelift/codegen/src/isa/x64/lower/isle.rs +++ b/cranelift/codegen/src/isa/x64/lower/isle.rs @@ -22,10 +22,10 @@ use crate::machinst::{ ArgPair, CallArgList, CallInfo, CallRetList, InstOutput, MachInst, VCodeConstant, VCodeConstantData, }; +use alloc::boxed::Box; use alloc::vec::Vec; use cranelift_assembler_x64 as asm; use regalloc2::PReg; -use std::boxed::Box; /// Type representing out-of-line data for calls. This type optional because the /// call instruction is also used by Winch to emit calls, but the diff --git a/cranelift/codegen/src/isa/x64/mod.rs b/cranelift/codegen/src/isa/x64/mod.rs index 0edaf5ccb79c..37a386504347 100644 --- a/cranelift/codegen/src/isa/x64/mod.rs +++ b/cranelift/codegen/src/isa/x64/mod.rs @@ -16,10 +16,10 @@ use crate::machinst::{ use crate::result::{CodegenError, CodegenResult}; use crate::settings::{self as shared_settings, Flags}; use crate::{Final, MachBufferFinalized}; +use alloc::string::String; use alloc::{borrow::ToOwned, boxed::Box, vec::Vec}; use core::fmt; use cranelift_control::ControlPlane; -use std::string::String; use target_lexicon::Triple; mod abi; diff --git a/cranelift/codegen/src/isle_prelude.rs b/cranelift/codegen/src/isle_prelude.rs index 6a9a57db40bf..a2b58b15431d 100644 --- a/cranelift/codegen/src/isle_prelude.rs +++ b/cranelift/codegen/src/isle_prelude.rs @@ -130,7 +130,7 @@ macro_rules! isle_common_prelude_methods { #[inline] fn i64_sextend_u64(&mut self, ty: Type, x: u64) -> i64 { - let shift_amt = std::cmp::max(0, 64 - ty.bits()); + let shift_amt = core::cmp::max(0, 64 - ty.bits()); ((x as i64) << shift_amt) >> shift_amt } @@ -167,7 +167,7 @@ macro_rules! isle_common_prelude_methods { #[inline] fn ty_bits(&mut self, ty: Type) -> u8 { - use std::convert::TryInto; + use core::convert::TryInto; ty.bits().try_into().unwrap() } diff --git a/cranelift/codegen/src/legalizer/globalvalue.rs b/cranelift/codegen/src/legalizer/globalvalue.rs index d829302fbd81..45444d161934 100644 --- a/cranelift/codegen/src/legalizer/globalvalue.rs +++ b/cranelift/codegen/src/legalizer/globalvalue.rs @@ -50,7 +50,7 @@ fn const_vector_scale( assert!(ty.bytes() <= 16); // Use a minimum of 128-bits for the base type. - let base_bytes = std::cmp::max(ty.bytes(), 16); + let base_bytes = core::cmp::max(ty.bytes(), 16); let scale = (isa.dynamic_vector_bytes(ty) / base_bytes) as i64; assert!(scale > 0); let pos = FuncCursor::new(func).at_inst(inst); diff --git a/cranelift/codegen/src/loop_analysis.rs b/cranelift/codegen/src/loop_analysis.rs index b9ac3a7c6a38..5d88c519af5a 100644 --- a/cranelift/codegen/src/loop_analysis.rs +++ b/cranelift/codegen/src/loop_analysis.rs @@ -62,13 +62,13 @@ impl LoopLevel { /// A clamped loop level from a larger-width (usize) depth. pub fn clamped(level: usize) -> Self { Self( - u8::try_from(std::cmp::min(level, (Self::INVALID as usize) - 1)) + u8::try_from(core::cmp::min(level, (Self::INVALID as usize) - 1)) .expect("Clamped value must always convert"), ) } } -impl std::default::Default for LoopLevel { +impl core::default::Default for LoopLevel { fn default() -> Self { LoopLevel::invalid() } diff --git a/cranelift/codegen/src/machinst/abi.rs b/cranelift/codegen/src/machinst/abi.rs index e8949062f457..60ea23445e1f 100644 --- a/cranelift/codegen/src/machinst/abi.rs +++ b/cranelift/codegen/src/machinst/abi.rs @@ -99,6 +99,7 @@ //! ABI. See each platform's `abi.rs` implementation for details. use crate::CodegenError; +use crate::HashMap; use crate::entity::SecondaryMap; use crate::ir::{ArgumentExtension, ArgumentPurpose, ExceptionTag, Signature}; use crate::ir::{StackSlotKey, types::*}; @@ -107,11 +108,10 @@ use crate::settings::ProbestackStrategy; use crate::{ir, isa}; use crate::{machinst::*, trace}; use alloc::boxed::Box; +use core::marker::PhantomData; use regalloc2::{MachineEnv, PReg, PRegSet}; use rustc_hash::FxHashMap; use smallvec::smallvec; -use std::collections::HashMap; -use std::marker::PhantomData; /// A small vector of instructions (with some reasonable size); appropriate for /// a small fixed sequence implementing one operation. @@ -1022,7 +1022,7 @@ impl SigSet { // NB: we do _not_ implement `IndexMut` because these signatures are // deduplicated and shared! -impl std::ops::Index for SigSet { +impl core::ops::Index for SigSet { type Output = SigData; fn index(&self, sig: Sig) -> &Self::Output { @@ -1244,7 +1244,7 @@ impl Callee { // We always at least machine-word-align slots, but also // satisfy the user's requested alignment. debug_assert!(data.align_shift < 32); - let align = std::cmp::max(M::word_bytes(), 1u32 << data.align_shift); + let align = core::cmp::max(M::word_bytes(), 1u32 << data.align_shift); let mask = align - 1; let start_offset = checked_round_up(unaligned_start_offset, mask) .ok_or(CodegenError::ImplLimitExceeded)?; @@ -2183,7 +2183,7 @@ impl Callee { // establishes live-ranges for in-register arguments and // constrains them at the start of the function to the // locations defined by the ABI. - Some(M::gen_args(std::mem::take(&mut self.reg_args))) + Some(M::gen_args(core::mem::take(&mut self.reg_args))) } else { None } @@ -2612,6 +2612,6 @@ mod tests { fn sig_data_size() { // The size of `SigData` is performance sensitive, so make sure // we don't regress it unintentionally. - assert_eq!(std::mem::size_of::(), 24); + assert_eq!(core::mem::size_of::(), 24); } } diff --git a/cranelift/codegen/src/machinst/blockorder.rs b/cranelift/codegen/src/machinst/blockorder.rs index e41f1fa4f14c..9e48e2c4d607 100644 --- a/cranelift/codegen/src/machinst/blockorder.rs +++ b/cranelift/codegen/src/machinst/blockorder.rs @@ -78,7 +78,7 @@ pub struct BlockLoweringOrder { lowered_succ_indices: Vec, /// Ranges in `lowered_succ_indices` giving the successor lists for each lowered /// block. Indexed by lowering-order index (`BlockIndex`). - lowered_succ_ranges: Vec<(Option, std::ops::Range)>, + lowered_succ_ranges: Vec<(Option, core::ops::Range)>, /// BlockIndex for each original Block. blockindex_by_block: SecondaryMap, /// Cold blocks. These blocks are not reordered in the diff --git a/cranelift/codegen/src/machinst/buffer.rs b/cranelift/codegen/src/machinst/buffer.rs index f386e2af50b5..abd5396178db 100644 --- a/cranelift/codegen/src/machinst/buffer.rs +++ b/cranelift/codegen/src/machinst/buffer.rs @@ -180,15 +180,15 @@ use crate::machinst::{ use crate::trace; use crate::{MachInstEmitState, ir}; use crate::{VCodeConstantData, timing}; +use alloc::collections::BinaryHeap; +use alloc::string::String; +use alloc::vec::Vec; +use core::cmp::Ordering; +use core::mem; use core::ops::Range; use cranelift_control::ControlPlane; use cranelift_entity::{PrimaryMap, SecondaryMap, entity_impl}; use smallvec::SmallVec; -use std::cmp::Ordering; -use std::collections::BinaryHeap; -use std::mem; -use std::string::String; -use std::vec::Vec; #[cfg(feature = "enable-serde")] use serde::{Deserialize, Serialize}; @@ -1820,7 +1820,7 @@ impl MachBufferFinalized { /// Return the code in this mach buffer as a hex string for testing purposes. pub fn stringify_code_bytes(&self) -> String { // This is pretty lame, but whatever .. - use std::fmt::Write; + use core::fmt::Write; let mut s = String::with_capacity(self.data.len() * 2); for b in &self.data { write!(&mut s, "{b:02X}").unwrap(); diff --git a/cranelift/codegen/src/machinst/helpers.rs b/cranelift/codegen/src/machinst/helpers.rs index 411af0cdc7f9..01f397c8c67f 100644 --- a/cranelift/codegen/src/machinst/helpers.rs +++ b/cranelift/codegen/src/machinst/helpers.rs @@ -1,7 +1,7 @@ //! Miscellaneous helpers for machine backends. use crate::ir::Type; -use std::ops::{Add, BitAnd, Not, Sub}; +use core::ops::{Add, BitAnd, Not, Sub}; /// Returns the size (in bits) of a given type. pub fn ty_bits(ty: Type) -> usize { diff --git a/cranelift/codegen/src/machinst/isle.rs b/cranelift/codegen/src/machinst/isle.rs index ee8b29ceafcb..f73ede5b257b 100644 --- a/cranelift/codegen/src/machinst/isle.rs +++ b/cranelift/codegen/src/machinst/isle.rs @@ -218,7 +218,7 @@ macro_rules! isle_lower_prelude_methods { _ => return None, }; let ty = self.lower_ctx.output_ty(inst, 0); - let shift_amt = std::cmp::max(0, 64 - self.ty_bits(ty)); + let shift_amt = core::cmp::max(0, 64 - self.ty_bits(ty)); Some((constant << shift_amt) >> shift_amt) } @@ -760,7 +760,7 @@ macro_rules! isle_lower_prelude_methods { &mut self, targets: &MachLabelSlice, ) -> Option<(MachLabel, BoxVecMachLabel)> { - use std::boxed::Box; + use alloc::boxed::Box; if targets.is_empty() { return None; } diff --git a/cranelift/codegen/src/machinst/lower.rs b/cranelift/codegen/src/machinst/lower.rs index e94d26186093..4c55b018c841 100644 --- a/cranelift/codegen/src/machinst/lower.rs +++ b/cranelift/codegen/src/machinst/lower.rs @@ -23,10 +23,10 @@ use crate::machinst::{ use crate::settings::Flags; use crate::{CodegenError, CodegenResult, trace}; use alloc::vec::Vec; +use core::fmt::Debug; use cranelift_control::ControlPlane; use rustc_hash::{FxHashMap, FxHashSet}; use smallvec::{SmallVec, smallvec}; -use std::fmt::Debug; use super::{VCodeBuildDirection, VRegAllocator}; diff --git a/cranelift/codegen/src/machinst/mod.rs b/cranelift/codegen/src/machinst/mod.rs index f534ddb87a28..c327803d5fb3 100644 --- a/cranelift/codegen/src/machinst/mod.rs +++ b/cranelift/codegen/src/machinst/mod.rs @@ -53,13 +53,13 @@ use crate::result::CodegenResult; use crate::settings; use crate::settings::Flags; use crate::value_label::ValueLabelsRanges; +use alloc::string::String; use alloc::vec::Vec; use core::fmt::Debug; use cranelift_control::ControlPlane; use cranelift_entity::PrimaryMap; use regalloc2::VReg; use smallvec::{SmallVec, smallvec}; -use std::string::String; #[cfg(feature = "enable-serde")] use serde_derive::{Deserialize, Serialize}; @@ -444,7 +444,7 @@ impl CompiledCodeBase { params: Option<&crate::ir::function::FunctionParameters>, cs: &capstone::Capstone, ) -> Result { - use std::fmt::Write; + use core::fmt::Write; let mut buf = String::new(); diff --git a/cranelift/codegen/src/machinst/reg.rs b/cranelift/codegen/src/machinst/reg.rs index f60afcf7d077..dd28ee05f4c8 100644 --- a/cranelift/codegen/src/machinst/reg.rs +++ b/cranelift/codegen/src/machinst/reg.rs @@ -111,8 +111,8 @@ impl Reg { } } -impl std::fmt::Debug for Reg { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Debug for Reg { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { if VReg::from(self.0) == VReg::invalid() { write!(f, "") } else if let Some(spillslot) = self.to_spillslot() { @@ -153,8 +153,8 @@ impl RealReg { } } -impl std::fmt::Debug for RealReg { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Debug for RealReg { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { Reg::from(*self).fmt(f) } } @@ -179,8 +179,8 @@ impl VirtualReg { } } -impl std::fmt::Debug for VirtualReg { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Debug for VirtualReg { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { Reg::from(*self).fmt(f) } } @@ -243,20 +243,20 @@ impl cranelift_assembler_x64::AsReg for Writa // Conversions between regalloc2 types (VReg, PReg) and our types // (VirtualReg, RealReg, Reg). -impl std::convert::From for Reg { +impl core::convert::From for Reg { fn from(vreg: regalloc2::VReg) -> Reg { Reg(vreg.bits() as u32) } } -impl std::convert::From for VirtualReg { +impl core::convert::From for VirtualReg { fn from(vreg: regalloc2::VReg) -> VirtualReg { debug_assert!(pinned_vreg_to_preg(vreg).is_none()); VirtualReg(vreg) } } -impl std::convert::From for regalloc2::VReg { +impl core::convert::From for regalloc2::VReg { /// Extract the underlying `regalloc2::VReg`. Note that physical /// registers also map to particular (special) VRegs, so this /// method can be used either on virtual or physical `Reg`s. @@ -264,19 +264,19 @@ impl std::convert::From for regalloc2::VReg { reg.0.into() } } -impl std::convert::From<&Reg> for regalloc2::VReg { +impl core::convert::From<&Reg> for regalloc2::VReg { fn from(reg: &Reg) -> regalloc2::VReg { reg.0.into() } } -impl std::convert::From for regalloc2::VReg { +impl core::convert::From for regalloc2::VReg { fn from(reg: VirtualReg) -> regalloc2::VReg { reg.0 } } -impl std::convert::From for regalloc2::VReg { +impl core::convert::From for regalloc2::VReg { fn from(reg: RealReg) -> regalloc2::VReg { // This representation is redundant: the class is implied in the vreg // index as well as being in the vreg class field. @@ -284,31 +284,31 @@ impl std::convert::From for regalloc2::VReg { } } -impl std::convert::From for regalloc2::PReg { +impl core::convert::From for regalloc2::PReg { fn from(reg: RealReg) -> regalloc2::PReg { reg.0 } } -impl std::convert::From for RealReg { +impl core::convert::From for RealReg { fn from(preg: regalloc2::PReg) -> RealReg { RealReg(preg) } } -impl std::convert::From for Reg { +impl core::convert::From for Reg { fn from(preg: regalloc2::PReg) -> Reg { RealReg(preg).into() } } -impl std::convert::From for Reg { +impl core::convert::From for Reg { fn from(reg: RealReg) -> Reg { Reg(VReg::from(reg).bits() as u32) } } -impl std::convert::From for Reg { +impl core::convert::From for Reg { fn from(reg: VirtualReg) -> Reg { Reg(reg.0.bits() as u32) } @@ -317,7 +317,7 @@ impl std::convert::From for Reg { /// A spill slot. pub type SpillSlot = regalloc2::SpillSlot; -impl std::convert::From for Reg { +impl core::convert::From for Reg { fn from(spillslot: regalloc2::SpillSlot) -> Reg { Reg(REG_SPILLSLOT_BIT | spillslot.index() as u32) } diff --git a/cranelift/codegen/src/machinst/valueregs.rs b/cranelift/codegen/src/machinst/valueregs.rs index 53eacea5d067..8a684d868f86 100644 --- a/cranelift/codegen/src/machinst/valueregs.rs +++ b/cranelift/codegen/src/machinst/valueregs.rs @@ -4,7 +4,7 @@ use regalloc2::{PReg, VReg}; use super::{RealReg, Reg, VirtualReg, Writable}; -use std::fmt::Debug; +use core::fmt::Debug; const VALUE_REGS_PARTS: usize = 2; diff --git a/cranelift/codegen/src/machinst/vcode.rs b/cranelift/codegen/src/machinst/vcode.rs index 9bb44e43d50f..596d720e4e82 100644 --- a/cranelift/codegen/src/machinst/vcode.rs +++ b/cranelift/codegen/src/machinst/vcode.rs @@ -31,13 +31,13 @@ use regalloc2::{ }; use rustc_hash::FxHashMap; +use crate::HashMap; +use crate::hash_map::Entry; use core::cmp::Ordering; use core::fmt::{self, Write}; use core::mem::take; use core::ops::Range; use cranelift_entity::{Keys, entity_impl}; -use std::collections::HashMap; -use std::collections::hash_map::Entry; /// Index referring to an instruction in VCode. pub type InsnIndex = regalloc2::Inst; @@ -808,7 +808,7 @@ impl VCode { let mut cur_srcloc = None; let mut last_offset = None; let mut inst_offsets = vec![]; - let mut state = I::State::new(&self.abi, std::mem::take(ctrl_plane)); + let mut state = I::State::new(&self.abi, core::mem::take(ctrl_plane)); let mut disasm = String::new(); @@ -1552,7 +1552,7 @@ impl VCode { } } -impl std::ops::Index for VCode { +impl core::ops::Index for VCode { type Output = I; fn index(&self, idx: InsnIndex) -> &Self::Output { &self.insts[idx.index()] @@ -2040,7 +2040,7 @@ impl VCodeConstantData { #[cfg(test)] mod test { use super::*; - use std::mem::size_of; + use core::mem::size_of; #[test] fn size_of_constant_structs() { diff --git a/cranelift/codegen/src/opts.rs b/cranelift/codegen/src/opts.rs index b7a05cf4fea8..fc360913b1d9 100644 --- a/cranelift/codegen/src/opts.rs +++ b/cranelift/codegen/src/opts.rs @@ -15,9 +15,9 @@ pub use crate::ir::{ use crate::isle_common_prelude_methods; use crate::machinst::isle::*; use crate::trace; +use core::marker::PhantomData; use cranelift_entity::packed_option::ReservedValue; use smallvec::{SmallVec, smallvec}; -use std::marker::PhantomData; pub type Unit = (); pub type ValueArray2 = [Value; 2]; diff --git a/cranelift/codegen/src/remove_constant_phis.rs b/cranelift/codegen/src/remove_constant_phis.rs index ccaa3973f875..ae9f3ad6ed24 100644 --- a/cranelift/codegen/src/remove_constant_phis.rs +++ b/cranelift/codegen/src/remove_constant_phis.rs @@ -227,7 +227,7 @@ pub fn do_remove_constant_phis(func: &mut Function, domtree: &mut DominatorTree) // info. The solver will iterate over the summaries, rather than having // to inspect each instruction in each block. let bump = - Bump::with_capacity(domtree.cfg_postorder().len() * 4 * std::mem::size_of::()); + Bump::with_capacity(domtree.cfg_postorder().len() * 4 * core::mem::size_of::()); let mut summaries = SecondaryMap::::with_capacity(domtree.cfg_postorder().len()); diff --git a/cranelift/codegen/src/result.rs b/cranelift/codegen/src/result.rs index 5e4a490073c7..c62572cd9958 100644 --- a/cranelift/codegen/src/result.rs +++ b/cranelift/codegen/src/result.rs @@ -4,7 +4,7 @@ use regalloc2::checker::CheckerErrors; use crate::ir::pcc::PccError; use crate::{ir::Function, verifier::VerifierErrors}; -use std::string::String; +use alloc::string::String; /// A compilation error. /// @@ -52,8 +52,8 @@ pub type CodegenResult = Result; // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for CodegenError { - fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { +impl core::error::Error for CodegenError { + fn source(&self) -> Option<&(dyn core::error::Error + 'static)> { match self { CodegenError::Verifier(source) => Some(source), CodegenError::ImplLimitExceeded { .. } @@ -67,8 +67,8 @@ impl std::error::Error for CodegenError { } } -impl std::fmt::Display for CodegenError { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { +impl core::fmt::Display for CodegenError { + fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { match self { CodegenError::Verifier(_) => write!(f, "Verifier errors"), CodegenError::ImplLimitExceeded => write!(f, "Implementation limit exceeded"), diff --git a/cranelift/codegen/src/settings.rs b/cranelift/codegen/src/settings.rs index af8cbd51402c..158ba139bd42 100644 --- a/cranelift/codegen/src/settings.rs +++ b/cranelift/codegen/src/settings.rs @@ -290,7 +290,7 @@ pub enum SetError { BadValue(String), } -impl std::error::Error for SetError {} +impl core::error::Error for SetError {} impl fmt::Display for SetError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/cranelift/codegen/src/take_and_replace.rs b/cranelift/codegen/src/take_and_replace.rs index 78b8c71e827c..584d9239d0fa 100644 --- a/cranelift/codegen/src/take_and_replace.rs +++ b/cranelift/codegen/src/take_and_replace.rs @@ -64,7 +64,7 @@ where U: Default, { fn drop(&mut self) { - *(self.proj)(self.container) = std::mem::take(&mut self.value); + *(self.proj)(self.container) = core::mem::take(&mut self.value); } } @@ -76,7 +76,7 @@ where /// Create a new `TakeAndReplace` that temporarily takes out /// `proj(container)`. pub fn new(mut container: &'a mut T, proj: F) -> Self { - let value = std::mem::take(proj(&mut container)); + let value = core::mem::take(proj(&mut container)); TakeAndReplace { container, value, diff --git a/cranelift/codegen/src/timing.rs b/cranelift/codegen/src/timing.rs index a61dd21f7956..a06c6001ef41 100644 --- a/cranelift/codegen/src/timing.rs +++ b/cranelift/codegen/src/timing.rs @@ -118,12 +118,12 @@ pub use enabled::*; #[cfg(feature = "timing")] mod enabled { use super::{DESCRIPTIONS, DefaultProfiler, NUM_PASSES, Pass, Profiler}; - use std::any::Any; - use std::boxed::Box; - use std::cell::{Cell, RefCell}; - use std::fmt; - use std::mem; - use std::time::Duration; + use alloc::boxed::Box; + use core::any::Any; + use core::cell::{Cell, RefCell}; + use core::fmt; + use core::mem; + use core::time::Duration; use std::time::Instant; // Information about passes in a single thread. @@ -135,7 +135,7 @@ mod enabled { /// /// Returns the old profiler. pub fn set_thread_profiler(new_profiler: Box) -> Box { - PROFILER.with(|profiler| std::mem::replace(&mut *profiler.borrow_mut(), new_profiler)) + PROFILER.with(|profiler| core::mem::replace(&mut *profiler.borrow_mut(), new_profiler)) } /// Start timing `pass` as a child of the currently running pass, if any. diff --git a/cranelift/codegen/src/verifier/mod.rs b/cranelift/codegen/src/verifier/mod.rs index 8406820d6ac0..c57846c59c1f 100644 --- a/cranelift/codegen/src/verifier/mod.rs +++ b/cranelift/codegen/src/verifier/mod.rs @@ -99,7 +99,7 @@ pub struct VerifierError { // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for VerifierError {} +impl core::error::Error for VerifierError {} impl Display for VerifierError { fn fmt(&self, f: &mut Formatter) -> fmt::Result { @@ -178,7 +178,7 @@ pub struct VerifierErrors(pub Vec); // This is manually implementing Error and Display instead of using thiserror to reduce the amount // of dependencies used by Cranelift. -impl std::error::Error for VerifierErrors {} +impl core::error::Error for VerifierErrors {} impl VerifierErrors { /// Return a new `VerifierErrors` struct.