Skip to content

Commit ca9203f

Browse files
committed
Auto merge of #156728 - JonathanBrouwer:rollup-Qv3EfnO, r=JonathanBrouwer
Rollup of 3 pull requests Successful merges: - #156146 (test new solver on CI until stabilization) - #155840 (prefer `T::IS_ZST` over manual check) - #156723 (Update books)
2 parents 9eb3be2 + 0cb7361 commit ca9203f

6 files changed

Lines changed: 16 additions & 13 deletions

File tree

compiler/rustc_next_trait_solver/src/solve/effect_goals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ where
374374
_ecx: &mut EvalCtxt<'_, D>,
375375
_goal: Goal<I, Self>,
376376
) -> Result<Candidate<I>, NoSolutionOrRerunNonErased> {
377-
todo!("Iterator is not yet const")
377+
Err(NoSolutionOrRerunNonErased::NoSolution(NoSolution))
378378
}
379379

380380
fn consider_builtin_fused_iterator_candidate(

library/alloc/src/boxed/thin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use core::marker::PhantomData;
1010
#[cfg(not(no_global_oom_handling))]
1111
use core::marker::Unsize;
1212
#[cfg(not(no_global_oom_handling))]
13-
use core::mem::{self, SizedTypeProperties};
13+
use core::mem;
14+
use core::mem::SizedTypeProperties;
1415
use core::ops::{Deref, DerefMut};
1516
use core::ptr::{self, NonNull, Pointee};
1617

@@ -112,7 +113,7 @@ impl<Dyn: ?Sized> ThinBox<Dyn> {
112113
where
113114
T: Unsize<Dyn>,
114115
{
115-
if size_of::<T>() == 0 {
116+
if T::IS_ZST {
116117
let ptr = WithOpaqueHeader::new_unsize_zst::<Dyn, T>(value);
117118
ThinBox { ptr, _marker: PhantomData }
118119
} else {
@@ -281,7 +282,7 @@ impl<H> WithHeader<H> {
281282
let ptr = if layout.size() == 0 {
282283
// Some paranoia checking, mostly so that the ThinBox tests are
283284
// more able to catch issues.
284-
debug_assert!(value_offset == 0 && size_of::<T>() == 0 && size_of::<H>() == 0);
285+
debug_assert!(value_offset == 0 && T::IS_ZST && H::IS_ZST);
285286
layout.dangling_ptr()
286287
} else {
287288
let ptr = alloc::alloc(layout);
@@ -311,7 +312,7 @@ impl<H> WithHeader<H> {
311312
Dyn: Pointee<Metadata = H> + ?Sized,
312313
T: Unsize<Dyn>,
313314
{
314-
assert!(size_of::<T>() == 0);
315+
assert!(T::IS_ZST);
315316

316317
const fn max(a: usize, b: usize) -> usize {
317318
if a > b { a } else { b }

library/core/src/iter/adapters/map_windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::iter::FusedIterator;
2-
use crate::mem::MaybeUninit;
2+
use crate::mem::{MaybeUninit, SizedTypeProperties};
33
use crate::{fmt, ptr};
44

55
/// An iterator over the mapped windows of another iterator.
@@ -47,7 +47,7 @@ impl<I: Iterator, F, const N: usize> MapWindows<I, F, N> {
4747
assert!(N != 0, "array in `Iterator::map_windows` must contain more than 0 elements");
4848

4949
// Only ZST arrays' length can be so large.
50-
if size_of::<I::Item>() == 0 {
50+
if I::Item::IS_ZST {
5151
assert!(
5252
N.checked_mul(2).is_some(),
5353
"array size of `Iterator::map_windows` is too large"

library/core/src/mem/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@ pub macro offset_of($Container:ty, $($fields:expr)+ $(,)?) {
16201620
#[rustc_const_unstable(feature = "mem_conjure_zst", issue = "95383")]
16211621
pub const unsafe fn conjure_zst<T>() -> T {
16221622
const_assert!(
1623-
size_of::<T>() == 0,
1623+
T::IS_ZST,
16241624
"mem::conjure_zst invoked on a non-zero-sized type",
16251625
"mem::conjure_zst invoked on type {name}, which is not zero-sized",
16261626
name: &str = crate::any::type_name::<T>()

src/ci/docker/scripts/x86_64-gnu-llvm.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ set -ex
1313
# despite having different output on 32-bit vs 64-bit targets.
1414
../x --stage 2 test tests/mir-opt --host='' --target=i686-unknown-linux-gnu
1515

16-
# Run the UI test suite again, but in `--pass=check` mode
17-
#
18-
# This is intended to make sure that both `--pass=check` continues to
19-
# work.
16+
# Run the UI test suite in `--pass=check` mode, to ensure it continues to work.
2017
../x.ps1 --stage 2 test tests/ui --pass=check --host='' --target=i686-unknown-linux-gnu
18+
19+
# Rebuild the stdlib using the new trait solver, to ensure it doesn't regress
20+
# until stabilization.
21+
RUSTFLAGS_NOT_BOOTSTRAP="-Znext-solver=globally" ../x --stage 1 build library \
22+
--host='' --target=i686-unknown-linux-gnu

0 commit comments

Comments
 (0)