Elaborate supertrait bounds when triggering unused_must_use on impl Trait
This commit is contained in:
parent
542febd2d3
commit
8509819aef
3 changed files with 32 additions and 2 deletions
11
src/test/ui/lint/unused/unused-supertrait.rs
Normal file
11
src/test/ui/lint/unused/unused-supertrait.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#![deny(unused_must_use)]
|
||||
|
||||
fn it() -> impl ExactSizeIterator<Item = ()> {
|
||||
let x: Box<dyn ExactSizeIterator<Item = ()>> = todo!();
|
||||
x
|
||||
}
|
||||
|
||||
fn main() {
|
||||
it();
|
||||
//~^ ERROR unused implementer of `Iterator` that must be used
|
||||
}
|
||||
15
src/test/ui/lint/unused/unused-supertrait.stderr
Normal file
15
src/test/ui/lint/unused/unused-supertrait.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error: unused implementer of `Iterator` that must be used
|
||||
--> $DIR/unused-supertrait.rs:9:5
|
||||
|
|
||||
LL | it();
|
||||
| ^^^^^
|
||||
|
|
||||
= note: iterators are lazy and do nothing unless consumed
|
||||
note: the lint level is defined here
|
||||
--> $DIR/unused-supertrait.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue