Skip to content

Commit d320a71

Browse files
committed
Auto merge of #113946 - dtolnay:revertniche, r=oli-obk
Revert "Prototype: Add unstable `-Z reference-niches` option" Clean revert of #113166. I confirmed this fixes #113941.
2 parents cb99370 + 5813809 commit d320a71

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/intptrcast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ impl<'mir, 'tcx> GlobalStateInner {
207207
.checked_add(max(size.bytes(), 1))
208208
.ok_or_else(|| err_exhaust!(AddressSpaceFull))?;
209209
// Even if `Size` didn't overflow, we might still have filled up the address space.
210-
if global_state.next_base_addr > ecx.data_layout().target_usize_max() {
210+
if global_state.next_base_addr > ecx.target_usize_max() {
211211
throw_exhaust!(AddressSpaceFull);
212212
}
213213
// Given that `next_base_addr` increases in each allocation, pushing the

src/shims/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use log::trace;
2121

2222
use rustc_middle::{mir, ty};
2323
use rustc_target::spec::abi::Abi;
24-
use rustc_target::abi::HasDataLayout as _;
2524

2625
use crate::*;
2726
use helpers::check_arg_count;
@@ -109,8 +108,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
109108
}
110109

111110
// Return error result (usize::MAX), and jump to caller.
112-
let usize_max = this.data_layout().target_usize_max();
113-
this.write_scalar(Scalar::from_target_usize(usize_max, this), dest)?;
111+
this.write_scalar(Scalar::from_target_usize(this.target_usize_max(), this), dest)?;
114112
this.go_to_block(ret);
115113
Ok(true)
116114
}

src/shims/unix/fs.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use log::trace;
1212

1313
use rustc_data_structures::fx::FxHashMap;
1414
use rustc_middle::ty::TyCtxt;
15-
use rustc_target::abi::{Align, Size, HasDataLayout as _};
15+
use rustc_target::abi::{Align, Size};
1616

1717
use crate::shims::os_str::bytes_to_os_str;
1818
use crate::*;
@@ -753,7 +753,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
753753
// We cap the number of read bytes to the largest value that we are able to fit in both the
754754
// host's and target's `isize`. This saves us from having to handle overflows later.
755755
let count = count
756-
.min(u64::try_from(this.data_layout().target_isize_max()).unwrap())
756+
.min(u64::try_from(this.target_isize_max()).unwrap())
757757
.min(u64::try_from(isize::MAX).unwrap());
758758
let communicate = this.machine.communicate();
759759

@@ -807,7 +807,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
807807
// We cap the number of written bytes to the largest value that we are able to fit in both the
808808
// host's and target's `isize`. This saves us from having to handle overflows later.
809809
let count = count
810-
.min(u64::try_from(this.data_layout().target_isize_max()).unwrap())
810+
.min(u64::try_from(this.target_isize_max()).unwrap())
811811
.min(u64::try_from(isize::MAX).unwrap());
812812
let communicate = this.machine.communicate();
813813

tests/fail/layout_cycle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@error-in-other-file: a cycle occurred during layout computation
2-
//~^ ERROR: cycle detected when computing layout (naive) of
2+
//~^ ERROR: cycle detected when computing layout of
33

44
use std::mem;
55

tests/fail/layout_cycle.stderr

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
error[E0391]: cycle detected when computing layout (naive) of `S<S<()>>`
1+
error[E0391]: cycle detected when computing layout of `S<S<()>>`
22
|
3-
= note: ...which requires computing layout (naive) of `<S<()> as Tr>::I`...
4-
= note: ...which again requires computing layout (naive) of `S<S<()>>`, completing the cycle
5-
= note: cycle used when computing layout of `S<S<()>>`
3+
= note: ...which requires computing layout of `<S<()> as Tr>::I`...
4+
= note: ...which again requires computing layout of `S<S<()>>`, completing the cycle
65
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
76

87
error: post-monomorphization error: a cycle occurred during layout computation

0 commit comments

Comments
 (0)