Add test for #60564.
This commit is contained in:
parent
1e927d8689
commit
a54dd2318a
2 changed files with 51 additions and 0 deletions
26
src/test/ui/existential_types/issue-60564.rs
Normal file
26
src/test/ui/existential_types/issue-60564.rs
Normal file
|
|
@ -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())
|
||||
}
|
||||
}
|
||||
25
src/test/ui/existential_types/issue-60564.stderr
Normal file
25
src/test/ui/existential_types/issue-60564.stderr
Normal file
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue