-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE inferring lifetimes in impl Trait
return type
#39929
Comments
This appears to be a duplicate of #39553. |
See #39553, which no longer ICEs, while this continues to do so -- reopening. |
I have run into this issue multiple times since then while using |
Another minimal example: #![feature(conservative_impl_trait)]
fn impl_trait_with_ref<T: ?Sized>(v: &T) -> impl Iterator<Item=&T> {
std::iter::once(v)
}
fn main() {
for s in impl_trait_with_ref("foobar") {
println!("{}", s);
}
} Maybe this is still the duplicate of #39553. |
Yeah, this is actually a duplicate of #39553. |
Minimal example here: https://is.gd/yWRQML
It appears that lifetime inference fails in a way that causes an ICE. Filling in the lifetimes manually solves the ICE, but seems unnecessary based on existing lifetime inference rules (
fn foo(&self) -> &Bar
infers correctly, so intuitively this should too).Running the example locally, I get:
The text was updated successfully, but these errors were encountered: