From a54dd2318ae42fa4c6602cd37d07e837464df082 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 29 Jul 2019 04:08:04 +0200 Subject: [PATCH] Add test for #60564. --- src/test/ui/existential_types/issue-60564.rs | 26 +++++++++++++++++++ .../ui/existential_types/issue-60564.stderr | 25 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 src/test/ui/existential_types/issue-60564.rs create mode 100644 src/test/ui/existential_types/issue-60564.stderr diff --git a/src/test/ui/existential_types/issue-60564.rs b/src/test/ui/existential_types/issue-60564.rs new file mode 100644 index 000000000000..cb3914ddd1de --- /dev/null +++ b/src/test/ui/existential_types/issue-60564.rs @@ -0,0 +1,26 @@ +#![feature(existential_type)] + +trait IterBits { + type BitsIter: Iterator; + fn iter_bits(self, n: u8) -> Self::BitsIter; +} + +existential type IterBitsIter: std::iter::Iterator; +//~^ ERROR could not find defining uses + +impl IterBits for T +where + T: std::ops::Shr + + std::ops::BitAnd + + std::convert::From + + std::convert::TryInto, + E: std::fmt::Debug, +{ + type BitsIter = IterBitsIter; + fn iter_bits(self, n: u8) -> Self::BitsIter { + //~^ ERROR type parameter `E` is part of concrete type but not used + (0u8..n) + .rev() + .map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) + } +} diff --git a/src/test/ui/existential_types/issue-60564.stderr b/src/test/ui/existential_types/issue-60564.stderr new file mode 100644 index 000000000000..d8480b521570 --- /dev/null +++ b/src/test/ui/existential_types/issue-60564.stderr @@ -0,0 +1,25 @@ +error[E0601]: `main` function not found in crate `issue_60564` + | + = note: consider adding a `main` function to `$DIR/issue-60564.rs` + +error: type parameter `E` is part of concrete type but not used in parameter list for existential type + --> $DIR/issue-60564.rs:20:49 + | +LL | fn iter_bits(self, n: u8) -> Self::BitsIter { + | _________________________________________________^ +LL | | +LL | | (0u8..n) +LL | | .rev() +LL | | .map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) +LL | | } + | |_____^ + +error: could not find defining uses + --> $DIR/issue-60564.rs:8:1 + | +LL | existential type IterBitsIter: std::iter::Iterator; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0601`.