Conversation
| // 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( |
There was a problem hiding this comment.
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".
| ) { | ||
| fn outlives_bounds<'tcx>( | ||
| dcx: DiagCtxtHandle<'tcx>, | ||
| bounds: &'tcx hir::GenericBounds<'tcx>, |
There was a problem hiding this comment.
nit:
| 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?
| _ => { | ||
| 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(); |
There was a problem hiding this comment.
Should we filter these non alias/param/placeholder cases from type_outlives?
There was a problem hiding this comment.
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.
fb25c94 to
331ac7a
Compare
|
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. |
28a04e9 to
30c3ff8
Compare
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