Skip to content

Rename wc to goal - #453

Open
System625 wants to merge 2 commits into
rust-lang:mainfrom
System625:rename-wc-to-goal
Open

Rename wc to goal#453
System625 wants to merge 2 commits into
rust-lang:mainfrom
System625:rename-wc-to-goal

Conversation

@System625

Copy link
Copy Markdown
Contributor

What does this PR do?

Part of #417, after #445 and #450. Step 4 of the issue says to collapse Wc into Predicate, the distinction between atomic predicates and combinators is kept as discussed, so this renames that second level instead of merging it.

After this PR:

  • Predicate = atomic (the six original variants plus the four relations merged in Merge Relation into Predicate #450)
  • Goal = Predicate | for<..> | if ..
  • WhereClause = unchanged, still the syntactic level, still lowering into Goals via ToGoals

I picked Goal / Goals because it is already what the code calls these things (prove(.., assumptions, goal), the "Goal(s) to prove ..." doc comments on Wcs::all_eq and friends, TypeckEnv::prove_goal), and it lines up with chalk, where Goal is the quantifier/implication layer sitting over atomic DomainGoals.

How does it work, what questions do you have?

I renamed prove_wc.rs to prove_goal.rs and the associated judgment. Snapshot churn is 16 lines: the rule "trait implied bound" at (prove_wc.rs) becomes (prove_goal.rs). I edited these by hand rather than running UPDATE_EXPECT=1. expect-test rewrites an entire block when any line in it changes, and three blocks in tests/borrowck.rs are indented deeper than its canonical output, so running it turns 16 changes into a 646-line diff. Then the indentation is trimmed before comparison, so tests will still pass. Only other movement is cargo fmt re-sorting the mod prove_*; list in prove.rs.

AI disclosure

  • I used an AI to author the main logic of the code

`Wc` is the "predicate or combinator" level of the proof language: an
atomic `Predicate`, a `for<..>`, or an `if ..`. Everything that consumes
it already calls that a goal -- `prove(.., assumptions, goal)`, the
"Goal(s) to prove ..." doc comments on `Wcs::all_eq` and friends,
`TypeckEnv::prove_goal` -- so name the type after what it is rather than
after the `WhereClause` syntax it happens to be lowered from.

    Wc    -> Goal   (grammar/wc.rs -> grammar/goal.rs)
    Wcs   -> Goals
    ToWcs -> ToGoals, to_wcs -> to_goals, to_wc -> to_goal

`WhereClause` is untouched: it remains the syntactic level and lowers
into `Goal`s via `ToGoals`. Pure rename, no behavioural change, and no
snapshot moves.
Follows the type rename: `prove_wc` proves one `Goal`, and `prove_wc_list`
proves a list of them.

    prove_wc      -> prove_goal       (prove/prove_wc.rs -> prove/prove_goal.rs)
    prove_wc_list -> prove_goal_list  (likewise)

A judgment's source file appears in failure output, so the 16 snapshot
lines reading `the rule "trait implied bound" at (prove_wc.rs)` now read
`(prove_goal.rs)`. Nothing else in the snapshots moves: no judgment
changed line number.
@rustbot

rustbot commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Thanks for contributing to formality! :)
A reviewer will take a look at your PR within a week or two. If not, come talk to us on https://rust-lang.zulipchat.com/#narrow/channel/402470-t-types.2Fformality

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants