Rollup merge of #62842 - JohnTitor:test-for-58887, r=alexreg

Add tests for issue-58887

Closes #58887
This commit is contained in:
Mark Rousskov 2019-07-23 12:51:13 -04:00 committed by GitHub
commit 8afc53c195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,23 @@
#![feature(existential_type)]
trait UnwrapItemsExt {
type Iter;
fn unwrap_items(self) -> Self::Iter;
}
impl<I, T, E> UnwrapItemsExt for I
where
I: Iterator<Item = Result<T, E>>,
E: std::fmt::Debug,
{
existential type Iter: Iterator<Item = T>;
//~^ ERROR: could not find defining uses
fn unwrap_items(self) -> Self::Iter {
//~^ ERROR: type parameter `T` is part of concrete type
//~| ERROR: type parameter `E` is part of concrete type
self.map(|x| x.unwrap())
}
}
fn main() {}

View File

@ -0,0 +1,30 @@
error: type parameter `T` is part of concrete type but not used in parameter list for existential type
--> $DIR/issue-58887.rs:16:41
|
LL | fn unwrap_items(self) -> Self::Iter {
| _________________________________________^
LL | |
LL | |
LL | | self.map(|x| x.unwrap())
LL | | }
| |_____^
error: type parameter `E` is part of concrete type but not used in parameter list for existential type
--> $DIR/issue-58887.rs:16:41
|
LL | fn unwrap_items(self) -> Self::Iter {
| _________________________________________^
LL | |
LL | |
LL | | self.map(|x| x.unwrap())
LL | | }
| |_____^
error: could not find defining uses
--> $DIR/issue-58887.rs:13:5
|
LL | existential type Iter: Iterator<Item = T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors