Only check predicates for late-bound non-lifetime vars in object candidate assembly
This commit is contained in:
parent
fb61292105
commit
24e14dd8b4
@ -628,7 +628,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
self.infcx.probe(|_snapshot| {
|
||||
if obligation.has_non_region_late_bound() {
|
||||
// FIXME(non_lifetime_binders): Really, we care only to check that we don't
|
||||
// have any non-region *escaping* bound vars, but that's hard to check and
|
||||
// we shouldn't really ever encounter those anyways.
|
||||
if obligation.self_ty().has_non_region_late_bound() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
// check-pass
|
||||
|
||||
trait Foo {
|
||||
type Bar<T>
|
||||
where
|
||||
dyn Send + 'static: Send;
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
type Bar<T> = i32;
|
||||
// We take `<() as Foo>::Bar<T>: Sized` and normalize it under the where clause
|
||||
// of `for<S> <() as Foo>::Bar<S> = i32`. This gives us back `i32: Send` with
|
||||
// the nested obligation `(dyn Send + 'static): Send`. However, during candidate
|
||||
// assembly for object types, we disqualify any obligations that has non-region
|
||||
// late-bound vars in the param env(!), rather than just the predicate. This causes
|
||||
// the where clause to not hold even though it trivially should.
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user