Don't suggest dereferencing to unsized type
This commit is contained in:
parent
f00c139998
commit
ee9727e263
3 changed files with 51 additions and 1 deletions
|
|
@ -0,0 +1,15 @@
|
|||
fn use_iterator<I>(itr: I)
|
||||
where
|
||||
I: IntoIterator<Item = i32>,
|
||||
{
|
||||
}
|
||||
|
||||
fn pass_iterator<I>(i: &dyn IntoIterator<Item = i32, IntoIter = I>)
|
||||
where
|
||||
I: Iterator<Item = i32>,
|
||||
{
|
||||
use_iterator(i);
|
||||
//~^ ERROR `&dyn IntoIterator<Item = i32, IntoIter = I>` is not an iterator
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
error[E0277]: `&dyn IntoIterator<Item = i32, IntoIter = I>` is not an iterator
|
||||
--> $DIR/dont-suggest-unsize-deref.rs:11:18
|
||||
|
|
||||
LL | use_iterator(i);
|
||||
| ------------ ^ `&dyn IntoIterator<Item = i32, IntoIter = I>` is not an iterator
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `&dyn IntoIterator<Item = i32, IntoIter = I>`
|
||||
= note: required for `&dyn IntoIterator<Item = i32, IntoIter = I>` to implement `IntoIterator`
|
||||
note: required by a bound in `use_iterator`
|
||||
--> $DIR/dont-suggest-unsize-deref.rs:3:8
|
||||
|
|
||||
LL | fn use_iterator<I>(itr: I)
|
||||
| ------------ required by a bound in this function
|
||||
LL | where
|
||||
LL | I: IntoIterator<Item = i32>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `use_iterator`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue