-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Closed
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Got this diagnostic trying to avoid having to look up what error type hyper's Uri std::str::FromStr impl returns by using <Uri as FromStr>::Err as the error type of Future and then returning it abstractly: fn foo() -> impl Future<Item=Uri, Error=<Uri as FromStr>::Err>.
Kinda sounds like #34257, but the diagnostic is more confusing and it seems to depend on impl trait.
rustc 1.18.0-nightly (9f2abad 2017-04-18)
A reduced version with no external types (playground):
#![feature(conservative_impl_trait)]
struct Thing;
struct ThingError;
trait FakeFromStr {
type Err;
}
fn fake_parse<T: FakeFromStr>() -> Result<T, T::Err> { panic!() }
impl FakeFromStr for Thing {
type Err = ThingError;
}
trait FakeFuture {
type Item;
type Error;
}
struct FakeFutureResult<A, B>(Result<A, B>);
impl<A, B> FakeFuture for FakeFutureResult<A, B> {
type Item = A;
type Error = B;
}
fn foo() -> impl FakeFuture<Item=Thing, Error=<Thing as FakeFromStr>::Err> {
FakeFutureResult(fake_parse())
}
fn main() {
let _ = foo();
}Metadata
Metadata
Assignees
Labels
A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.