Skip to content

Rollup of 6 pull requests#159263

Merged
rust-bors[bot] merged 15 commits into
rust-lang:mainfrom
jhpratt:rollup-1gDsq5l
Jul 14, 2026
Merged

Rollup of 6 pull requests#159263
rust-bors[bot] merged 15 commits into
rust-lang:mainfrom
jhpratt:rollup-1gDsq5l

Conversation

@jhpratt

@jhpratt jhpratt commented Jul 14, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

calvinrp and others added 15 commits July 9, 2026 16:24
Since PR 154149, when one item is glob-imported into a module twice with
different visibilities, the first-arrived declaration stays in the
resolution slot and the most visible declaration of the ambiguous glob
set is only recorded in `ambiguity_vis_max`. `DeclData::vis()` returns
the max, so name resolution, metadata reexports and
`cross_crate_inlinable` export the item at the maximum visibility, but
`set_bindings_effective_visibilities` walked only the slot-resident
declaration's reexport chain. When the restricted route arrives first,
the definition's effective visibility caps at the restricted
visibility while the item is still exported: spurious dead_code, the
item missing from reachable_set, should_encode_mir returning false, and
downstream crates failing with "missing optimized MIR" (a 1.96.1 ->
1.97.0 stable-to-stable regression).

Generalize the one-level `ambiguity_vis_max` update that PR 154149 added
in `update_import` (to keep the most visible import from being reported
as unused) into a walk of that declaration's whole reexport chain:
extract the chain walk into `update_decl_chain` and recurse into
`ambiguity_vis_max` at every hop, so the most visible declaration
drives the effective visibility of everything on its route, including
the final definition. Updates are monotone, so the dual walk is
order-independent. The `ambiguous_import_visibilities` lint and the
PR 156284 diagnostic suppression are untouched.
Point the suggestion at the const argument's span instead of the whole obligation, and parenthesize the snippet when the const expression needs it (e.g. `(N + 1) as usize`) so the suggested bound parses and compiles.

Also add regression tests for legacy const generic where-bound suggestions.
…biguity, r=petrochenkov

resolve: fix effective visibilities for items in ambiguous glob sets

Fixes rust-lang#159038 (1.96.1 → 1.97.0 regression; details there).

When an item is glob-imported twice at different visibilities, effective visibility was computed from whichever declaration arrived first, not the most visible one. An exported item could then get no MIR encoded, and downstream crates fail with ``missing optimized MIR``.

Fix: also walk the most visible declaration's re-export chain (`update_decl_chain`, recursing into `ambiguity_vis_max`). Lint behavior unchanged. Two regression tests added; `tests/ui/{imports,privacy,resolve}` pass with every rust-lang#154149 / rust-lang#156284 test unmodified.

@rustbot label +A-resolve +A-visibility +T-compiler +regression-from-stable-to-stable
…-bound-suggestion, r=mu001999

Fix where-bound suggestion with legacy const generics

## Summary
During lowering of legacy const generics in `lower_legacy_const_generics`, the function's span was passed when creating the associated `LocalDefId` instead of the const argument span. This later caused diagnostics to pull the function's name instead of the const argument for suggestions when emitting an `unconstrained generic constant` error.

Also adds regression tests for all basic integer types. The full set isn't redundant: non-`usize` types exercise the `as usize` cast in the suggestion, while `usize` exercises the no-cast path. The tests use a cross-crate aux crate rather than a target-specific intrinsic (the rewrite only fires cross-crate), so they run on all platforms.

### Sample
```rust
#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

use std::arch::x86_64::*;
fn uwu<const N: i32>() {
    unsafe {
        let a = _mm_setzero_ps();
        let b = _mm_setzero_ps();
        _mm_shuffle_ps(a, b, N + 1);
    }
}
```
### Previous Output
```rust
error: unconstrained generic constant
 --> src/lib.rs:9:30
  |
9 |         _mm_shuffle_ps(a, b, N + 1);
  |                              ^^^^^
  |
help: try adding a `where` bound
  |
5 | fn uwu<const N: i32>() where [(); _mm_shuffle_ps as usize]: {
  |                        ++++++++++++++++++++++++++++++++++++
```
### Current Output
```rust
error: unconstrained generic constant
 --> src/lib.rs:9:30
  |
9 |         _mm_shuffle_ps(a, b, N + 1);
  |                              ^^^^^
  |
help: try adding a `where` bound
  |
5 | fn uwu<const N: i32>() where [(); N + 1 as usize]: {
  |                        +++++++++++++++++++++++++++
```

