Skip to content

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

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

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 29, 2025

Conversation

fmease
Copy link
Member

@fmease fmease commented Feb 2, 2025

  • 1st commit: Partially addresses #136204 by turning const eval errors from post to pre-mono for free lifetime-generic constants.
    • As the linked issue/comment states, on master there's a difference between const _: () = panic!(); (pre-mono error) and const _<'a>: () = panic!(); (post-mono error) which feels wrong.
    • With this PR, both become pre-mono ones!
  • 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

@fmease fmease added the F-generic_const_items `#![feature(generic_const_items)]` label Feb 2, 2025
@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
Copy link
Member Author

fmease commented Feb 2, 2025

@bors try @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 Feb 2, 2025
@bors
Copy link
Collaborator

bors commented Feb 2, 2025

⌛ Trying commit 5a8ee9b with merge ea1cdda...

bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 2, 2025
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
@bors
Copy link
Collaborator

bors commented Feb 2, 2025

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

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

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%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Feb 2, 2025
@fmease fmease force-pushed the gci-fix-def-site-checks branch from 5a8ee9b to 1dc3d6e Compare February 3, 2025 04:26
@rustbot
Copy link
Collaborator

rustbot commented Feb 3, 2025

Some changes occurred to the CTFE / Miri interpreter

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

@fmease fmease force-pushed the gci-fix-def-site-checks branch from 1dc3d6e to 9c2b71a Compare February 3, 2025 04:27
@fmease fmease marked this pull request as draft February 3, 2025 04:28
@fmease fmease force-pushed the gci-fix-def-site-checks branch from 9c2b71a to 9f2fdff Compare February 3, 2025 04:36
@fmease
Copy link
Member Author

fmease commented Feb 3, 2025

@bors try @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 Feb 3, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2025
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
Copy link
Collaborator

bors commented Feb 3, 2025

⌛ Trying commit 9f2fdff with merge 6f11489...

@bors
Copy link
Collaborator

bors commented Feb 3, 2025

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

@rust-timer

This comment has been minimized.

@RalfJung
Copy link
Member

RalfJung commented Feb 3, 2025 via email

@fmease fmease force-pushed the gci-fix-def-site-checks branch from dabc874 to fa6cd85 Compare May 27, 2025 16:59
@fmease
Copy link
Member Author

fmease commented May 27, 2025

impossible_predicates

I'll do that separately :)

@bors r=BoxyUwU rollup (nightly feature)

@bors
Copy link
Collaborator

bors commented May 27, 2025

📌 Commit fa6cd85 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors 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 May 27, 2025
@fmease
Copy link
Member Author

fmease commented May 27, 2025

Ah right, this did have a slight negative perf impact but it looks spurious to me / acceptable in any case.

@fmease fmease added perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. and removed perf-regression Performance regression. labels May 27, 2025
@rust-log-analyzer

This comment has been minimized.

@fmease
Copy link
Member Author

fmease commented May 27, 2025

Oh no :( @bors r-

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 27, 2025
@fmease fmease force-pushed the gci-fix-def-site-checks branch from fa6cd85 to 9f12748 Compare May 28, 2025 13:23
@fmease
Copy link
Member Author

fmease commented May 28, 2025

Right, in #140672 errs made us deeply normalize during WF in the next solver which didn't get picked up as a conflict during the rebase (good that a test caught it!). Fixed.

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented May 28, 2025

📌 Commit 9f12748 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 28, 2025
bors added a commit that referenced this pull request May 29, 2025
Rollup of 16 pull requests

Successful merges:

 - #136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants)
 - #138139 (Emit warning while outputs is not exe and prints linkage info)
 - #141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7)
 - #141477 (Path::with_extension: show that it adds an extension where one did no…)
 - #141533 (clean up old rintf leftovers)
 - #141612 (Call out possibility of invariant result in variance markers)
 - #141638 (Use `builtin_index` instead of hand-rolling it)
 - #141643 (ci: verify that codebuild jobs use ghcr.io)
 - #141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.)
 - #141680 (replace TraitRef link memory.md)
 - #141682 (interpret/allocation: Fixup type for `alloc_bytes`)
 - #141683 (Handle ed2021 precise capturing of unsafe binder)
 - #141684 (rustbook: Bump versions of `onig` and `onig_sys`)
 - #141687 (core: unstably expose atomic_compare_exchange so stdarch can use it)
 - #141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods)
 - #141702 (Add eholk to compiler reviewer rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit d3c605a into rust-lang:master May 29, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Generic Const Items (GCI) May 29, 2025
@rustbot rustbot added this to the 1.89.0 milestone May 29, 2025
@fmease fmease deleted the gci-fix-def-site-checks branch May 29, 2025 08:53
rust-timer added a commit that referenced this pull request May 29, 2025
Rollup merge of #136429 - fmease:gci-fix-def-site-checks, r=BoxyUwU

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

* 1st commit: Partially addresses [#136204](#136204) by turning const eval errors from post to pre-mono for free lifetime-generic constants.
  * As the linked issue/comment states, on master there's a difference between `const _: () = panic!();` (pre-mono error) and `const _<'a>: () = panic!();` (post-mono error) which feels wrong.
  * With this PR, both become pre-mono ones!
* 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
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Jun 2, 2025
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#136429 (GCI: At their def site, actually wfcheck the where-clause & always eval free lifetime-generic constants)
 - rust-lang/rust#138139 (Emit warning while outputs is not exe and prints linkage info)
 - rust-lang/rust#141104 (Test(fs): Fix `test_eq_windows_file_type` for Windows 7)
 - rust-lang/rust#141477 (Path::with_extension: show that it adds an extension where one did no…)
 - rust-lang/rust#141533 (clean up old rintf leftovers)
 - rust-lang/rust#141612 (Call out possibility of invariant result in variance markers)
 - rust-lang/rust#141638 (Use `builtin_index` instead of hand-rolling it)
 - rust-lang/rust#141643 (ci: verify that codebuild jobs use ghcr.io)
 - rust-lang/rust#141675 (Reorder `ast::ItemKind::{Struct,Enum,Union}` fields.)
 - rust-lang/rust#141680 (replace TraitRef link memory.md)
 - rust-lang/rust#141682 (interpret/allocation: Fixup type for `alloc_bytes`)
 - rust-lang/rust#141683 (Handle ed2021 precise capturing of unsafe binder)
 - rust-lang/rust#141684 (rustbook: Bump versions of `onig` and `onig_sys`)
 - rust-lang/rust#141687 (core: unstably expose atomic_compare_exchange so stdarch can use it)
 - rust-lang/rust#141690 (Add `rustc_diagnostic_item` to `sys::Mutex` methods)
 - rust-lang/rust#141702 (Add eholk to compiler reviewer rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-generic_const_items `#![feature(generic_const_items)]` perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Development

Successfully merging this pull request may close these issues.

8 participants