// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 or the MIT license // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![allow(unused)] fn main() { } fn foo() { let b = mk::< Forward<(Box>,)>, >(); b.map_err(|_| ()).join(); } fn mk() -> T { loop {} } impl, E> Future for (I,) { type Error = E; } struct Forward { _a: T, } impl Future for Forward where T::Error: From, { type Error = T::Error; } trait Future { type Error; fn map_err(self, _: F) -> (Self, F) where F: FnOnce(Self::Error) -> E, Self: Sized, { loop {} } fn join(self) -> (MaybeDone, ()) where Self: Sized, { loop {} } } impl Future for Box { type Error = S::Error; } enum MaybeDone { _Done(A::Error), } impl Future for (A, F) where F: FnOnce(A::Error) -> U, { type Error = U; }