Skip to content

check types of const param defaults #139646

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 1 commit into from
Apr 27, 2025

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Apr 10, 2025

fixes #139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? @BoxyUwU

@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 Apr 10, 2025
@lcnr lcnr changed the title check types of const param default check types of const param defaults Apr 10, 2025
@lcnr lcnr added T-types Relevant to the types team, which will review and decide on the PR/issue. and removed T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 10, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Apr 10, 2025

This PR causes struct Foo<const N: u32, const M: u64 = N>; to error on the definition site instead of when first using it with defaulted params.

This feel like a clear bugfix to me and I don't expect any fallout, so I didn't run crater here. Any breakage will be caught by the beta crater run and this is trivial to revert if necessary.

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Apr 10, 2025

Team member @lcnr has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. labels Apr 10, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 11, 2025

This makes sense to me, unlike "normal" cases where some possible instantiation of the generic parameter could result in things being wf, it is not possible for any well formed argument to N to make a valid default for M.

I feel somewhat 🤔 about not cratering this, as a general policy i don't think its great to say "we can just look at the results of the beta crater run" as it's putting more work on the release team. I imagine a crater run would finish before the FCP 10 day period ends so I don't think there's any harm in just starting a try run and doing a crater run afterwards?

I'm fine to not crater this though if noone else on the team thinks its worthwhile

@lcnr
Copy link
Contributor Author

lcnr commented Apr 11, 2025

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
check types of const param defaults

fixes rust-lang#139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? `@BoxyUwU`
@bors
Copy link
Collaborator

bors commented Apr 11, 2025

⌛ Trying commit 3e80f96 with merge 81185c2...

@bors
Copy link
Collaborator

bors commented Apr 11, 2025

☀️ Try build successful - checks-actions
Build commit: 81185c2 (81185c2d21df0ba45fd33e65bbdce76dc0d89bd9)

@lcnr
Copy link
Contributor Author

lcnr commented Apr 11, 2025

waiting with crater run for top-1000 in #133502

@lcnr
Copy link
Contributor Author

lcnr commented Apr 11, 2025

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-139646 created and queued.
🤖 Automatically detected try build 81185c2
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2025
@craterbot
Copy link
Collaborator

🚧 Experiment pr-139646 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-139646 is completed!
📊 10 regressed and 2 fixed (613276 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 12, 2025
@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Apr 13, 2025
@rfcbot
Copy link
Collaborator

rfcbot commented Apr 13, 2025

🔔 This is now entering its final comment period, as per the review above. 🔔

Copy link
Member

@BoxyUwU BoxyUwU left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add stable affecting test?

@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 14, 2025

All the crater errors are spurrious. There's one spurrious fail -> ICE regression but I can't tell if that was ICEing before. Regardless it depends on a whole host of unstable features (including gce) so I think its safe to say there's no breakage from this 👍

@BoxyUwU BoxyUwU removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 14, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 15, 2025

or a revision without the feature gates enabled 🤔 yeah, just something that makes it more clear this affects stuff without feature gates. though if you think it doesn't really matter and the current test is fine then that's also fine with me

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Apr 23, 2025
@rfcbot
Copy link
Collaborator

rfcbot commented Apr 23, 2025

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@rust-cloud-vms rust-cloud-vms bot force-pushed the default-is-fully-concrete branch from 3e80f96 to 8cd12bf Compare April 24, 2025 13:29
@lcnr
Copy link
Contributor Author

lcnr commented Apr 24, 2025

@rustbot ready

@rustbot rustbot 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. labels Apr 24, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Apr 26, 2025

@bors r+

thanks gamer

@bors
Copy link
Collaborator

bors commented Apr 26, 2025

📌 Commit 8cd12bf 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 Apr 26, 2025
tgross35 added a commit to tgross35/rust that referenced this pull request Apr 27, 2025
…BoxyUwU

check types of const param defaults

fixes rust-lang#139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? `@BoxyUwU`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2025
…xyUwU

check types of const param defaults

fixes rust-lang#139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? `@BoxyUwU`
@bors
Copy link
Collaborator

bors commented Apr 27, 2025

⌛ Testing commit 8cd12bf with merge 4852ce3...

tgross35 added a commit to tgross35/rust that referenced this pull request Apr 27, 2025
…BoxyUwU

check types of const param defaults

fixes rust-lang#139643 by checking that the type of a const parameter default matches the type of the parameter as long as both types are fully concrete

r? `@BoxyUwU`
@tgross35
Copy link
Contributor

@bors retry

put this in a rollup five minutes too late

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 27, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang#137439 (Stabilise `std::ffi::c_str`)
 - rust-lang#138737 (uefi: Update r-efi)
 - rust-lang#139646 (check types of const param defaults)
 - rust-lang#140220 (Fix detection of main function if there are expressions around it)
 - rust-lang#140291 (Correctly display stdout and stderr in case a doctest is failing)
 - rust-lang#140297 (Update example to use CStr::to_string_lossy)
 - rust-lang#140330 (Clarified bootstrap optimization "true" argument)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Apr 27, 2025

⌛ Testing commit 8cd12bf with merge 496145b...

@bors
Copy link
Collaborator

bors commented Apr 27, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing 496145b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 27, 2025
@bors bors merged commit 496145b into rust-lang:master Apr 27, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 27, 2025
Copy link

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 43e62a7 (parent) -> 496145b (this PR)

Test differences

Show 2 test diffs

Stage 1

  • [ui] tests/ui/const-generics/defaults/concrete-const-param-type.rs: [missing] -> pass (J0)

Stage 2

  • [ui] tests/ui/const-generics/defaults/concrete-const-param-type.rs: [missing] -> pass (J1)

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 496145b9cc023aef4bb1f16c0964a53d0da36c88 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-apple-1: 6861.6s -> 8455.0s (23.2%)
  2. x86_64-gnu-llvm-20-1: 5155.0s -> 6152.3s (19.3%)
  3. x86_64-apple-2: 4297.1s -> 5108.6s (18.9%)
  4. dist-x86_64-apple: 9320.8s -> 7777.3s (-16.6%)
  5. dist-aarch64-apple: 4983.3s -> 5640.5s (13.2%)
  6. dist-i586-gnu-i586-i686-musl: 4936.9s -> 5230.4s (5.9%)
  7. x86_64-mingw-1: 8691.2s -> 9114.3s (4.9%)
  8. dist-aarch64-linux: 8154.4s -> 7758.9s (-4.9%)
  9. aarch64-apple: 3747.4s -> 3916.6s (4.5%)
  10. x86_64-gnu-llvm-20-3: 7005.7s -> 6690.1s (-4.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (496145b): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -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
Regressions ❌
(secondary)
0.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -0.7%)

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.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.9% [-1.9%, -1.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.7% [-1.9%, 0.5%] 2

Cycles

Results (primary -0.9%)

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)
-0.9% [-2.2%, -0.4%] 4
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.9% [-2.2%, -0.4%] 4

Binary size

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

Bootstrap: 764.554s -> 764.349s (-0.03%)
Artifact size: 365.12 MiB -> 365.22 MiB (0.03%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-types Relevant to the types team, which will review and decide on the PR/issue. to-announce Announce this issue on triage meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Defaulted const generic parameters no longer have the const arg's type checked
8 participants