Skip to content

Rollup of 14 pull requests #143866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed

Conversation

fmease
Copy link
Member

@fmease fmease commented Jul 13, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

compiler-errors and others added 30 commits July 9, 2025 20:06
This reduces the amount of time it takes to do the x check for
rust-analyzer analysis from 12m16s to 3m34s when the bootstrap compiler
is already downloaded.
If CI_JOB_NAME is not specified, it's supposed to fall back to
the image name, which is `$image`, not `$IMAGE`.

Failing to set the correct CI_JOB_NAME causes failures when running
`dist-ohos-*` images locally.
Make sure that compiler and linker don't optimize the section's contents
away by adding the global holding the data to "llvm.used". This
eliminates the need for a volatile load in the main shim; since the LLVM
codegen backend is the only implementer of the corresponding trait
function, remove it entirely.
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
`tests/ui`: A New Order [26/N]

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang#133895.

r? `@tgross35`
…o, r=petrochenkov

make `cfg_select` a builtin macro

tracking issue: rust-lang#115585

This parses mostly the same as the `macro cfg_select` version, except:

1. wrapping in double brackets is no longer supported (or needed): `cfg_select {{ /* ... */ }}` is now rejected.
2. in an expression context, the rhs is no longer wrapped in a block, so that this now works:
  ```rust
  fn main() {
      println!(cfg_select! {
          unix => { "foo" }
          _ => { "bar" }
      });
  }
  ```
3. a single wildcard rule is now supported: `cfg_select { _ => 1 }` now works

I've also added an error if none of the rules evaluate to true, and warnings for any arms that follow the `_` wildcard rule.

cc `@traviscross` if I'm missing any feature that should/should not be included
r? `@petrochenkov` for the macro logic details
…ems, r=petrochenkov

Check assoc consts and tys later like assoc fns

This PR
1. checks assoc consts and tys later like assoc fns
2. marks assoc consts appear in poly-trait-ref live

For assoc consts, considering
```rust
#![deny(dead_code)]

trait Tr { // ERROR trait `Tr` is never used
    const I: Self;
}

struct Foo; //~ ERROR struct `Foo` is never constructed

impl Tr for Foo {
    const I: Self = Foo;
}

fn main() {}
```

Current this will produce unused `I` instead of unused `Tr` and `Foo` ([play](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=e0490d4a2d522cb70437b26e514a3d9c)), because `const I: Self = Foo;` will be added into the worklist at first:
```
error: associated constant `I` is never used
 --> src/main.rs:4:11
  |
3 | trait Tr { // ERROR trait `Tr` is never used
  |       -- associated constant in this trait
4 |     const I: Self;
  |           ^
  |
note: the lint level is defined here
 --> src/main.rs:1:9
  |
1 | #![deny(dead_code)]
  |         ^^^^^^^^^

error: could not compile `playground` (bin "playground") due to 1 previous error
```

