Skip to content

Conversation

BoxyUwU
Copy link
Member

@BoxyUwU BoxyUwU commented Sep 27, 2025

r? @lcnr

I find that people get confused by what these methods do. The verb "select" is not really that helpful and is just a reference to somewhat of an implementation detail of the trait solvers that doesn't even apply to most obligation kinds.

I went with try_evaluate_registered_obligations and evaluate_registered_obligations_or_error. I'm not necessarily the biggest fan as its quite long name wise. The new solver's "added goals" instead of "registered obligations" is much nicer :> but I think it is worth maintaining consistency with methods such as register_obligation and the fact that we use Obligation all over the API of these types. Anything else would be confusing imo.

I'm not sure "evaluate" is the right verb, it's atleast what we use inside of the new solver so feels more accurate than "select" especially as we move towards getting rid of the old solver. I think it might be nice to rename all the new solver compute_x_goal methods to evaluate_x_goal but 🤷‍♀️

Also unsure if we intend to change the "public" APIs of trait solving once old solver is gone and that'll affect naming here in a way that might make it desirable to hold off for now 🤔

@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in engine.rs, potentially modifying the public API of ObligationCtxt.

cc @lcnr, @compiler-errors

Some changes occurred to constck

cc @fee1-dead

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 27, 2025
@compiler-errors
Copy link
Member

I feel like the "registered" part of these methods names is redundant, and removing it would make the method names appreciably shorter. Not sure if there's any value in being explicit about only evaluating "registered" obligations.

@rust-log-analyzer

This comment has been minimized.

@BoxyUwU
Copy link
Member Author

BoxyUwU commented Sep 28, 2025

I've been clippy'd 😔

@compiler-errors I was worried it might imply the methods accept a list of obligations to evaluate, but I think you're right that we could just drop the registered part 🤔 that possibility for confusion is kinda moot given it can immediately be clarified by seeing that there is no list of obligations as an argument and doc comments can explicitly clarify its evaluating stuff that was previously registered 👍

try_evaluate_obligations and evaluate_obligations_or_error is definitely shorter :3

@rustbot
Copy link
Collaborator

rustbot commented Sep 28, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

@rustbot rustbot added T-clippy Relevant to the Clippy team. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. labels Sep 28, 2025
@BoxyUwU
Copy link
Member Author

BoxyUwU commented Sep 28, 2025

ah I should revert the r-a changes, I didn't realise r-a had its own fullfillment ctxt impl

@oli-obk
Copy link
Contributor

oli-obk commented Sep 28, 2025

Could also use prove instead of evaluate.

lgtm

@lnicola
Copy link
Member

lnicola commented Sep 28, 2025

I should revert the r-a changes

We'll probably want to rename it there, so the code stays closer to what's in rustc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rust-analyzer Relevant to the rust-analyzer 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.

7 participants