Skip to content

Don't FCW assoc consts in patterns #140467

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 30, 2025
Merged

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Apr 29, 2025

Fixes #140447

See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though 🤔 The only consts that are evaluated "for the type system" are const args (which should get FCWs) and const patterns (which cant be anon consts afaik).

@rustbot
Copy link
Collaborator

rustbot commented Apr 29, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@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 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 29, 2025

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

@BoxyUwU
Copy link
Member Author

BoxyUwU commented Apr 29, 2025

r? oli-obk

@rustbot rustbot assigned oli-obk and unassigned jieyouxu Apr 29, 2025
);
if !self.features().generic_const_exprs()
&& ct.args.has_non_region_param()
&& self.def_kind(instance.def_id()) == DefKind::AnonConst
Copy link
Member

Choose a reason for hiding this comment

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

I think there should be a comment explaining why we check the def_kind here.

Copy link
Member Author

Choose a reason for hiding this comment

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

doh.... yeah, why would I put it only in the test 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

updated. let me know if the comment doesn't make sense to you and it needs elaborating somewhere :)

Copy link
Member

Choose a reason for hiding this comment

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

I barely know what this entire function does, let alone what the FCW is for, so I'm afraid I am mostly lost here, but this way at least there are some breadcrumbs to follow for someone who stumbles upon this curious extra check in the future. :)

@BoxyUwU BoxyUwU force-pushed the no_fcw_assoc_consts branch from 8e1d885 to 40fb600 Compare April 29, 2025 15:38
@rust-log-analyzer

This comment has been minimized.

@lcnr
Copy link
Contributor

lcnr commented Apr 29, 2025

r? lcnr

r=me after CI

@rustbot rustbot assigned lcnr and unassigned oli-obk Apr 29, 2025
@BoxyUwU BoxyUwU force-pushed the no_fcw_assoc_consts branch from 40fb600 to be90613 Compare April 29, 2025 17:50
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Apr 29, 2025

@bors r=lcnr rollup

@bors
Copy link
Collaborator

bors commented Apr 29, 2025

📌 Commit be90613 has been approved by lcnr

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 29, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 30, 2025
Don't FCW assoc consts in patterns

Fixes rust-lang#140447

See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though 🤔 The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
Rollup of 14 pull requests

Successful merges:

 - rust-lang#140380 (transmutability: uninit transition matches unit byte only)
 - rust-lang#140385 (Subtree update of `rust-analyzer`)
 - rust-lang#140395 (organize and extend forbidden target feature tests)
 - rust-lang#140430 (Improve test coverage of HIR pretty printing.)
 - rust-lang#140458 (Fix for async drop ice with partly dropped tuple)
 - rust-lang#140460 (Fix handling of LoongArch target features not supported by LLVM 19)
 - rust-lang#140465 (chore: edit and move tests)
 - rust-lang#140467 (Don't FCW assoc consts in patterns)
 - rust-lang#140468 (Minor tweaks to make some normalization (adjacent) code less confusing)
 - rust-lang#140470 (CI: rfl: move job forward to Linux v6.15-rc4)
 - rust-lang#140476 (chore: delete unused ui/auxiliary crates)
 - rust-lang#140481 (Require sanitizers be enabled for asan_odr_windows.rs)
 - rust-lang#140486 (rustfmt: Also allow bool literals as first item of let chain)
 - rust-lang#140494 (Parser: Document restrictions)

r? `@ghost`
`@rustbot` modify labels: rollup
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 30, 2025
Don't FCW assoc consts in patterns

Fixes rust-lang#140447

See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though 🤔 The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
Rollup of 13 pull requests

Successful merges:

 - rust-lang#140380 (transmutability: uninit transition matches unit byte only)
 - rust-lang#140385 (Subtree update of `rust-analyzer`)
 - rust-lang#140395 (organize and extend forbidden target feature tests)
 - rust-lang#140458 (Fix for async drop ice with partly dropped tuple)
 - rust-lang#140460 (Fix handling of LoongArch target features not supported by LLVM 19)
 - rust-lang#140465 (chore: edit and move tests)
 - rust-lang#140467 (Don't FCW assoc consts in patterns)
 - rust-lang#140468 (Minor tweaks to make some normalization (adjacent) code less confusing)
 - rust-lang#140470 (CI: rfl: move job forward to Linux v6.15-rc4)
 - rust-lang#140476 (chore: delete unused ui/auxiliary crates)
 - rust-lang#140481 (Require sanitizers be enabled for asan_odr_windows.rs)
 - rust-lang#140486 (rustfmt: Also allow bool literals as first item of let chain)
 - rust-lang#140494 (Parser: Document restrictions)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 30, 2025
Don't FCW assoc consts in patterns

Fixes rust-lang#140447

See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though 🤔 The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#140380 (transmutability: uninit transition matches unit byte only)
 - rust-lang#140385 (Subtree update of `rust-analyzer`)
 - rust-lang#140458 (Fix for async drop ice with partly dropped tuple)
 - rust-lang#140465 (chore: edit and move tests)
 - rust-lang#140467 (Don't FCW assoc consts in patterns)
 - rust-lang#140468 (Minor tweaks to make some normalization (adjacent) code less confusing)
 - rust-lang#140470 (CI: rfl: move job forward to Linux v6.15-rc4)
 - rust-lang#140476 (chore: delete unused ui/auxiliary crates)
 - rust-lang#140481 (Require sanitizers be enabled for asan_odr_windows.rs)
 - rust-lang#140486 (rustfmt: Also allow bool literals as first item of let chain)
 - rust-lang#140494 (Parser: Document restrictions)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#140385 (Subtree update of `rust-analyzer`)
 - rust-lang#140458 (Fix for async drop ice with partly dropped tuple)
 - rust-lang#140465 (chore: edit and move tests)
 - rust-lang#140467 (Don't FCW assoc consts in patterns)
 - rust-lang#140468 (Minor tweaks to make some normalization (adjacent) code less confusing)
 - rust-lang#140470 (CI: rfl: move job forward to Linux v6.15-rc4)
 - rust-lang#140476 (chore: delete unused ui/auxiliary crates)
 - rust-lang#140481 (Require sanitizers be enabled for asan_odr_windows.rs)
 - rust-lang#140486 (rustfmt: Also allow bool literals as first item of let chain)
 - rust-lang#140494 (Parser: Document restrictions)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 372b15e into rust-lang:master Apr 30, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 30, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 30, 2025
Rollup merge of rust-lang#140467 - BoxyUwU:no_fcw_assoc_consts, r=lcnr

Don't FCW assoc consts in patterns

Fixes rust-lang#140447

See comment in added test. We could also check that the anon const is a const arg by looking at the HIR. I'm not sure that's necessary though 🤔 The only consts that are evaluated "for the type system" are const args (which *should* get FCWs) and const patterns (which cant be anon consts afaik).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
None yet
Development

Successfully merging this pull request may close these issues.

const_evaluatable_unchecked FCW applies to all kinds of const evaluation not just of repeat expr const args
8 participants