1 // This code (probably) _should_ compile, but it currently does not because we
2 // are not smart enough about implied bounds.
6 fn real_dispatch<T, F>(f: F) -> Result<(), io::Error>
7 //~^ NOTE required by a bound in this
9 F: FnOnce(&mut UIView<T>) -> Result<(), io::Error> + Send + 'static,
10 //~^ NOTE required by this bound in `real_dispatch`
11 //~| NOTE required by a bound in `real_dispatch`
17 struct UIView<'a, T: 'a> {
18 _phantom: std::marker::PhantomData<&'a mut T>,
21 trait Handle<'a, T: 'a, V, R> {
22 fn dispatch<F>(&self, f: F) -> Result<(), io::Error>
24 F: FnOnce(&mut V) -> R + Send + 'static;
27 #[derive(Debug, Clone)]
29 _phantom: std::marker::PhantomData<T>,
32 impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandle<T> {
33 fn dispatch<F>(&self, f: F) -> Result<(), io::Error>
35 F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
38 //~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
39 //~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
40 //~| NOTE expected a closure with arguments
41 //~| NOTE required by a bound introduced by this call