This also happens to assoc tys, see the [new test](https://github.com/rust-lang/rust/compare/master...mu001999-contrib:rust:dead-code/impl-items?expand=1#diff-bf45fa403934a31c9d610a073ed2603d885e7e81572e8edf38b7f4e08a1f3531)

Fixes rust-lang#126729

r? ``@petrochenkov``
…ieu,tgross35

slice: Mark `rotate_left`, `rotate_right` unstably const

Tracking issue rust-lang#143812

- Add the const unstable `const_slice_rotate` feature
- Mark `<[T]>::rotate_left` and `<[T]>::rotate_right` as const unstable

The internal rotate functions use [`<*mut T>::replace`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.replace) and [`ptr::swap_nonoverlapping`](https://doc.rust-lang.org/stable/core/ptr/fn.swap_nonoverlapping.html) which were const-stabilized in 1.88.

Two changes were needed in the `rotate.rs` module to make these functions const:
1. A usage of `cmp::min` was replaced with a local function implementation of [`Ord::min`](https://doc.rust-lang.org/1.88.0/src/core/cmp.rs.html#1048-1053).
2. A `for start in 1..gcd` loop was changed to a while loop with an increment variable.

This needs libs-api approval and cc-ing const-eval.
interpret/allocation: expose init + write_wildcards on a range

Part of rust-lang/miri#4456, so that we can mark down when a foreign access to our memory happened. Should this also move `prepare_for_native_access()` itself into Miri, given that everything there can be implemented on Miri's side?

r? ``@RalfJung``
…b-scripts-section, r=bjorn3

Preserve the .debug_gdb_scripts section

Make sure that compiler and linker don't optimize the section's contents away by adding the global holding the data to `llvm.used`. This eliminates the need for a volatile load in the main shim; since the LLVM codegen backend is the only implementer of the corresponding trait function, remove it entirely.

r? `@bjorn3`
…ings, r=petrochenkov

Resolve: merge `source_bindings` and `target_bindings` into `bindings`

Attempts to merge the 2 fields `source_bindings` and `target_bindings` of `ImportKind::Single` into 1 field called `bindings`.

r? `@petrochenkov`
…gillot

Be a bit more careful around exotic cycles in in the inliner

Copied from the comment here: rust-lang#143700 (comment)

---

```rust
#![feature(fn_traits)]

#[inline]
pub fn a() {
    FnOnce::call_once(a, ());
    FnOnce::call_once(b, ());
}

#[inline]
pub fn b() {
    FnOnce::call_once(b, ());
    FnOnce::call_once(a, ());
}
```

This should demonstrate the issue. For ease of discussion, I'm gonna call the two fn-def types `{a}` and `{b}`.

When collecting the cyclic local callees in `mir_callgraph_cyclic` for `a`, we first check the first call terminator in `a`. We end up calling process on `<{a} as FnOnce>::call_once`, which ends up visiting `a`'s instance again. This is cyclical. However, we don't end up marking `FnOnce::call_once` as a cyclical def id because it's a foreign item. That's fine.

When visiting the second call terminator in `a`, which is `<{b} as FnOnce>::call_once`, we end up recursing into `b`. We check the first terminator, which is `<{b} as FnOnce>::call_once`, but although that is its own mini cycle, it doesn't consider itself a cycle for the purpose of this query because it doesn't involve the *root*. However, when we visit the *second* terminator in `b`, which is `<{a} as FnOnce>::call_once`, we end up **erroneously** *not* considering that call to be cyclical since we've already inserted it into our set of seen instances, and as a consequence we don't recurse into it. This means that we never collect `b` as recursive.

Do this in the flipped case too, and we end up having two functions which mututally do not consider each other to be recursive participants. This leads to a query cycle.

---

I ended up also renaming some variables so I could more clearly understand their responsibilities in this code. Let me know if the renames are not welcome.

Fixes rust-lang#143700
r? ``@cjgillot``
…resolution-bindings, r=petrochenkov

Refactor resolve resolution bindings

This pr does the work asked in rust-lang#142547 (comment). This part:

> move the `(non)_glob_binding` change

r? `@petrochenkov`
fmease added 5 commits July 13, 2025 07:18
constify `From` and `Into`

tracking issue rust-lang#143773

r? ```@fee1-dead```

I did not mark any impls elsewhere as `const`, those can happen on their own timeframe and don't need to be part of this MVP. But if there are some core ones you think should be in there I'll happily add them, just couldn't think of any
…d, r=Kobzol

Add --compile-time-deps argument for x check

Together with skipping building C++ code in rustc_llvm for check, this reduces the amount of time it takes to do the x check for rust-analyzer analysis from 12m16s to 3m06s when the bootstrap compiler is already downloaded.
…oieni

Fix fallback for CI_JOB_NAME

If CI_JOB_NAME is not specified, it's supposed to fall back to the image name, which is `$image`, not `$IMAGE`.

Failing to set the correct CI_JOB_NAME causes failures when running `dist-ohos-*` images locally.
clippy: fix test filtering when TESTNAME is empty

Fixes rust-lang#143824. Turns out bootstrap was just fine, the TESTNAME logic in clippy was wrong... I still made this a rustc PR as that's where I did all the debugging.

The bootstrap change is not really related, but it's comment-only so not worth a separate PR... adding the `test_args` is also part of what `prepare_cargo_test` would usually do so let's group the code properly.
…trace, r=Kobzol

Fix command trace

With the recent developments in centralization of command execution, we somehow broke the traces for command execution. This PR fixes that and add trace to stream command execution as well.

r? `@Kobzol`
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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-infra Relevant to the infrastructure 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. rollup A PR which is a rollup labels Jul 13, 2025
@fmease
Copy link
Member Author

fmease commented Jul 13, 2025

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Jul 13, 2025

📌 Commit 115f0bd has been approved by fmease

It is now in the queue for this repository.

@bors bors 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 Jul 13, 2025
@bors
Copy link
Collaborator

bors commented Jul 13, 2025

⌛ Testing commit 115f0bd with merge 911d423...

bors added a commit that referenced this pull request Jul 13, 2025
Rollup of 14 pull requests

Successful merges:

 - #143301 (`tests/ui`: A New Order [26/N])
 - #143461 (make `cfg_select` a builtin macro)
 - #143519 (Check assoc consts and tys later like assoc fns)
 - #143554 (slice: Mark `rotate_left`, `rotate_right` unstably const)
 - #143634 (interpret/allocation: expose init + write_wildcards on a range)
 - #143679 (Preserve the .debug_gdb_scripts section)
 - #143685 (Resolve: merge `source_bindings` and `target_bindings` into `bindings`)
 - #143704 (Be a bit more careful around exotic cycles in in the inliner)
 - #143734 (Refactor resolve resolution bindings)
 - #143774 (constify `From` and `Into`)
 - #143785 (Add --compile-time-deps argument for x check)
 - #143786 (Fix fallback for CI_JOB_NAME)
 - #143825 (clippy: fix test filtering when TESTNAME is empty)
 - #143826 (Fix command trace)

r? `@ghost`
`@rustbot` modify labels: rollup
@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)
failures:

---- [mir-opt] tests/mir-opt/inline_double_cycle.rs stdout ----

thread '[mir-opt] tests/mir-opt/inline_double_cycle.rs' panicked at src/tools/compiletest/src/runtest/mir_opt.rs:79:21:
Output file `/checkout/tests/mir-opt/inline_double_cycle.a.Inline.panic-abort.diff` from test does not exist
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    [mir-opt] tests/mir-opt/inline_double_cycle.rs

@bors
Copy link
Collaborator

bors commented Jul 13, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 13, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2025
@fmease fmease deleted the rollup-lkq2med branch July 13, 2025 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-testsuite Area: The testsuite used to check the correctness of rustc rollup A PR which is a rollup 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-infra Relevant to the infrastructure 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.