From 18dceabc9546050a2c30c525f58aaf9cbc582a6b Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 21 Jul 2019 14:18:20 +0900 Subject: [PATCH 1/2] Add tests for issue-58887 --- src/test/ui/issues/issue-58887.rs | 21 ++++++++++++++++ src/test/ui/issues/issue-58887.stderr | 35 +++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/test/ui/issues/issue-58887.rs create mode 100644 src/test/ui/issues/issue-58887.stderr diff --git a/src/test/ui/issues/issue-58887.rs b/src/test/ui/issues/issue-58887.rs new file mode 100644 index 00000000000..ca2374af7bd --- /dev/null +++ b/src/test/ui/issues/issue-58887.rs @@ -0,0 +1,21 @@ +#![feature(existential_type)] + +trait UnwrapItemsExt { + type II; + fn unwrap_items(self) -> Self::II; +} + +impl UnwrapItemsExt for I +where + I: Iterator>, + E: std::fmt::Debug, +{ + existential type II: Iterator; + //~^ 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()) + } +} diff --git a/src/test/ui/issues/issue-58887.stderr b/src/test/ui/issues/issue-58887.stderr new file mode 100644 index 00000000000..8cb25d84f54 --- /dev/null +++ b/src/test/ui/issues/issue-58887.stderr @@ -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; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 4 previous errors + +For more information about this error, try `rustc --explain E0601`. From e75ae15fb912afe56f07425abbba9e3412d0c01d Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 22 Jul 2019 07:12:31 +0900 Subject: [PATCH 2/2] Move into existential-type dir --- .../issue-58887.rs | 10 +++--- .../ui/existential-type/issue-58887.stderr | 30 ++++++++++++++++ src/test/ui/issues/issue-58887.stderr | 35 ------------------- 3 files changed, 36 insertions(+), 39 deletions(-) rename src/test/ui/{issues => existential-type}/issue-58887.rs (69%) create mode 100644 src/test/ui/existential-type/issue-58887.stderr delete mode 100644 src/test/ui/issues/issue-58887.stderr diff --git a/src/test/ui/issues/issue-58887.rs b/src/test/ui/existential-type/issue-58887.rs similarity index 69% rename from src/test/ui/issues/issue-58887.rs rename to src/test/ui/existential-type/issue-58887.rs index ca2374af7bd..f038648ec21 100644 --- a/src/test/ui/issues/issue-58887.rs +++ b/src/test/ui/existential-type/issue-58887.rs @@ -1,8 +1,8 @@ #![feature(existential_type)] trait UnwrapItemsExt { - type II; - fn unwrap_items(self) -> Self::II; + type Iter; + fn unwrap_items(self) -> Self::Iter; } impl UnwrapItemsExt for I @@ -10,12 +10,14 @@ where I: Iterator>, E: std::fmt::Debug, { - existential type II: Iterator; + existential type Iter: Iterator; //~^ ERROR: could not find defining uses - fn unwrap_items(self) -> Self::II { + 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() {} diff --git a/src/test/ui/existential-type/issue-58887.stderr b/src/test/ui/existential-type/issue-58887.stderr new file mode 100644 index 00000000000..800f4b7e059 --- /dev/null +++ b/src/test/ui/existential-type/issue-58887.stderr @@ -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; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/issues/issue-58887.stderr b/src/test/ui/issues/issue-58887.stderr deleted file mode 100644 index 8cb25d84f54..00000000000 --- a/src/test/ui/issues/issue-58887.stderr +++ /dev/null @@ -1,35 +0,0 @@ -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; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0601`.