Skip to content

Commit cebaa98

Browse files
committed
Remove check_overflow method from MiscMethods
It can be retrieved from the Session too.
1 parent e7c3915 commit cebaa98

File tree

4 files changed

+1
-18
lines changed

4 files changed

+1
-18
lines changed

compiler/rustc_codegen_gcc/src/context.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use crate::callee::get_fn;
2626
use crate::common::SignType;
2727

2828
pub struct CodegenCx<'gcc, 'tcx> {
29-
pub check_overflow: bool,
3029
pub codegen_unit: &'tcx CodegenUnit<'tcx>,
3130
pub context: &'gcc Context<'gcc>,
3231

@@ -133,8 +132,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
133132
tcx: TyCtxt<'tcx>,
134133
supports_128bit_integers: bool,
135134
) -> Self {
136-
let check_overflow = tcx.sess.overflow_checks();
137-
138135
let create_type = |ctype, rust_type| {
139136
let layout = tcx.layout_of(ParamEnv::reveal_all().and(rust_type)).unwrap();
140137
let align = layout.align.abi.bytes();
@@ -270,7 +267,6 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
270267
}
271268

272269
let mut cx = Self {
273-
check_overflow,
274270
codegen_unit,
275271
context,
276272
current_func: RefCell::new(None),
@@ -510,10 +506,6 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
510506
&self.tcx.sess
511507
}
512508

513-
fn check_overflow(&self) -> bool {
514-
self.check_overflow
515-
}
516-
517509
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
518510
self.codegen_unit
519511
}

compiler/rustc_codegen_llvm/src/context.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use std::str;
4343
/// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`.
4444
pub struct CodegenCx<'ll, 'tcx> {
4545
pub tcx: TyCtxt<'tcx>,
46-
pub check_overflow: bool,
4746
pub use_dll_storage_attrs: bool,
4847
pub tls_model: llvm::ThreadLocalMode,
4948

@@ -408,8 +407,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
408407
// start) and then strongly recommending static linkage on Windows!
409408
let use_dll_storage_attrs = tcx.sess.target.is_like_windows;
410409

411-
let check_overflow = tcx.sess.overflow_checks();
412-
413410
let tls_model = to_llvm_tls_model(tcx.sess.tls_model());
414411

415412
let (llcx, llmod) = (&*llvm_module.llcx, llvm_module.llmod());
@@ -433,7 +430,6 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> {
433430

434431
CodegenCx {
435432
tcx,
436-
check_overflow,
437433
use_dll_storage_attrs,
438434
tls_model,
439435
llmod,
@@ -572,10 +568,6 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
572568
self.tcx.sess
573569
}
574570

575-
fn check_overflow(&self) -> bool {
576-
self.check_overflow
577-
}
578-
579571
fn codegen_unit(&self) -> &'tcx CodegenUnit<'tcx> {
580572
self.codegen_unit
581573
}

compiler/rustc_codegen_ssa/src/mir/block.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
637637
// with #[rustc_inherit_overflow_checks] and inlined from
638638
// another crate (mostly core::num generic/#[inline] fns),
639639
// while the current crate doesn't use overflow checks.
640-
if !bx.cx().check_overflow() && msg.is_optional_overflow_check() {
640+
if !bx.sess().overflow_checks() && msg.is_optional_overflow_check() {
641641
const_cond = Some(expected);
642642
}
643643

compiler/rustc_codegen_ssa/src/traits/misc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ pub trait MiscMethods<'tcx>: BackendTypes {
1616
_vtable: Self::Value,
1717
) {
1818
}
19-
fn check_overflow(&self) -> bool;
2019
fn get_fn(&self, instance: Instance<'tcx>) -> Self::Function;
2120
fn get_fn_addr(&self, instance: Instance<'tcx>) -> Self::Value;
2221
fn eh_personality(&self) -> Self::Value;

0 commit comments

Comments
 (0)