Skip to content

Commit 0abc2cb

Browse files
committed
Auto merge of rust-lang#148721 - Zalathar:rollup-398va3y, r=Zalathar
Rollup of 22 pull requests Successful merges: - rust-lang#128666 (Add `overflow_checks` intrinsic) - rust-lang#146305 (Add correct suggestion for multi-references for self type in method) - rust-lang#147179 ([DebugInfo] Fix container types failing to find template args) - rust-lang#147743 (Show packed field alignment in mir_transform_unaligned_packed_ref) - rust-lang#148079 (Rename `downcast_[ref|mut]_unchecked` -> `downcast_unchecked_[ref|mut]`) - rust-lang#148084 (Optimize path components iteration on platforms that don't have prefixes) - rust-lang#148126 (Fix rust stdlib build failing for VxWorks) - rust-lang#148204 (Modify contributor email entries in .mailmap) - rust-lang#148279 (rustc_builtin_macros: rename bench parameter to avoid collisions with user-defined function names) - rust-lang#148333 (constify result unwrap unchecked) - rust-lang#148539 (Add Allocator proxy impls for Box, Rc, and Arc) - rust-lang#148601 (`invalid_atomic_ordering`: also lint `update` & `try_update`) - rust-lang#148612 (Add note for identifier with attempted hygiene violation) - rust-lang#148613 (Switch hexagon targets to rust-lld) - rust-lang#148619 (Enable std locking functions on AIX) - rust-lang#148644 ([bootstrap] Make `--open` option work with `doc src/tools/error_index_generator`) - rust-lang#148649 (don't completely reset `HeadUsages`) - rust-lang#148673 (Remove a remnant of `dyn*` from the parser) - rust-lang#148675 (Remove eslint-js from npm dependencies) - rust-lang#148680 (Recover `[T: N]` as `[T; N]`) - rust-lang#148688 (Remove unused argument `features` from `eval_config_entry`) - rust-lang#148711 (Use the current lint note id when parsing `cfg!()`) r? `@ghost` `@rustbot` modify labels: rollup
2 parents e1d03be + 0c79ddc commit 0abc2cb

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

compiler/rustc_public/src/mir/body.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,7 @@ impl Rvalue {
642642
.ok_or_else(|| error!("Expected a `RigidTy` but found: {place_ty:?}"))
643643
}
644644
Rvalue::NullaryOp(NullOp::OffsetOf(..), _) => Ok(Ty::usize_ty()),
645-
Rvalue::NullaryOp(NullOp::ContractChecks, _)
646-
| Rvalue::NullaryOp(NullOp::UbChecks, _) => Ok(Ty::bool_ty()),
645+
Rvalue::NullaryOp(NullOp::RuntimeChecks(_), _) => Ok(Ty::bool_ty()),
647646
Rvalue::Aggregate(ak, ops) => match *ak {
648647
AggregateKind::Array(ty) => Ty::try_new_array(ty, ops.len() as u64),
649648
AggregateKind::Tuple => Ok(Ty::new_tuple(
@@ -1024,10 +1023,18 @@ pub enum CastKind {
10241023
pub enum NullOp {
10251024
/// Returns the offset of a field.
10261025
OffsetOf(Vec<(VariantIdx, FieldIdx)>),
1026+
/// Codegen conditions for runtime checks.
1027+
RuntimeChecks(RuntimeChecks),
1028+
}
1029+
1030+
#[derive(Clone, Debug, Eq, PartialEq, Hash, Serialize)]
1031+
pub enum RuntimeChecks {
10271032
/// cfg!(ub_checks), but at codegen time
10281033
UbChecks,
10291034
/// cfg!(contract_checks), but at codegen time
10301035
ContractChecks,
1036+
/// cfg!(overflow_checks), but at codegen time
1037+
OverflowChecks,
10311038
}
10321039

10331040
impl Operand {

compiler/rustc_public/src/unstable/convert/stable/mir.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,16 @@ impl<'tcx> Stable<'tcx> for mir::NullOp<'tcx> {
322322
cx: &CompilerCtxt<'cx, BridgeTys>,
323323
) -> Self::T {
324324
use rustc_middle::mir::NullOp::*;
325+
use rustc_middle::mir::RuntimeChecks::*;
325326
match self {
326327
OffsetOf(indices) => crate::mir::NullOp::OffsetOf(
327328
indices.iter().map(|idx| idx.stable(tables, cx)).collect(),
328329
),
329-
UbChecks => crate::mir::NullOp::UbChecks,
330-
ContractChecks => crate::mir::NullOp::ContractChecks,
330+
RuntimeChecks(op) => crate::mir::NullOp::RuntimeChecks(match op {
331+
UbChecks => crate::mir::RuntimeChecks::UbChecks,
332+
ContractChecks => crate::mir::RuntimeChecks::ContractChecks,
333+
OverflowChecks => crate::mir::RuntimeChecks::OverflowChecks,
334+
}),
331335
}
332336
}
333337
}

0 commit comments

Comments
 (0)