inline format!() args up to and including rustc_middle
This commit is contained in:
parent
2e0136a131
commit
23815467a2
87 changed files with 378 additions and 437 deletions
|
@ -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:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue