diff options
Diffstat (limited to 'compiler/rustc_abi/src')
| -rw-r--r-- | compiler/rustc_abi/src/layout.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_abi/src/lib.rs | 19 |
2 files changed, 10 insertions, 17 deletions
diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index 489a8403c3b..a8a1a90572d 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -260,8 +260,7 @@ pub trait LayoutCalculator { } _ => assert!( start == Bound::Unbounded && end == Bound::Unbounded, - "nonscalar layout for layout_scalar_valid_range type: {:#?}", - st, + "nonscalar layout for layout_scalar_valid_range type: {st:#?}", ), } @@ -463,7 +462,7 @@ pub trait LayoutCalculator { min = 0; max = 0; } - assert!(min <= max, "discriminant range is {}...{}", min, max); + assert!(min <= max, "discriminant range is {min}...{max}"); let (min_ity, signed) = discr_range_of_repr(min, max); //Integer::repr_discr(tcx, ty, &repr, min, max); let mut align = dl.aggregate_align; @@ -537,8 +536,7 @@ pub trait LayoutCalculator { // space necessary to represent would have to be discarded (or layout is wrong // on thinking it needs 16 bits) panic!( - "layout decided on a larger discriminant type ({:?}) than typeck ({:?})", - min_ity, typeck_ity + "layout decided on a larger discriminant type ({min_ity:?}) than typeck ({typeck_ity:?})" ); // However, it is fine to make discr type however large (as an optimisation) // after this point – we’ll just truncate the value we load in codegen. diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 835143407d2..1442747fe1e 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -332,7 +332,7 @@ impl TargetDataLayout { 16 => 1 << 15, 32 => 1 << 31, 64 => 1 << 47, - bits => panic!("obj_size_bound: unknown pointer bit size {}", bits), + bits => panic!("obj_size_bound: unknown pointer bit size {bits}"), } } @@ -342,7 +342,7 @@ impl TargetDataLayout { 16 => I16, 32 => I32, 64 => I64, - bits => panic!("ptr_sized_integer: unknown pointer bit size {}", bits), + bits => panic!("ptr_sized_integer: unknown pointer bit size {bits}"), } } @@ -399,7 +399,7 @@ impl FromStr for Endian { match s { "little" => Ok(Self::Little), "big" => Ok(Self::Big), - _ => Err(format!(r#"unknown endian: "{}""#, s)), + _ => Err(format!(r#"unknown endian: "{s}""#)), } } } @@ -456,7 +456,7 @@ impl Size { pub fn bits(self) -> u64 { #[cold] fn overflow(bytes: u64) -> ! { - panic!("Size::bits: {} bytes in bits doesn't fit in u64", bytes) + panic!("Size::bits: {bytes} bytes in bits doesn't fit in u64") } self.bytes().checked_mul(8).unwrap_or_else(|| overflow(self.bytes())) @@ -1179,17 +1179,12 @@ impl FieldsShape { unreachable!("FieldsShape::offset: `Primitive`s have no fields") } FieldsShape::Union(count) => { - assert!( - i < count.get(), - "tried to access field {} of union with {} fields", - i, - count - ); + assert!(i < count.get(), "tried to access field {i} of union with {count} fields"); Size::ZERO } FieldsShape::Array { stride, count } => { let i = u64::try_from(i).unwrap(); - assert!(i < count, "tried to access field {} of array with {} fields", i, count); + assert!(i < count, "tried to access field {i} of array with {count} fields"); stride * i } FieldsShape::Arbitrary { ref offsets, .. } => offsets[FieldIdx::from_usize(i)], @@ -1294,7 +1289,7 @@ impl Abi { Primitive::Int(_, signed) => signed, _ => false, }, - _ => panic!("`is_signed` on non-scalar ABI {:?}", self), + _ => panic!("`is_signed` on non-scalar ABI {self:?}"), } } |
