Add a new debug_assertions instrinsic (compiler)
And in clippy
This commit is contained in:
parent
55fabf35b1
commit
8836ac5758
18 changed files with 72 additions and 13 deletions
|
@ -907,6 +907,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
NullOp::SizeOf => write!(fmt, "SizeOf({t})"),
|
||||
NullOp::AlignOf => write!(fmt, "AlignOf({t})"),
|
||||
NullOp::OffsetOf(fields) => write!(fmt, "OffsetOf({t}, {fields:?})"),
|
||||
NullOp::DebugAssertions => write!(fmt, "cfg!(debug_assertions)"),
|
||||
}
|
||||
}
|
||||
ThreadLocalRef(did) => ty::tls::with(|tcx| {
|
||||
|
|
|
@ -1361,6 +1361,8 @@ pub enum NullOp<'tcx> {
|
|||
AlignOf,
|
||||
/// Returns the offset of a field
|
||||
OffsetOf(&'tcx List<(VariantIdx, FieldIdx)>),
|
||||
/// cfg!(debug_assertions), but expanded in codegen
|
||||
DebugAssertions,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
|
|
|
@ -194,6 +194,7 @@ impl<'tcx> Rvalue<'tcx> {
|
|||
Rvalue::NullaryOp(NullOp::SizeOf | NullOp::AlignOf | NullOp::OffsetOf(..), _) => {
|
||||
tcx.types.usize
|
||||
}
|
||||
Rvalue::NullaryOp(NullOp::DebugAssertions, _) => tcx.types.bool,
|
||||
Rvalue::Aggregate(ref ak, ref ops) => match **ak {
|
||||
AggregateKind::Array(ty) => Ty::new_array(tcx, ty, ops.len() as u64),
|
||||
AggregateKind::Tuple => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue