-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Elaborate supertrait bounds when triggering unused_must_use on impl T…
…rait
- Loading branch information
1 parent
542febd
commit 8509819
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|