Skip to content
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

Use ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_args #131081

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

camelid
Copy link
Member

@camelid camelid commented Oct 1, 2024

r? @BoxyUwU

edit by @BoxyUwU:

This PR introduces a min_generic_const_args feature gate and implements some preliminary work for it, representing all const arguments that are single segment paths as ConstArg::Path instead of only those that resolve to a const generic parameter. There are a few bits of follow up work after this lands:

  • Figure out how to represent Foo<{ STATIC }>
  • Figure out how to evaluate Foo<{ EnumVariantConstructor }>
  • Make param env normalization handle non-anon-consts
  • Move try_from_lit and from_anon_const to hir ty lowering too

@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 Oct 1, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Oct 13, 2024

☔ The latest upstream changes (presumably #131628) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Oct 21, 2024

☔ The latest upstream changes (presumably #130950) made this pull request unmergeable. Please resolve the merge conflicts.

@camelid camelid force-pushed the const-path-it-all branch 2 times, most recently from 4494a71 to 034661e Compare October 21, 2024 16:29
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

compiler/rustc_ast_lowering/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_ast_lowering/src/lib.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@camelid camelid changed the title Begin to use ConstArgKind::Path for all paths, not just params Use ConstArgKind::Path for all single-segment paths, not just params Oct 28, 2024
@camelid camelid marked this pull request as ready for review October 28, 2024 18:50
@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2024

HIR ty lowering was modified

cc @fmease

@rust-log-analyzer

This comment has been minimized.

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.

✨ thanks for working on this, excited to be able to add the min_generic_const_args feature gate soon after all of these refactorings 😅

compiler/rustc_ast_lowering/src/lib.rs Show resolved Hide resolved
compiler/rustc_ast_lowering/src/lib.rs Show resolved Hide resolved
compiler/rustc_ast_lowering/src/lib.rs Show resolved Hide resolved
compiler/rustc_const_eval/src/const_eval/eval_queries.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/collect.rs Show resolved Hide resolved
compiler/rustc_hir_analysis/src/lib.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/consts.rs Show resolved Hide resolved
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Oct 31, 2024

☔ The latest upstream changes (presumably #132371) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@@ -2025,23 +2040,138 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
///
/// Early-bound const parameters get lowered to [`ty::ConstKind::Param`]
/// and late-bound ones to [`ty::ConstKind::Bound`].
pub(crate) fn lower_const_param(&self, hir_id: HirId) -> Const<'tcx> {
Copy link
Member

Choose a reason for hiding this comment

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

how come this was changed. I think it would be nicer to keep it the same as it was since lower_ty_param also doesn't take a DefId

@BoxyUwU
Copy link
Member

BoxyUwU commented Nov 14, 2024

also you'll need to squash all these commits before merging

@BoxyUwU BoxyUwU 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 Nov 15, 2024
Co-authored-by: Boxy UwU <rust@boxyuwu.dev>
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
@BoxyUwU BoxyUwU changed the title Use ConstArgKind::Path for all single-segment paths, not just params Use ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_params Nov 19, 2024
@BoxyUwU BoxyUwU changed the title Use ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_params Use ConstArgKind::Path for all single-segment paths, not just params under min_generic_const_args Nov 19, 2024
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU
Copy link
Member

BoxyUwU commented Nov 19, 2024

rebased and squashed commits for you as well as blessing the stable mir test now that those changes have been reverted. we can follow up on everything else later. Having the feature gate will be super nice thanks :3

@bors r+

@bors
Copy link
Contributor

bors commented Nov 19, 2024

📌 Commit 473b5d5 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 Nov 19, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#131081 (Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`)
 - rust-lang#132577 (Report the `unexpected_cfgs` lint in external macros)
 - rust-lang#133023 (Merge `-Zhir-stats` into `-Zinput-stats`)
 - rust-lang#133200 (ignore an occasionally-failing test in Miri)

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

Rollup of 4 pull requests

Successful merges:

 - rust-lang#131081 (Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`)
 - rust-lang#132577 (Report the `unexpected_cfgs` lint in external macros)
 - rust-lang#133023 (Merge `-Zhir-stats` into `-Zinput-stats`)
 - rust-lang#133200 (ignore an occasionally-failing test in Miri)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5f586ef into rust-lang:master Nov 19, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Nov 19, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 19, 2024
Rollup merge of rust-lang#131081 - camelid:const-path-it-all, r=BoxyUwU

Use `ConstArgKind::Path` for all single-segment paths, not just params under `min_generic_const_args`

r? `@BoxyUwU`

edit by `@BoxyUwU:`

This PR introduces a `min_generic_const_args` feature gate and implements some preliminary work for it, representing all const arguments that are single segment paths as `ConstArg::Path` instead of only those that resolve to a const generic parameter. There are a few bits of follow up work after this lands:
- Figure out how to represent `Foo<{ STATIC }>`
- Figure out how to evaluate `Foo<{ EnumVariantConstructor }>`
- Make param env normalization handle non-anon-consts
- Move `try_from_lit` and `from_anon_const` to hir ty lowering too
@camelid camelid deleted the const-path-it-all branch November 20, 2024 06:29
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.

6 participants