2018-12-10 08:44:16 -06:00
|
|
|
#![deny(unused_must_use)]
|
2019-04-05 16:14:19 -05:00
|
|
|
#![feature(arbitrary_self_types)]
|
2018-12-10 08:44:16 -06:00
|
|
|
|
|
|
|
use std::iter::Iterator;
|
|
|
|
use std::future::Future;
|
|
|
|
|
2019-03-11 18:56:00 -05:00
|
|
|
use std::task::{Context, Poll};
|
2018-12-10 08:44:16 -06:00
|
|
|
use std::pin::Pin;
|
|
|
|
use std::unimplemented;
|
|
|
|
|
|
|
|
struct MyFuture;
|
|
|
|
|
|
|
|
impl Future for MyFuture {
|
|
|
|
type Output = u32;
|
|
|
|
|
2019-03-11 18:56:00 -05:00
|
|
|
fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<u32> {
|
2018-12-10 08:44:16 -06:00
|
|
|
Poll::Pending
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn iterator() -> impl Iterator {
|
|
|
|
std::iter::empty::<u32>()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn future() -> impl Future {
|
|
|
|
MyFuture
|
|
|
|
}
|
|
|
|
|
|
|
|
fn square_fn_once() -> impl FnOnce(u32) -> u32 {
|
|
|
|
|x| x * x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn square_fn_mut() -> impl FnMut(u32) -> u32 {
|
|
|
|
|x| x * x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn square_fn() -> impl Fn(u32) -> u32 {
|
|
|
|
|x| x * x
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2020-09-02 02:40:56 -05:00
|
|
|
iterator(); //~ ERROR unused implementer of `Iterator` that must be used
|
|
|
|
future(); //~ ERROR unused implementer of `Future` that must be used
|
|
|
|
square_fn_once(); //~ ERROR unused implementer of `FnOnce` that must be used
|
|
|
|
square_fn_mut(); //~ ERROR unused implementer of `FnMut` that must be used
|
|
|
|
square_fn(); //~ ERROR unused implementer of `Fn` that must be used
|
2018-12-10 09:05:54 -06:00
|
|
|
}
|