forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#115039 - jackh726:impl_compare_add_alias_obli…
…gations, r=aliemjay Add projection obligations when comparing impl too Fixes rust-lang#115033 In the test, when we ask for WF obligations of `DatasetIter<'a, ArrayBase<D>>`, we get back two important obligations: `[<D as Data>::Elem -> ?1, ?1: 'a]`. If we don't add the projection obligation, `?1` remains unconstrained. An alternative solution would be to use unnormalized obligations, where we only have one relevant obligation: `<D as Data>::Elem: 'a`. This would leave no inference vars unconstrained.
- Loading branch information
Showing
2 changed files
with
40 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
32 changes: 32 additions & 0 deletions
32
tests/ui/implied-bounds/implied_bounds_entailment_alias_var.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,32 @@ | ||
// check-pass | ||
|
||
trait Data { | ||
type Elem; | ||
} | ||
|
||
impl<F, S: Data<Elem = F>> Data for ArrayBase<S> { | ||
type Elem = F; | ||
} | ||
|
||
struct DatasetIter<'a, R: Data> { | ||
data: &'a R::Elem, | ||
} | ||
|
||
pub struct ArrayBase<S> { | ||
data: S, | ||
} | ||
|
||
trait Trait { | ||
type Item; | ||
fn next() -> Option<Self::Item>; | ||
} | ||
|
||
impl<'a, D: Data> Trait for DatasetIter<'a, ArrayBase<D>> { | ||
type Item = (); | ||
|
||
fn next() -> Option<Self::Item> { | ||
None | ||
} | ||
} | ||
|
||
fn main() {} |