-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only check predicates for late-bound non-lifetime vars in object cand…
…idate assembly
- Loading branch information
1 parent
fb61292
commit 24e14dd
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/ui/traits/non_lifetime_binders/disqualifying-object-candidates.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} |