Skip to content

rename select_where_possible and select_all_or_error - #147111

Merged
bors merged 1 commit into
rust-lang:masterfrom
BoxyUwU:rename_obligation_processing_apis
Oct 8, 2025
Merged

rename select_where_possible and select_all_or_error#147111
bors merged 1 commit into
rust-lang:masterfrom
BoxyUwU:rename_obligation_processing_apis

Conversation

@BoxyUwU

@BoxyUwUBoxyUwU commented Sep 27, 2025

Copy link
Copy Markdown
Member

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_obligations and evaluate_obligations_error_on_ambiguity. This maintains consistency with the new solvers evalute_goal entry point. it's unfortunate that we say obligations rather than goals but this maintains consistency with register_obligation functions which I think is a good thing. In the long term possibly we rename Obligation or Goal 🤷‍♀️

@rustbot

Copy link
Copy Markdown
Collaborator

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

@rustbotrustbot 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
Copy Markdown
Contributor

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
Copy Markdown
MemberAuthor

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
Copy Markdown
Collaborator

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

@rustbotrustbot 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
Copy Markdown
MemberAuthor

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

@oli-obk

Copy link
Copy Markdown
Contributor

Could also use prove instead of evaluate.

lgtm

@lnicola

Copy link
Copy Markdown
Member

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.

@lcnr

lcnr commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

i'd go with [try_]evaluate_obligations[or_error]. Talking with @BoxyUwU

  • we're using compute and evaluate in the solver to distinguish between "evaluate" as the entry point when evaluating (nested) goals and "compute" for implementation details of "evaluate". Not the best naming, but it's kinda nice to have "u shouldn't use compute_X except for the current goal itself, and only use "evaluate_X" for nested goals.
  • I prefer "evaluate" over "prove" as the trait solver also does a bunch of jank which feels surprising when proving something: inference and region constraints etc etc. I don't think we're consistent in any way when talking about this :3

@lcnrlcnr 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 Sep 29, 2025
@BoxyUwU
BoxyUwUforce-pushed the rename_obligation_processing_apis branch from 467a300 to 99b93bbCompareSeptember 29, 2025 14:59
@BoxyUwUBoxyUwU 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 29, 2025
@lcnr

lcnr commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

after looking at it and chatting with Boxy, evaluate_obligations_or_error isn't as explicit about "this errors on ambiguity" as I would like, anbd we've previously had at least 1 unsoundness because we've used the wrong function here.

Please change to

  • try_evaluate_obligations
  • evaluate_obligations_error_on_ambiguity

@rustbot author

@rustbotrustbot 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 Sep 30, 2025
@BoxyUwU
BoxyUwUforce-pushed the rename_obligation_processing_apis branch from 99b93bb to 77e7396CompareSeptember 30, 2025 14:21
@rust-log-analyzer

This comment has been minimized.

@BoxyUwU
BoxyUwUforce-pushed the rename_obligation_processing_apis branch from 77e7396 to 42eba3eCompareSeptember 30, 2025 16:30
let errors = ocx.select_where_possible();
let errors = ocx.try_evaluate_obligations();
if !errors.is_empty() {
return None;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is the only try_evaluate_obligations in this function and it feels odd :> ah well

Comment threadcompiler/rustc_trait_selection/src/solve/normalize.rs Outdated
Comment threadcompiler/rustc_trait_selection/src/solve/fulfill.rs Outdated
Comment threadcompiler/rustc_trait_selection/src/traits/engine.rs
Comment threadcompiler/rustc_trait_selection/src/traits/fulfill.rs

@lcnrlcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

some nits, then r=me

View changes since this review

@bors

bors commented Oct 2, 2025

Copy link
Copy Markdown
Collaborator

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

@BoxyUwU
BoxyUwUforce-pushed the rename_obligation_processing_apis branch from 42eba3e to d8634f7CompareOctober 7, 2025 21:59
@BoxyUwU
BoxyUwUforce-pushed the rename_obligation_processing_apis branch from d8634f7 to 8e9b0c4CompareOctober 7, 2025 22:02
@rustbot

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@BoxyUwU

Copy link
Copy Markdown
MemberAuthor

@bors r=lcnr rollup=never

left the r-a changes in due to @lnicola's comment

@bors

bors commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

📌 Commit 8e9b0c4 has been approved by lcnr

It is now in the queue for this repository.

@borsbors 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 Oct 7, 2025
@bors

bors commented Oct 7, 2025

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 8e9b0c4 with merge 4fd3181...

@bors

bors commented Oct 8, 2025

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 4fd3181 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Oct 8, 2025
@bors
bors merged commit 4fd3181 into rust-lang:masterOct 8, 2025
11 checks passed
@rustbotrustbot added this to the 1.92.0 milestone Oct 8, 2025
@github-actions

Copy link
Copy Markdown
Contributor
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 f6aa851 (parent) -> 4fd3181 (this PR)

Test differences

Show 2 test diffs

2 doctest diffs were found. These are ignored, as they are noisy.

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 4fd31815524baba0bf368f151f757101f432e3de --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-gnu-miri: 5410.9s -> 4354.7s (-19.5%)
  2. pr-check-1: 1654.3s -> 1428.5s (-13.7%)
  3. dist-x86_64-apple: 8059.4s -> 7050.9s (-12.5%)
  4. dist-apple-various: 4131.5s -> 3645.5s (-11.8%)
  5. i686-gnu-2: 6195.8s -> 5555.2s (-10.3%)
  6. pr-check-2: 2537.5s -> 2298.9s (-9.4%)
  7. dist-x86_64-windows-gnullvm: 5219.2s -> 4791.4s (-8.2%)
  8. dist-aarch64-msvc: 6146.8s -> 6622.2s (7.7%)
  9. x86_64-gnu-llvm-20-1: 3262.8s -> 3514.3s (7.7%)
  10. dist-i686-msvc: 8285.7s -> 7656.2s (-7.6%)
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
Copy Markdown
Collaborator

Finished benchmarking commit (4fd3181): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.1%[0.1%, 0.1%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results (primary 0.9%, secondary 5.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

meanrangecount
Regressions ❌
(primary)
0.9%[0.9%, 0.9%]1
Regressions ❌
(secondary)
5.0%[5.0%, 5.0%]1
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.9%[0.9%, 0.9%]1

Cycles

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

Binary size

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

Bootstrap: 472.758s -> 473.366s (0.13%)
Artifact size: 388.40 MiB -> 388.38 MiB (-0.01%)

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

Labels

A-attributesArea: Attributes (`#[…]`, `#![…]`)merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-clippyRelevant to the Clippy team.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rust-analyzerRelevant to the rust-analyzer team, which will review and decide on the PR/issue.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@BoxyUwU@rustbot@compiler-errors@rust-log-analyzer@oli-obk@lnicola@lcnr@bors@rust-timer