Skip to content

Rollup of 6 pull requests#158277

Closed
jhpratt wants to merge 17 commits into
rust-lang:mainfrom
jhpratt:rollup-upPIYfA
Closed

Rollup of 6 pull requests#158277
jhpratt wants to merge 17 commits into
rust-lang:mainfrom
jhpratt:rollup-upPIYfA

Conversation

@jhpratt

@jhpratt jhpratt commented Jun 23, 2026

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

Dnreikronos and others added 17 commits June 21, 2026 15:42
They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

Many of the shim variants still have `Shim` at the end of their names.
To make the refactoring easier and keep the diff clean, I will trim
those suffixes off in the next commit.
It used to be much more prevalent before I extracted shims as their own enum.
…erics, r=petrochenkov

delegation: add support for infers in generics

This PR adds support for generating generic params for lifetimes and types/consts infers (`'_`. `_`). We support only single infers, if they are nested then we do nothing and eventually an error will be emitted after inheriting this unsound signature (i.e., `reuse foo::<Vec<_>>` is not supported).

The basic idea is:
```rust
fn foo<'a, 'b: 'b, T, const N: usize>() {}

reuse foo::<'_, String, _> as bar;

// Desugaring:
fn bar<'b, const N: usize>() {
  foo::<'b, String, N>()
}
```

So we generated params and lifetimes for provided infers. Note that in case of lifetimes we may have early and late bound lifetimes in child segment. We process only early-bound lifetimes as they are present in signature function generics (`tcx.generics_of(sig_id)`). Moreover since this PR we started to explicitly propagate early-bound lifetimes in generated delegation's call, so the warning about specifying lifetimes when late-bound lifetimes are present is suppressed for delegation segments.

Next, we limit the number of processed infers with the number of generic params in the signature function, so if we have `fn foo<X, Y>() {}` and we wrote `reuse foo::<_, _, _, _>;` we will not generate 4 generic params in delegation, we will generate 2 (`X` and `Y`), two remaining infers will not be processed and this will result in an error.

Considering free-to-trait reuses this PR extends the number of supported cases, as now we always generate `Self` generic param when needed:
```rust
trait Trait<'a, X> {
    fn method<'b, const M: usize>(&self) where 'b:'b { }
    fn r#static<'b, Y, const B: bool>() { }
}

impl <'a, X> Trait<'a, X> for () { }

reuse Trait::<'_, _>::method::<'_, _> as foo;
reuse <_ as Trait<'_, _>>::method::<'_, _> as foo1;
reuse <() as Trait<'_, _>>::method::<'_, _> as foo2;
reuse <_ as Trait<'_, _>>::r#static::<_, _> as foo3;
reuse <() as Trait<'_, _>>::r#static::<_, _> as foo4;
reuse Trait::<'_, _>::r#static::<_, _> as foo5;

// Desugaring:
#[attr = Inline(Hint)]
fn foo<'a, 'b, Self, X, const M: _>(self: _) -> _ where 'a:'a,
    'b:'b { <Self as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo1<'a, 'b, Self, X, const M: _>(self: _) -> _ where 'a:'a,
    'b:'b { <Self as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo2<'a, 'b, X, const M: _>(self: _) -> _ where 'a:'a,
    'b:'b { <() as Trait::<'a, X>>::method::<'b, M>(self) }
#[attr = Inline(Hint)]
fn foo3<'a, Self, X, Y, const B: _>() -> _ where
    'a:'a { <Self as Trait::<'a, X>>::r#static::<Y, B>() }
#[attr = Inline(Hint)]
fn foo4<'a, X, Y, const B: _>() -> _ where
    'a:'a { <() as Trait::<'a, X>>::r#static::<Y, B>() }
#[attr = Inline(Hint)]
fn foo5<'a, Self, X, Y, const B: _>() -> _ where
    'a:'a { <Self as Trait::<'a, X>>::r#static::<Y, B>() }
```
Note that we generated `Self` in `foo5` reuse. With that done the error about self-type specification is removed.

Finally this PR greatly simplifies generic args for signature inheritance generation code.

Part of rust-lang#118212.
r? @petrochenkov
…ure-restriction, r=WaffleLapkin

Lift the same-signature restriction for `extern "tail"`

tracking issue: rust-lang#157427

The `extern "tail"` calling convention uses callee cleanup (i.e. the callee restores the stack, not the caller). Hence, the same-signature restriction that is normally required to codegen tail calls does not apply.

We need the ABI to deviate from `extern "Rust"` to make sure indirect arguments are passed by stack offset, not via a pointer into the caller's stack frame (the value would potentially be overwritten). For standard tail calls we work around this problem by storing the value in the caller's caller, but for `extern "tail"` that doesn't work reliably because the signatures can be different.

I'm not sure about unsized arguments. That feature seems really broken, so I'm not sure how much work we should put into trying to do something reasonable there. Fundamentally I don't think we can support unsized arguments in `extern "tail"` calls.

Also we can't really promote using this yet due to `tailcc` being a bit broken on LLVM 22 on x86_64.

r? WaffleLapkin
cc @bjorn3
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
…, r=petrochenkov

Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted`

This PR splits the function `resolve_ident_in_module_non_globs_unadjusted` into 2 variants:
- one for local modules, which is the same work as before
- other for external modules, which requires less work

In preperations for parallel import resolution and overall resolver refactor.

r? @petrochenkov
…_diagnostic, r=TaKO8Ki

format: ignore println newline in foreign format hints

fixes rust-lang#158216

`println!` adds a newline before the unused-arg diagnostic checks for printf-style formats. that made a trailing `%` look like `%` plus `
`, so rustc printed a weird unsupported conversion specifier note.

imo the least risky fix is to leave normal format parsing alone and only strip that synthetic newline for the foreign-format hint scan. idk if there is much more to do here, the ui tests cover the reported case plus the older trailing-percent baselines. lgtm to me, ltm this keeps the behavior narrow.
…-light-chevrolet-my-mama-taught-me-wrong-from-right, r=jieyouxu

triagebot: Stop pinging myself

rust-lang/team#2523
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Jun 23, 2026
@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself F-explicit_tail_calls `#![feature(explicit_tail_calls)]` PG-exploit-mitigations Project group: Exploit mitigations 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. labels Jun 23, 2026
@jhpratt

jhpratt commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d22cdcf 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 Jun 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Tree closed for PRs with priority less than 5.

@jhpratt

jhpratt commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

@bors retry

@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 Jun 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
@rust-bors rust-bors Bot 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 Jun 23, 2026
@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 7582fed failed: CI. Failed job:

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors retry

@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 Jun 23, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  DEPLOY: 1
  IMAGE: dist-ohos-x86_64
##[endgroup]
    Updating crates.io index
error: failed to get `cookie` as a dependency of package `cookie_store v0.21.1`
    ... which satisfies dependency `cookie_store = "^0.21.1"` of package `ureq v3.0.8`
    ... which satisfies dependency `ureq = "^3"` of package `citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)`

Caused by:
  failed to load source for dependency `cookie`

Caused by:
  unable to update registry `crates-io`

Caused by:
  download of co/ok/cookie failed

Caused by:
  curl failed

Caused by:

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  DEPLOY: 1
  IMAGE: dist-powerpc64-linux-gnu
##[endgroup]
    Updating crates.io index
error: failed to get `askama_derive` as a dependency of package `askama_macros v0.16.0`
    ... which satisfies dependency `askama_macros = "=0.16.0"` of package `askama v0.16.0`
    ... which satisfies dependency `askama = "^0.16.0"` of package `citool v0.1.0 (/home/runner/work/rust/rust/src/ci/citool)`

Caused by:
  failed to load source for dependency `askama_derive`

Caused by:
  unable to update registry `crates-io`

Caused by:
  download of as/ka/askama_derive failed

Caused by:
  curl failed

Caused by:

@rust-bors rust-bors Bot 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 Jun 23, 2026
@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 660e7d3 failed: CI. Failed job:

@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 Jun 23, 2026
@rust-bors

rust-bors Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

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

@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 23, 2026
@jhpratt jhpratt closed this Jun 23, 2026
@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 Jun 23, 2026
@jhpratt jhpratt deleted the rollup-upPIYfA branch June 23, 2026 02:38
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job i686-gnu-nopt-1 failed! Check out the build log: (web) (plain enhanced) (plain)

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

---- [ui] tests/ui/explicit-tail-calls/tailcc-no-signature-restriction.rs#x86 stdout ----

error in revision `x86`: test did not exit with success! code=Some(101) so test would pass with `run-fail`
status: exit status: 101
command: cd "/checkout/obj/build/i686-unknown-linux-gnu/test/ui/explicit-tail-calls/tailcc-no-signature-restriction.x86" && RUSTC="/checkout/obj/build/i686-unknown-linux-gnu/stage2/bin/rustc" RUST_TEST_THREADS="4" "/checkout/obj/build/i686-unknown-linux-gnu/test/ui/explicit-tail-calls/tailcc-no-signature-restriction.x86/a"
stdout: none
--- stderr -------------------------------

thread 'main' (112774) panicked at /checkout/tests/ui/explicit-tail-calls/tailcc-no-signature-restriction.rs:43:5:
assertion `left == right` failed

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

Labels

A-meta Area: Issues & PRs about the rust-lang/rust repository itself F-explicit_tail_calls `#![feature(explicit_tail_calls)]` PG-exploit-mitigations Project group: Exploit mitigations rollup A PR which is a rollup T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants