Skip to content

give next-solver's evaluate_const its own try_evaluate_const logic - #161418

Open
zedddie wants to merge 4 commits into
rust-lang:mainfrom
zedddie:evaluate_const-stuff
Open

give next-solver's evaluate_const its own try_evaluate_const logic#161418
zedddie wants to merge 4 commits into
rust-lang:mainfrom
zedddie:evaluate_const-stuff

Conversation

@zedddie

@zedddie zedddie commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Currently evaluating type-level constants is convoluted as code is split in a lot of scattered functions across compiler which makes it hard to reason about. This PR refactors next-solver's CTFE entry point and should not change any behavior.

for context see #project-const-generics > evaluate_const is scary

r? BoxyUwU

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Aug 20, 2026
@rustbot

rustbot commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

BoxyUwU is currently at their maximum review capacity.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@zedddie
zedddie force-pushed the evaluate_const-stuff branch from 00a3838 to 92b2dea Compare August 24, 2026 17:15
@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@zedddie
zedddie force-pushed the evaluate_const-stuff branch from 92b2dea to 5a6ab62 Compare August 27, 2026 09:49
@rust-log-analyzer

This comment has been minimized.

@zedddie
zedddie force-pushed the evaluate_const-stuff branch from 5a6ab62 to c40c0cd Compare August 28, 2026 20:32
@rust-log-analyzer

This comment has been minimized.

@zedddie
zedddie force-pushed the evaluate_const-stuff branch from c40c0cd to 67b25fa Compare August 29, 2026 13:52
@zedddie
zedddie force-pushed the evaluate_const-stuff branch from 67b25fa to c814483 Compare September 8, 2026 03:49
@zedddie zedddie changed the title wip try to make evaluate_const less scary give next-solver's evaluate_const its own try_evaluate_const logic Sep 8, 2026
@zedddie
zedddie marked this pull request as ready for review September 8, 2026 04:15
@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 Sep 8, 2026

@BoxyUwU BoxyUwU Sep 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would you mind merging evaluate_const and evaluate_const_and_instantiate_projection_term into a single function.

The logic in compute_const_evaluatable_goal will have to change to prove a nested Projection goal instead of manually calling evaluate_const, that seems like a nice cleanup regardless :3

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

dont mind if u want to do this in a future PR, but also do think it would be nice to do in this PR as its kind of one big "smush all the logic into one place" change

typing_env: Self::TypingEnv,
ct: ty::AliasConst<'tcx>,
span: Self::Span,
) -> Result<Result<Self::ValTree, Self::Ty>, Option<Self::ErrorGuaranteed>> {

@BoxyUwU BoxyUwU Sep 8, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@khyperia's right that this is a scary return type :3 I think we would ideally make this a bespoke enum and maybe even change the original const_eval_resolve_for_typeck query to return it 🤔

I think that can be a future PR tho

View changes since the review

@BoxyUwU

BoxyUwU commented Sep 8, 2026

Copy link
Copy Markdown
Member

@rustbot author

very coolio :3

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 8, 2026
@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 8, 2026
@rustbot

rustbot commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants