Skip to content

Commit e2e8846

Browse files
authored
Merge pull request rust-lang#1954 from rust-lang/rustc-pull
Rustc pull update
2 parents 507ce7c + 53a77cc commit e2e8846

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

compiler/rustc_public/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
//! This API is still completely unstable and subject to change.
88
99
#![allow(rustc::usage_of_ty_tykind)]
10-
#![doc(
11-
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
12-
test(attr(allow(unused_variables), deny(warnings)))
13-
)]
10+
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
1411
#![feature(sized_hierarchy)]
1512
//!
1613
//! This crate shall contain all type definitions and APIs that we expect third-party tools to invoke to

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)