## AI Assistance Disclosure
This is my first time contributing to the compiler, and I used Claude Opus 4.8 to assist with finding the root cause and implementing the fix, and to navigate the contributing docs, build system, and debugging tooling. The regression tests were designed and written entirely by me. I used Grok to proofread the written materials (commit bodies and this PR) for spelling and grammar. I reviewed and verified all changes myself.

## Related Issues
Closes rust-lang#108382
…al-casts-dyn-any, r=folkertdev

Skip trivial cast lint for trait object upcasts

Fixes rust-lang#148219

In the case like `(other as &dyn Any).downcast_ref::<T>()`, removing the cast can change method lookup, so the cast is not always trivial, so skip lint on it.
Update books

## rust-lang/book

3 commits in 05d114287b7d6f6c9253d5242540f00fbd6172ab..dd7ab4f4f4541adf4aa2a872cdac06c206b73288
2026-07-10 19:43:43 UTC to 2026-06-29 20:56:02 UTC

- Update to Rust 1.97 (rust-lang/book#4799)
- doc: upgrade rand dependency to v0.10.1 in book listings and text (rust-lang/book#4756)
- Explicitly state "compilation modes" (rust-lang/book#3517)

## rust-lang/edition-guide

1 commits in c3c0f0b3da26610138b7ba7663f60cd2c68cf184..53686db907c45268d1b323afd9a3545a37abbced
2026-07-10 17:05:04 UTC to 2026-07-10 17:05:04 UTC

- Fix typo of key name `resolver.incompatible-rust-versions` (rust-lang/edition-guide#385)

## rust-lang/reference

4 commits in 86635e30bf861a038dc197d7e16fd09e7e514e7a..afdc77bab886d4455c11247cdd32391bfab636ae
2026-07-09 16:48:44 UTC to 2026-07-06 14:48:32 UTC

- Fix the tagged-union pattern-matching recommendation (rust-lang/reference#2303)
- Structs with no fields or all-ZST fields are ZSTs (rust-lang/reference#2262)
- macros.md: fix case (rust-lang/reference#2307)
- Bump railroad-dependency (rust-lang/reference#2305)

## rust-lang/rust-by-example

1 commits in d3117f6c873acbbf331c1d510371d061dfcc975c..15308f3e951814ef3475d2b58f48276e6b17b9af
2026-07-06 10:14:39 UTC to 2026-07-06 10:14:39 UTC

- Update Chinese translations in `zh.po` (rust-lang/rust-by-example#2025)
…ias, r=Urgau

compiler: Remove `-Zmutable-noalias`

Let us mark the end of an era. The `noalias` optimization has been working relatively well for some time now. There may still be issues to sort out with `noalias`. If so, those are mostly on LLVM's side, where it may need to have a better model of what `noalias` means as that is necessary for soundly inferring it. We also may need to not add `noalias` somewhere we currently do, if our semantics do not actually match that. Either way, it doesn't seem useful to configure on a compilation-wide basis.
…thanBrouwer

Rename `errors.rs` file to `diagnostics.rs` (13/N)

Follow-up of rust-lang#157485.

r? @JonathanBrouwer
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jul 14, 2026
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jul 14, 2026
@jhpratt

jhpratt commented Jul 14, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 57f0adc has been approved by jhpratt

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 Jul 14, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 14, 2026
@rust-bors

rust-bors Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: jhpratt
Duration: 3h 38m 6s
Pushing da80ed0 to main...

@rust-bors rust-bors Bot merged commit da80ed0 into rust-lang:main Jul 14, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 14, 2026
@jhpratt jhpratt deleted the rollup-1gDsq5l branch July 14, 2026 07:55
@rust-timer

Copy link
Copy Markdown
Collaborator

📌 Perf builds for each rolled up PR:

PR# Message Perf Build Sha
#159039 resolve: fix effective visibilities for items in ambiguous … 53dbf1449537bf1145c6be28320b9e0f997d08ee (link)
#158981 Fix where-bound suggestion with legacy const generics 3489f972f5bab551e2bc35259815c01eba7f0f0f (link)
#159061 Skip trivial cast lint for trait object upcasts 2ebc32d0517f5ccdb8e581436709839eb76bb74b (link)
#159241 Update books 720991bbda95b6b3157857c33a1edb33c428f4e3 (link)
#159248 compiler: Remove -Zmutable-noalias 45aa08d33111aa115125115ef34f7eda4eaca003 (link)
#159250 Rename errors.rs file to diagnostics.rs (13/N) abe131ee920e46977b76912eca40a28a456f1618 (link)

previous master: 55b6bd8ecb

In the case of a perf regression, run the following command for each PR you suspect might be the cause: @rust-timer build $SHA

@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 55b6bd8 (parent) -> da80ed0 (this PR)

Test differences

Show 14 test diffs

Stage 1

  • [codegen] tests/codegen-llvm/noalias-flag.rs: pass -> [missing] (J1)
  • [ui] tests/ui/const-generics/generic_const_exprs/legacy-const-generics-bound-suggestion.rs: [missing] -> pass (J3)
  • [ui] tests/ui/imports/ambiguous-import-visibility-globglob-mir.rs: [missing] -> pass (J3)
  • [ui] tests/ui/imports/ambiguous-import-visibility-globglob-reachable.rs: [missing] -> pass (J3)
  • [ui] tests/ui/lint/trivial-casts-dyn-any-issue-148219.rs: [missing] -> pass (J3)
  • [ui (polonius)] tests/ui/const-generics/generic_const_exprs/legacy-const-generics-bound-suggestion.rs: [missing] -> pass (J4)
  • [ui (polonius)] tests/ui/imports/ambiguous-import-visibility-globglob-mir.rs: [missing] -> pass (J4)
  • [ui (polonius)] tests/ui/imports/ambiguous-import-visibility-globglob-reachable.rs: [missing] -> pass (J4)
  • [ui (polonius)] tests/ui/lint/trivial-casts-dyn-any-issue-148219.rs: [missing] -> pass (J4)

Stage 2

  • [ui] tests/ui/const-generics/generic_const_exprs/legacy-const-generics-bound-suggestion.rs: [missing] -> pass (J0)
  • [ui] tests/ui/imports/ambiguous-import-visibility-globglob-mir.rs: [missing] -> pass (J0)
  • [ui] tests/ui/imports/ambiguous-import-visibility-globglob-reachable.rs: [missing] -> pass (J0)
  • [ui] tests/ui/lint/trivial-casts-dyn-any-issue-148219.rs: [missing] -> pass (J0)
  • [codegen] tests/codegen-llvm/noalias-flag.rs: pass -> [missing] (J2)

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard da80ed0708a09dc096c184345d6eb42cbcd50a1e --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-msvc-2: 1h 51m -> 2h 35m (+39.0%)
  2. dist-riscv64-linux: 1h 9m -> 1h 27m (+25.4%)
  3. dist-x86_64-llvm-mingw: 1h 36m -> 2h (+25.4%)
  4. dist-powerpc64-linux-musl: 1h 14m -> 1h 32m (+25.1%)
  5. x86_64-gnu-llvm-22-2: 1h 44m -> 1h 18m (-24.6%)
  6. dist-apple-various: 1h 48m -> 1h 25m (-21.3%)
  7. dist-arm-linux-musl: 1h 38m -> 1h 17m (-21.2%)
  8. dist-powerpc64le-linux-gnu: 1h 34m -> 1h 14m (-20.9%)
  9. x86_64-mingw-1: 2h 29m -> 2h 57m (+18.8%)
  10. dist-x86_64-msvc-alt: 2h 45m -> 2h 17m (-17.0%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (da80ed0): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 4.3%, secondary -5.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.3% [4.3%, 4.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.0% [-5.3%, -4.7%] 2
All ❌✅ (primary) 4.3% [4.3%, 4.3%] 1

Cycles

Results (secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.4%, 3.3%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.3% [-5.3%, -5.3%] 1
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.277s -> 491.202s (0.39%)
Artifact size: 389.95 MiB -> 389.32 MiB (-0.16%)

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. merged-by-bors This PR was explicitly merged by bors. rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants