You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a721052 made type-alias-impl-trait different from return-position-impl-trait.
typeFoo = impl std::fmt::Debug;fnfoo(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:
fnfoo(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:
Make TAIT behave exactly like RPIT
fixesrust-lang#96552
This makes type-alias-impl-trait behave like return-position-impl-trait. Unfortunately it also causes some cases to stop compiling due to "needing type annotations" and makes panicking cause fallback for the hidden type to `()`.
All of these are addressable, but we should probably address them for RPIT and TAIT together
r? `@lcnr`
a721052 made type-alias-impl-trait different from return-position-impl-trait.
does not compile while the equivalent return-position-impl-trait program compiles:
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() }
The text was updated successfully, but these errors were encountered: