diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-29 04:08:04 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-07-29 06:56:28 +0200 |
| commit | a54dd2318ae42fa4c6602cd37d07e837464df082 (patch) | |
| tree | fd0b39ba004f1e7dc9c400546b7766d17c862cf6 | |
| parent | 1e927d8689bc605cb1b1ff5b7bf9c062f6885443 (diff) | |
| download | rust-a54dd2318ae42fa4c6602cd37d07e837464df082.tar.gz rust-a54dd2318ae42fa4c6602cd37d07e837464df082.zip | |
Add test for #60564.
| -rw-r--r-- | src/test/ui/existential_types/issue-60564.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/existential_types/issue-60564.stderr | 25 |
2 files changed, 51 insertions, 0 deletions
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 00000000000..cb3914ddd1d --- /dev/null +++ b/src/test/ui/existential_types/issue-60564.rs @@ -0,0 +1,26 @@ +#![feature(existential_type)] + +trait IterBits { + type BitsIter: Iterator<Item = u8>; + fn iter_bits(self, n: u8) -> Self::BitsIter; +} + +existential type IterBitsIter<T, E, I>: std::iter::Iterator<Item = I>; +//~^ ERROR could not find defining uses + +impl<T, E> IterBits for T +where + T: std::ops::Shr<Output = T> + + std::ops::BitAnd<T, Output = T> + + std::convert::From<u8> + + std::convert::TryInto<u8, Error = E>, + E: std::fmt::Debug, +{ + type BitsIter = IterBitsIter<T, E, u8>; + 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 00000000000..d8480b52157 --- /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<T, E, I>: std::iter::Iterator<Item = I>; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0601`. |
