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.
Rollup merge of rust-lang#101022 - compiler-errors:issue-101020, r=ja…
…ckh726 Erase late bound regions before comparing types in `suggest_dereferences` Fixes rust-lang#101020
- Loading branch information
Showing
4 changed files
with
74 additions
and
5 deletions.
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
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
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,37 @@ | ||
#![feature(generic_associated_types)] | ||
|
||
pub trait LendingIterator { | ||
type Item<'a> | ||
where | ||
Self: 'a; | ||
|
||
fn consume<F>(self, _f: F) | ||
where | ||
Self: Sized, | ||
for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ||
{ | ||
} | ||
} | ||
|
||
impl<I: LendingIterator + ?Sized> LendingIterator for &mut I { | ||
type Item<'a> = I::Item<'a> where Self: 'a; | ||
} | ||
struct EmptyIter; | ||
impl LendingIterator for EmptyIter { | ||
type Item<'a> = &'a mut () where Self:'a; | ||
} | ||
pub trait FuncInput<'a, F> | ||
where | ||
F: Foo<Self>, | ||
Self: Sized, | ||
{ | ||
} | ||
impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {} | ||
trait Foo<T> {} | ||
|
||
fn map_test() { | ||
(&mut EmptyIter).consume(()); | ||
//~^ ERROR the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied | ||
} | ||
|
||
fn main() {} |
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,25 @@ | ||
error[E0277]: the trait bound `for<'a> &'a mut (): Foo<&'a mut ()>` is not satisfied | ||
--> $DIR/issue-101020.rs:33:5 | ||
| | ||
LL | (&mut EmptyIter).consume(()); | ||
| ^^^^^^^^^^^^^^^^ ------- required by a bound introduced by this call | ||
| | | ||
| the trait `for<'a> Foo<&'a mut ()>` is not implemented for `&'a mut ()` | ||
| | ||
note: required for `&'a mut ()` to implement `for<'a> FuncInput<'a, &'a mut ()>` | ||
--> $DIR/issue-101020.rs:29:20 | ||
| | ||
LL | impl<'a, T, F: 'a> FuncInput<'a, F> for T where F: Foo<T> {} | ||
| ^^^^^^^^^^^^^^^^ ^ | ||
note: required by a bound in `LendingIterator::consume` | ||
--> $DIR/issue-101020.rs:11:33 | ||
| | ||
LL | fn consume<F>(self, _f: F) | ||
| ------- required by a bound in this | ||
... | ||
LL | for<'a> Self::Item<'a>: FuncInput<'a, Self::Item<'a>>, | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `LendingIterator::consume` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0277`. |