-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`
Description
a721052 made type-alias-impl-trait different from return-position-impl-trait.
type Foo = impl std::fmt::Debug;
fn foo(b: bool) -> Foo {
if b {
vec![42_i32]
} else {
std::iter::empty().collect()
//~^ ERROR `Foo` cannot be built from an iterator over elements of type `_`
}
}
does not compile while the equivalent return-position-impl-trait program compiles:
fn foo(b: bool) -> impl std::fmt::Debug{
if b {
vec![42_i32]
} else {
std::iter::empty().collect()
}
}
We should figure out what we actually want here and whether we can go even further and just remove opaque types from Expectation entirely. Things to try:
-
fn foo() -> for<'a> impl FnOnce(&'a str) -> usize { |s| s.len() }
-
fn foo() -> impl FnOnce(&'static str) -> usize { |s| s.len() }
Metadata
Metadata
Assignees
Labels
F-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`
Type
Projects
Status
Done