Skip to content

Hand-written Debug implementation for TypeTest#153785

Open
amandasystems wants to merge 1 commit intorust-lang:mainfrom
amandasystems:debug-type-test
Open

Hand-written Debug implementation for TypeTest#153785
amandasystems wants to merge 1 commit intorust-lang:mainfrom
amandasystems:debug-type-test

Conversation

@amandasystems
Copy link
Copy Markdown
Contributor

This adds a hand-written debug format for TypeTests that at least was helpful for me when debugging because I always struggle to remember which component is which. It formats a type test using the Unicode turnstile symbol (for "computes") to illustrate that the test encodes a typing rule that, if it holds, produces a conclusion.

The format is: TypeTest from {originating span} {bound} ⊢ T: 'lower_bound, where T is the generic type being tested and lower_bound is the lower bound. Bounds are formatted as you would expect, but where the region for 'lower_bound is included in the outlives constraints for context. I resisted the urge to turn ALL [A, ..., Z] into [A ∧ ... ∧ Z] etc.

This adds a hand-written debug format for `TypeTest`s that
at least was helpful for me when debugging. It formats an type test
using the Unicode turnstile symbol (for "computes") to illustrate that
the test encodes a typing rule that, if it holds, produces a conclusion.
@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 Mar 12, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 12, 2026

r? @madsmtm

rustbot has assigned @madsmtm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: borrowck, compiler
  • borrowck, compiler expanded to 69 candidates
  • Random selection from 16 candidates

/// `InferCtxt::process_registered_region_obligations` and
/// `InferCtxt::type_must_outlive` in `rustc_infer::infer::InferCtxt`.
#[derive(Clone, Debug)]
#[derive(Clone)]
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.

For easier comparison, would you mind providing side-by-side comparisons of old vs new output for some illustrative examples, please?

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants