Skip to content

abby: ensure forall where clause lhs is alias, placeholder, or lifetime - #163257

Open
khyperia wants to merge 1 commit into
rust-lang:mainfrom
khyperia:abby-check-where-clause
Open

khyperia wants to merge 1 commit into
rust-lang:mainfrom
khyperia:abby-check-where-clause

Conversation

@khyperia

@khyperia khyperia commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

fixes rust-lang/project-assumptions-on-binders#43

took the opportunity to clean up a bit too, so the diff is a bit bigger than it strictly needs to be

also, after review, this PR now enforces that all implied bounds in where clauses are also explicitly present as well, enforcing that there's no sneaky bounds going on

r? @BoxyUwU

@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 Sep 24, 2026
// For example, right now, if the user writes `forall<'a> where Foo<'a>: 'b`, that's not gonna
// work - that should be destructured into `where 'a: 'b`, whether by hand (and checked it was
// indeed done so, via compiler) or automatically by the test framework, unsure, but something.
fn lower_test_binder_assumptions(

@khyperia khyperia Sep 24, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fyi to reviewers: there are no changes to this function, I just deduped the Trait/Use bound handling into a helper fn, and changed the wording to remove the word "yet".

View changes since the review

@bit-aloo bit-aloo left a comment •

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.

Been wanting to dive deeper into Abby. I missed your DSL PR too, I wanted to review it, but I am super slow 😭

Finally catching up on all the stuff I have been meaning to understand 😃

A few things I noticed while reading through the changes:

View changes since this review

) {
fn outlives_bounds<'tcx>(
dcx: DiagCtxtHandle<'tcx>,
bounds: &'tcx hir::GenericBounds<'tcx>,

@bit-aloo bit-aloo Sep 25, 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.

nit:

Suggested change
bounds: &'tcx hir::GenericBounds<'tcx>,
bounds: hir::GenericBounds<'tcx>,

GenericBounds is already a type alias for &'hir [GenericBound<'hir>]. All the &p.bound could become p.bound?

Comment on lines +2434 to +2441
_ => {
let mut err = self.tcx().dcx().struct_span_err(
forall.span,
"the lhs of a forall where clause must be \
an alias, placeholder, or lifetime",
);
err.note(format!("{lhs}: {rhs}"));
err.emit();

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.

Should we filter these non alias/param/placeholder cases from type_outlives?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

eh shrug, doesn't matter! errors here, errors there, errors everywhere. Currently the behavior is that they are merely ignored, so, fine to keep them. I suppose the results of the following analysis are invalid if the test setup is invalid, so another way to deal with this is to early return after emitting an error, but, shrug.

@khyperia khyperia 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, 2026
@khyperia
khyperia force-pushed the abby-check-where-clause branch from fb25c94 to 331ac7a Compare October 1, 2026 08:38
@rustbot

rustbot commented Oct 1, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main 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.

@khyperia
khyperia force-pushed the abby-check-where-clause branch 2 times, most recently from 28a04e9 to 30c3ff8 Compare October 1, 2026 11:12

This branch has not been deployed

No deployments
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test DSL should check things about written where clauses

4 participants