Skip to content

Commit

Permalink
Add tests for issue-58887
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jul 21, 2019
1 parent 95b1fe5 commit 18dceab
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/ui/issues/issue-58887.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#![feature(existential_type)]

trait UnwrapItemsExt {
type II;
fn unwrap_items(self) -> Self::II;
}

impl<I, T, E> UnwrapItemsExt for I
where
I: Iterator<Item = Result<T, E>>,
E: std::fmt::Debug,
{
existential type II: Iterator<Item = T>;
//~^ ERROR: could not find defining uses

fn unwrap_items(self) -> Self::II {
//~^ ERROR: type parameter `T` is part of concrete type
//~| ERROR: type parameter `E` is part of concrete type
self.map(|x| x.unwrap())
}
}
35 changes: 35 additions & 0 deletions src/test/ui/issues/issue-58887.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
error[E0601]: `main` function not found in crate `issue_58887`
|
= note: consider adding a `main` function to `$DIR/issue-58887.rs`

error: type parameter `T` is part of concrete type but not used in parameter list for existential type
--> $DIR/issue-58887.rs:16:39
|
LL | fn unwrap_items(self) -> Self::II {
| _______________________________________^
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:39
|
LL | fn unwrap_items(self) -> Self::II {
| _______________________________________^
LL | |
LL | |
LL | | self.map(|x| x.unwrap())
LL | | }
| |_____^

error: could not find defining uses
--> $DIR/issue-58887.rs:13:5
|
LL | existential type II: Iterator<Item = T>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0601`.

0 comments on commit 18dceab

Please sign in to comment.