)]}'
{
  "commit": "a9db3509b635ececbbed8b609a0ca2adce138704",
  "tree": "cdd8fd687abe1af72c66519611b6f71f6cd21e05",
  "parents": [
    "0b4e7401e5b9ecc6a781ce071b876e974d53f98f",
    "7d42183eeb7f5d9b46a7a7caa79f8a8fe8073c07"
  ],
  "author": {
    "name": "Jacob Pratt",
    "email": "jacob@jhpratt.dev",
    "time": "Wed Jun 24 00:40:15 2026 -0400"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Wed Jun 24 00:40:15 2026 -0400"
  },
  "message": "Rollup merge of #157960 - aerooneqq:delegation-infers-in-generics, r\u003dpetrochenkov\n\ndelegation: add support for infers in generics\n\nThis PR adds support for generating generic params for lifetimes and types/consts infers (`\u0027_`. `_`). 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::\u003cVec\u003c_\u003e\u003e` is not supported).\n\nThe basic idea is:\n```rust\nfn foo\u003c\u0027a, \u0027b: \u0027b, T, const N: usize\u003e() {}\n\nreuse foo::\u003c\u0027_, String, _\u003e as bar;\n\n// Desugaring:\nfn bar\u003c\u0027b, const N: usize\u003e() {\n  foo::\u003c\u0027b, String, N\u003e()\n}\n```\n\nSo 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\u0027s call, so the warning about specifying lifetimes when late-bound lifetimes are present is suppressed for delegation segments.\n\nNext, we limit the number of processed infers with the number of generic params in the signature function, so if we have `fn foo\u003cX, Y\u003e() {}` and we wrote `reuse foo::\u003c_, _, _, _\u003e;` 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.\n\nConsidering free-to-trait reuses this PR extends the number of supported cases, as now we always generate `Self` generic param when needed:\n```rust\ntrait Trait\u003c\u0027a, X\u003e {\n    fn method\u003c\u0027b, const M: usize\u003e(\u0026self) where \u0027b:\u0027b { }\n    fn r#static\u003c\u0027b, Y, const B: bool\u003e() { }\n}\n\nimpl \u003c\u0027a, X\u003e Trait\u003c\u0027a, X\u003e for () { }\n\nreuse Trait::\u003c\u0027_, _\u003e::method::\u003c\u0027_, _\u003e as foo;\nreuse \u003c_ as Trait\u003c\u0027_, _\u003e\u003e::method::\u003c\u0027_, _\u003e as foo1;\nreuse \u003c() as Trait\u003c\u0027_, _\u003e\u003e::method::\u003c\u0027_, _\u003e as foo2;\nreuse \u003c_ as Trait\u003c\u0027_, _\u003e\u003e::r#static::\u003c_, _\u003e as foo3;\nreuse \u003c() as Trait\u003c\u0027_, _\u003e\u003e::r#static::\u003c_, _\u003e as foo4;\nreuse Trait::\u003c\u0027_, _\u003e::r#static::\u003c_, _\u003e as foo5;\n\n// Desugaring:\n#[attr \u003d Inline(Hint)]\nfn foo\u003c\u0027a, \u0027b, Self, X, const M: _\u003e(self: _) -\u003e _ where \u0027a:\u0027a,\n    \u0027b:\u0027b { \u003cSelf as Trait::\u003c\u0027a, X\u003e\u003e::method::\u003c\u0027b, M\u003e(self) }\n#[attr \u003d Inline(Hint)]\nfn foo1\u003c\u0027a, \u0027b, Self, X, const M: _\u003e(self: _) -\u003e _ where \u0027a:\u0027a,\n    \u0027b:\u0027b { \u003cSelf as Trait::\u003c\u0027a, X\u003e\u003e::method::\u003c\u0027b, M\u003e(self) }\n#[attr \u003d Inline(Hint)]\nfn foo2\u003c\u0027a, \u0027b, X, const M: _\u003e(self: _) -\u003e _ where \u0027a:\u0027a,\n    \u0027b:\u0027b { \u003c() as Trait::\u003c\u0027a, X\u003e\u003e::method::\u003c\u0027b, M\u003e(self) }\n#[attr \u003d Inline(Hint)]\nfn foo3\u003c\u0027a, Self, X, Y, const B: _\u003e() -\u003e _ where\n    \u0027a:\u0027a { \u003cSelf as Trait::\u003c\u0027a, X\u003e\u003e::r#static::\u003cY, B\u003e() }\n#[attr \u003d Inline(Hint)]\nfn foo4\u003c\u0027a, X, Y, const B: _\u003e() -\u003e _ where\n    \u0027a:\u0027a { \u003c() as Trait::\u003c\u0027a, X\u003e\u003e::r#static::\u003cY, B\u003e() }\n#[attr \u003d Inline(Hint)]\nfn foo5\u003c\u0027a, Self, X, Y, const B: _\u003e() -\u003e _ where\n    \u0027a:\u0027a { \u003cSelf as Trait::\u003c\u0027a, X\u003e\u003e::r#static::\u003cY, B\u003e() }\n```\nNote that we generated `Self` in `foo5` reuse. With that done the error about self-type specification is removed.\n\nFinally this PR greatly simplifies generic args for signature inheritance generation code.\n\nPart of rust-lang/rust#118212.\nr? @petrochenkov\n",
  "tree_diff": []
}
