GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants by fmease · Pull Request #136429 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

fmease

1st commit: Partially addresses #136204 by turning const eval errors from post to pre-mono for free lifetime-generic constants.
Re. 2nd commit: Oof, yeah, I missed that in the initial impl!

This doesn't fully address #136204 because I still haven't figured out how & where to properly & best suppress const eval of free constants whose predicates don't hold at the def site. The motivating example is const _UNUSED: () = () where for<'_delay> String: Copy; which can also be found over at the tracking issue #113521.

r? compiler-errors or reassign

@rustbot rustbot added 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

Feb 2, 2025

fmease

@fmease

@rust-timer

This comment has been minimized.

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 2, 2025

@bors

GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants

1st commit: Partially addresses rust-lang#136204 by turning const eval errors from post to pre-mono for free lifetime-generic constants. Re. 2nd commit: Oof, that's embarrassing! How could I miss that in the initial impl?

This doesn't fully address rust-lang#136204 because I still haven't figured out how & where to properly & best suppress const eval of free constants whose predicates don't hold at the def site. The motivating example is #![feature(trivial_bounds)] const _UNUSED: () = () where String: Copy; which can also be found over at the tracking issue rust-lang#113521.

r? compiler-errors or reassign

fmease

@bors

☀️ Try build successful - checks-actions
Build commit: ea1cdda (ea1cdda3b51a1290675800f2196813f4bfc693bd)

@rust-timer

This comment has been minimized.

@rust-timer

Finished benchmarking commit (ea1cdda): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌ (primary) 0.9% [0.4%, 1.1%] 8
Regressions ❌ (secondary) 0.3% [0.3%, 0.3%] 1
Improvements ✅ (primary) - - 0
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) 0.9% [0.4%, 1.1%] 8

Max RSS (memory usage)

Results (primary 1.5%, secondary -2.0%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌ (primary) 1.5% [1.0%, 2.0%] 2
Regressions ❌ (secondary) - - 0
Improvements ✅ (primary) - - 0
Improvements ✅ (secondary) -2.0% [-2.0%, -2.0%] 1
All ❌✅ (primary) 1.5% [1.0%, 2.0%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 777.275s -> 776.801s (-0.06%)
Artifact size: 328.69 MiB -> 328.73 MiB (0.01%)

compiler-errors

@rustbot

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @rust-lang/wg-const-eval

@fmease fmease marked this pull request as draft

February 3, 2025 04:28

@fmease

@rust-timer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 3, 2025

@bors

GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants

1st commit: Partially addresses rust-lang#136204 by turning const eval errors from post to pre-mono for free lifetime-generic constants. Re. 2nd commit: Oof, yeah, I missed that in the initial impl!

This doesn't fully address rust-lang#136204 because I still haven't figured out how & where to properly & best suppress const eval of free constants whose predicates don't hold at the def site. The motivating example is #![feature(trivial_bounds)] const _UNUSED: () = () where String: Copy; which can also be found over at the tracking issue rust-lang#113521.

r? compiler-errors or reassign

@bors

@bors

☀️ Try build successful - checks-actions
Build commit: 6f11489 (6f11489377389dbe08c91408f1c8f953933c18cd)

@rust-timer

This comment has been minimized.

@RalfJung

turning const eval errors from post to pre-mono for free lifetime-generic constants.

This should be listed as an item in the tracking issue to make sure it is discussed during stabilization.

@fmease fmease added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Feb 4, 2025

@fmease fmease added the rla-silenced

Silences rust-log-analyzer postings to the PR it's added on.

label

May 2, 2025

@fmease @compiler-errors

Co-authored-by: Michael Goulet michael@errs.io

@fmease

@fmease

I've reverted the revert of the perf optimization from #121387 (meaning: we won't use const_eval_poly and we'll continue to pass empty substs instead of identity substs since that didn't seem to affect things negatively (I've left a FIXME ofc)), so marking
@bors rollup-
@rustbot label -perf-regression

With @BoxyUwU currently reworking&fixing wfchecking for type-system consts (and consts in general?) (see #137972, #140549, #140553) and with impossible predicates on const items leading to MIR Unreachables being the hot topic for other people, too, I'd like to postpone that part of issue #136204 and keep the scope of this PR limited / as is.

I don't want to interfere with Boxy's work which might even fix this and if not I'd at least have more time to gain intel on how to best fix it (I remember from February that there was some preexisting issues, like ImpossiblePredicates not considering non-global preds for example).

WDYT?

@fmease fmease marked this pull request as ready for review

May 2, 2025 19:12

@fmease fmease added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

rla-silenced

Silences rust-log-analyzer postings to the PR it's added on.

labels

May 2, 2025

@rust-log-analyzer

This comment has been minimized.

@fmease

@fmease

Actually let's perf run as a sanity check cuz I might've modified hot paths here and we're doing a bit more work.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

May 2, 2025

@bors

GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants

1st commit: Partially addresses rust-lang#136204 by turning const eval errors from post to pre-mono for free lifetime-generic constants. Re. 2nd commit: Oof, yeah, I missed that in the initial impl!

This doesn't fully address rust-lang#136204 because I still haven't figured out how & where to properly & best suppress const eval of free constants whose predicates don't hold at the def site. The motivating example is #![feature(trivial_bounds)] const _UNUSED: () = () where String: Copy; which can also be found over at the tracking issue rust-lang#113521.

r? compiler-errors or reassign

@bors

☀️ Try build successful - checks-actions
Build commit: 3f34812 (3f348129e6da6289f0ba3825919c2124c4cc6a89)

@rust-timer

This comment has been minimized.

@rust-timer

This comment has been minimized.

@rust-timer

Finished benchmarking commit (3f34812): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please fix the regressions and do another perf run. If the next run shows neutral or positive results, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌ (primary) 0.5% [0.5%, 0.5%] 1
Regressions ❌ (secondary) - - 0
Improvements ✅ (primary) -2.8% [-2.8%, -2.8%] 1
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) -1.2% [-2.8%, 0.5%] 2

Max RSS (memory usage)

Results (primary -0.3%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌ (primary) 1.4% [0.5%, 3.0%] 6
Regressions ❌ (secondary) - - 0
Improvements ✅ (primary) -0.6% [-1.9%, -0.4%] 35
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) -0.3% [-1.9%, 3.0%] 41

Cycles

Results (primary -0.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌ (primary) 0.5% [0.4%, 0.7%] 8
Regressions ❌ (secondary) - - 0
Improvements ✅ (primary) -1.0% [-2.6%, -0.4%] 5
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) -0.1% [-2.6%, 0.7%] 13

Binary size

Results (primary -1.1%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌ (primary) - - 0
Regressions ❌ (secondary) - - 0
Improvements ✅ (primary) -1.1% [-1.1%, -1.1%] 1
Improvements ✅ (secondary) - - 0
All ❌✅ (primary) -1.1% [-1.1%, -1.1%] 1

Bootstrap: 769.081s -> 770.42s (0.17%)
Artifact size: 365.55 MiB -> 365.42 MiB (-0.04%)