Skip to content

[perf-only] "[STACKED] GCI: Imply outlives-bounds on free (generic) const items" without the supposed fastpath - #164515

Closed
fmease wants to merge 5 commits into
rust-lang:mainfrom
fmease:gci-impl-without-supposed-fastpath
Closed

fmease wants to merge 5 commits into
rust-lang:mainfrom
fmease:gci-impl-without-supposed-fastpath

Conversation

@fmease

@fmease fmease commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Re-auditing https://github.com/rust-lang/rust/pull/143029/changes#r2868932065 with the added context of #143029 (comment) / #143029 (comment).

Gonna compare the perf results from this PR against the ones requested here: #143029 (comment).

(No LLM was or will be used by me during the entire creation process of this PR)

In summary, rename various things & update a lot of comments.

1. Rename some types, fns that have "clause" in their name to contain
   "outlives clause" instead. While we are in a module called `outlives`,
   it's not immediately obvious & it certainly doesn't imply that all of
   these things only represent / act on outlives-clauses.
   Requested by Boxy.
2. Both `global_inferred_outlives` and `explicit_map` store a "global"
   mapping from each crate-local item to a set of outlives-clauses
   collected so far (one containing the inferred ones, the other the
   explicit ones). So name both consistently: `global_inferred_clauses`
   and `global_explicit_clauses`, respectively.
   Similarly for their types which are now prefixed with `Global`.
3. Remove a bunch of really obvious & distracting comments.
4. Reduce rightward drift in the `ty::Dynamic` match arm by using an
   if-let guard.
5. Deduplicate code shared between ADTs & CTAs in `inferred_outlives_of`
6. `bug!()` in a `GenericArgKind::Const(_)` branch which we know is
   currently unreachable and which should explode if that were to change.
7. Rename `CrateClausesMap` to `CrateInferredOutlivesClausesMap`.
   The type is public & lives in `rustc_middle` since
   `inferred_outlives_crate` is a query. Considering that, its name is
   way too general.
   Moreover, remove all of its docs. This type can only be constructed
   via query `inferred_outlives_crate` (well, and via the provider) which
   has good docs already that also warn about the fact that query
   `inferred_outlives_of` should always be used instead.
8. Remove comment "Typically there won't be many of these [explicit
   outlives clauses], except in older code where they were mandatory" is
   unnecessary and factually incorrect since there are various places
   where we don't imply (early-bound) outlives-bounds.
9. Re. comment "Visit all the crates [...]" and "[...] we walk the crates
   again [...]" is no longer correct: We only (re)visit the items in the
   local crate; the inferred outlives clauses for cross-crate items have
   already been computed and stored in the relevant crate metadata files.
10. Fix the example given in `check_explicit_clauses`'s docs, it has
    several issues: Struct `Outer` gets used as a trait bound, it uses
    `...: 'static` bounds and states they get processed but as a matter
    of fact we don't process static bounds, we specifically only infer
    clauses where the LHS is early-bound!
11. Various minor code tweaks.
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 18, 2026
@fmease

fmease commented Oct 18, 2026

Copy link
Copy Markdown
Member Author

@bors try parent=33295d734447c7a2c22c44190f11bce6164a035a @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 18, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Oct 18, 2026
…<try>

[perf-only] "[STACKED] GCI: Imply outlives-bounds on free (generic) const items" without the supposed fastpath
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 5de1deb (5de1deba91f0745a3d1b9cd0c328776a870eab1b)
Base parent: 33295d7 (33295d734447c7a2c22c44190f11bce6164a035a)

@rust-timer

This comment has been minimized.

@fmease
fmease force-pushed the gci-impl-without-supposed-fastpath branch from 7680043 to a09f21f Compare October 18, 2026 12:50
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (5de1deb): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (secondary 3.3%)

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)
3.3% [2.2%, 4.7%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (primary -2.9%, secondary -4.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)
- - 0
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
-4.8% [-4.8%, -4.8%] 1
All ❌✅ (primary) -2.9% [-2.9%, -2.9%] 1

Binary size

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

Bootstrap: 488.147s -> 490.382s (0.46%)
Artifact size: 408.98 MiB -> 409.06 MiB (0.02%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 18, 2026
@fmease fmease closed this Oct 18, 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 Oct 18, 2026
@fmease
fmease deleted the gci-impl-without-supposed-fastpath branch October 18, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide 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.

4 participants