]>
git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/must_use-in-stdlib-traits.rs
1 #![deny(unused_must_use)]
2 #![feature(arbitrary_self_types)]
4 use std
::iter
::Iterator
;
5 use std
::future
::Future
;
7 use std
::task
::{Context, Poll}
;
9 use std
::unimplemented
;
13 impl Future
for MyFuture
{
16 fn poll(self: Pin
<&mut Self>, _
: &mut Context
<'_
>) -> Poll
<u32> {
21 fn iterator() -> impl Iterator
{
22 std
::iter
::empty
::<u32>()
25 fn future() -> impl Future
{
29 fn square_fn_once() -> impl FnOnce(u32) -> u32 {
33 fn square_fn_mut() -> impl FnMut(u32) -> u32 {
37 fn square_fn() -> impl Fn(u32) -> u32 {
42 iterator(); //~ ERROR unused implementer of `Iterator` that must be used
43 future(); //~ ERROR unused implementer of `Future` that must be used
44 square_fn_once(); //~ ERROR unused implementer of `FnOnce` that must be used
45 square_fn_mut(); //~ ERROR unused implementer of `FnMut` that must be used
46 square_fn(); //~ ERROR unused implementer of `Fn` that must be used