Skip to content

Rollup of 10 pull requests#154240

Closed
JonathanBrouwer wants to merge 26 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-BsCGo2e
Closed

Rollup of 10 pull requests#154240
JonathanBrouwer wants to merge 26 commits intorust-lang:mainfrom
JonathanBrouwer:rollup-BsCGo2e

Conversation

@JonathanBrouwer
Copy link
Contributor

Successful merges:

r? @ghost

Create a similar rollup

Twey and others added 26 commits March 11, 2026 02:25
Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`.  However, currently dlmalloc is only pulled in when `target_os = "unknown"`.

Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either
- disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or
- pull in `dlmalloc` for all Wasm targets with  `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100).

This PR takes the latter approach, because it allows more code to compile without a custom allocator.
This matters for `x test rustc_transmute`, where the feature won't
automatically be enabled and as a result spew a bunch of warnings.
When encountering an unmet predicate, when we point at the trait impls that do exist, if they are all for the same self type, tweak the wording to make it less verbose.
It's very small and only has two call sites. The tiny loss of DRY is
worth it to shrink `QueryVTable`.
We can only reach this point if `try_load_from_disk_fn` fails, and the
condition of this assertion is basically just the inverse of what
`try_load_from_disk_fn` does. Basically it's like this:
```
fn foo() -> bool { a && b }

fn bar() {
    if foo() {
        return;
    }
    assert!(!a || !b);
}
```
The assertion is just confusing and provides little value.
Crates with different overflow-checks settings accessing the same RangeFromIter resulted in incorrect values being yielded
…ions

Avoid unconditionally slicing `inputs()[1..]`, which assumes a `self`
parameter. Use `is_method()` to conditionally skip the receiver,
preventing out-of-bounds access and fixing suggestions for associated
functions.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
This one just irritates me, and I don't think it adds much value.
by

- using `DiagSymbolList` to get nicely formatted lists
- mentioning the `modifier` when an invalid modifier is used. This is useful in case the span cannot be resolved (which I ran into).
By removing the early return and using a `match` instead.
- The two paths are of similar conceptual weight, and `match` reflects
  that.
- This lets the `incremental_verify_ich` call be factored out.
We've already stabilized float operations in const,
which means we've already accepted that a `const fn`
might behave differently in consteval vs at run time.
`std`: include `dlmalloc` for all non-wasi Wasm targets

Currently, building std for a custom Wasm target with an OS other than `unknown` will fail, because `sys/alloc/mod.rs` will attempt to use `sys/alloc/wasm.rs`, the dlmalloc-based allocator used on `wasm32-unknown-unknown`.  However, currently dlmalloc is only pulled in when `target_os = "unknown"`.

Instead, we should make `Cargo.toml` and `alloc/mod.rs` match: either
- disable `wasm.rs` in `alloc/mod.rs` where `not(target_os = "unknown")`, or
- pull in `dlmalloc` for all Wasm targets with  `target_family = "wasm32"` that aren't covered by the [upper branches of `alloc/mod.rs`](https://github.com/rust-lang/rust/blob/main/library/std/src/sys/alloc/mod.rs#L72-L100).

This PR takes the latter approach, because it allows more code to compile without a custom allocator.
…usize, r=Mark-Simulacrum

`Alignment`: move from `ptr` to `mem` and rename `as_nonzero` to `as_nonzero_usize`

- tracking issue: rust-lang#102070
- split off from rust-lang#153261
…rk-Simulacrum

bootstrap: Pass `--features=rustc` to rustc_transmute

This matters for `x test rustc_transmute`, where the feature won't automatically be enabled and as a result spew a bunch of warnings.
refactor RangeFromIter overflow-checks impl

Crates with different overflow-checks settings accessing the same RangeFromIter resulted in incorrect values being yielded

Fixes rust-lang#154124

r? @tgross35
…, r=Zalathar

Refactor query loading

Some refactoring of code relating to query result loading. Details in individual commits.

r? @Zalathar
…st, r=RalfJung

Document consteval behavior of ub_checks, overflow_checks, is_val_statically_known.
On E0277 tweak help when single type impls traits

When encountering an unmet predicate, when we point at the trait impls that do exist, if they are all for the same self type, tweak the wording to make it less verbose.
…nethercote

interpret/validity: remove unreachable error kind

See the comments in the code for why this is unreachable.
…r=Kivooeo

diagnostics: avoid ICE in confusable_method_name for associated functions

Avoid unconditionally slicing `inputs()[1..]`, which assumes a `self` parameter. Use `is_method()` to conditionally skip the receiver, preventing out-of-bounds access and fixing suggestions for associated functions.
…e-modifier, r=nnethercote

Improve inline assembly error messages

by

- using `DiagSymbolList` to get nicely formatted lists
- mentioning the `modifier` when an invalid modifier is used. This is useful in case the span cannot be resolved (which I ran into).
@rust-bors rust-bors bot added the rollup A PR which is a rollup label Mar 23, 2026
@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2026
@rustbot rustbot added T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Mar 23, 2026
@JonathanBrouwer
Copy link
Contributor Author

@bors r+ rollup=never p=5

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

📌 Commit ee4bcfe has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 23, 2026
@JonathanBrouwer
Copy link
Contributor Author

Trying commonly failed jobs
@bors try jobs=test-various,x86_64-gnu-aux,x86_64-gnu-llvm-21-3,x86_64-msvc-1,aarch64-apple,x86_64-mingw-1

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Mar 23, 2026
Rollup of 10 pull requests


try-job: test-various
try-job: x86_64-gnu-aux
try-job: x86_64-gnu-llvm-21-3
try-job: x86_64-msvc-1
try-job: aarch64-apple
try-job: x86_64-mingw-1
@JonathanBrouwer
Copy link
Contributor Author

JonathanBrouwer commented Mar 23, 2026

Creating this rollup early so we can run try jobs on all the iffy PRs

@JonathanBrouwer
Copy link
Contributor Author

@bors p=3

@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

---- [mir-opt] tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs stdout ----
51           StorageLive(_12);
52           StorageLive(_13);
53 -         _13 = boxed::box_new_uninit(const <() as std::mem::SizedTypeProperties>::LAYOUT) -> [return: bb2, unwind unreachable];
- +         _13 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: std::ptr::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable];
+ +         _13 = boxed::box_new_uninit(const Layout {{ size: 0_usize, align: std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }} }}) -> [return: bb2, unwind unreachable];
55       }
56   
57       bb1: {


thread '[mir-opt] tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/dont_reset_cast_kind_without_updating_operand.test.GVN.32bit.panic-abort.diff
stack backtrace:
   5: __rustc::rust_begin_unwind
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/std/src/panicking.rs:689:5
   6: core::panicking::panic_fmt
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/core/src/panicking.rs:80:14
   7: <compiletest::runtest::TestCx>::run_revision
   8: compiletest::runtest::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- [mir-opt] tests/mir-opt/dont_reset_cast_kind_without_updating_operand.rs stdout end ----
---- [mir-opt] tests/mir-opt/pre-codegen/drop_box_of_sized.rs stdout ----
69         StorageLive(_3);
70         _2 = copy (((*_1).0: std::ptr::Unique<[u8; 1024]>).0: std::ptr::NonNull<[u8; 1024]>);
71         _3 = copy _2 as std::ptr::NonNull<u8> (Transmute);
-         _4 = alloc::alloc::__rust_dealloc(move _3, const 1024_usize, const std::mem::Alignment {{ _inner_repr_trick: std::ptr::alignment::AlignmentEnum::_Align1Shl0 }}) -> [return: bb1, unwind unreachable];
+         _4 = alloc::alloc::__rust_dealloc(move _3, const 1024_usize, const std::mem::Alignment {{ _inner_repr_trick: mem::alignment::AlignmentEnum::_Align1Shl0 }}) -> [return: bb1, unwind unreachable];
73     }
74 
75     bb1: {


thread '[mir-opt] tests/mir-opt/pre-codegen/drop_box_of_sized.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.PreCodegen.after.panic-abort.mir
stack backtrace:
   5: __rustc::rust_begin_unwind
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/std/src/panicking.rs:689:5
   6: core::panicking::panic_fmt
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/core/src/panicking.rs:80:14
   7: <compiletest::runtest::TestCx>::run_revision
   8: compiletest::runtest::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- [mir-opt] tests/mir-opt/pre-codegen/drop_box_of_sized.rs stdout end ----
---- [mir-opt] tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs stdout ----
63   
64       bb3: {
65 -         _1 = move ((_2 as Some).0: std::alloc::Layout);
- +         _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): std::ptr::alignment::AlignmentEnum }} }};
+ +         _1 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): mem::alignment::AlignmentEnum }} }};
67           StorageDead(_8);
68           StorageDead(_2);
69           StorageLive(_3);

73           StorageLive(_7);
74 -         _7 = copy _1;
75 -         _6 = std::alloc::Global::alloc_impl_runtime(move _7, const false) -> [return: bb4, unwind unreachable];
- +         _7 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): std::ptr::alignment::AlignmentEnum }} }};
- +         _6 = std::alloc::Global::alloc_impl_runtime(const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): std::ptr::alignment::AlignmentEnum }} }}, const false) -> [return: bb4, unwind unreachable];
+ +         _7 = const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): mem::alignment::AlignmentEnum }} }};
+ +         _6 = std::alloc::Global::alloc_impl_runtime(const Layout {{ size: Indirect { alloc_id: ALLOC0, offset: Size(4 bytes) }: usize, align: std::mem::Alignment {{ _inner_repr_trick: Scalar(0x00000000): mem::alignment::AlignmentEnum }} }}, const false) -> [return: bb4, unwind unreachable];
78       }
79   
80       bb4: {


thread '[mir-opt] tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:84:21:
Actual MIR output differs from expected MIR output /checkout/tests/mir-opt/pre-codegen/issue_117368_print_invalid_constant.main.GVN.32bit.panic-abort.diff
stack backtrace:
   5: __rustc::rust_begin_unwind
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/std/src/panicking.rs:689:5
   6: core::panicking::panic_fmt
             at /rustc/ad726b5063362ec9897ef3d67452fc5606ee70fa/library/core/src/panicking.rs:80:14

@rust-bors rust-bors bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 23, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

PR #154004, which is a member of this rollup, was unapproved.

This rollup was thus unapproved.

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 23, 2026
@rust-bors rust-bors bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 23, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 23, 2026

💔 Test for 865df22 failed: CI. Failed job:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.