-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Don't ICE when reporting borrowck errors involving regions from anonymous_lifetime_in_impl_trait
#103382
Don't ICE when reporting borrowck errors involving regions from anonymous_lifetime_in_impl_trait
#103382
Conversation
anonymous_lifetime_in_impl_trait
anonymous_lifetime_in_impl_trait
ecbff72
to
e025306
Compare
error[E0521]: borrowed data escapes outside of closure | ||
--> $DIR/anonymous-region-in-apit.rs:8:17 | ||
| | ||
LL | fn qux(foo: impl Foo<&str>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any easy way to get the def_id
of the lifetime itself and point to it?
r=me if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, as far as I understand it, the way that borrowck does it requires walking through HIR, and I didn't want to reinvent that for just this case.
@bors r=cjgillot rollup |
…n-ice, r=cjgillot Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait` The issue here is that when we have: ``` trait Trait<'a> { .. } fn foo(arg: impl Trait) { .. } ``` The anonymous lifetime `'_` that we generate for `arg: impl Trait` doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty. Fixes rust-lang#101660 r? `@cjgillot`
Rollup of 11 pull requests Successful merges: - rust-lang#103333 (Fix assertion failed for break_last_token and trailing token) - rust-lang#103350 (Change terminology for assoc method suggestions when they are not called) - rust-lang#103382 (Don't ICE when reporting borrowck errors involving regions from `anonymous_lifetime_in_impl_trait`) - rust-lang#103409 (Delay span bug when we can't map lifetimes back in `collect_trait_impl_trait_tys`) - rust-lang#103410 (-Z docs: Add link to unstable book) - rust-lang#103462 (rustdoc: remove no-op CSS `.source pre.rust { white-space: pre }`) - rust-lang#103465 (E0210 explanation: remove redundant sentence) - rust-lang#103486 (Use functions in highlight-colors rustdoc GUI test) - rust-lang#103493 (rustdoc: remove unused `.sidebar-logo` DOM on source pages) - rust-lang#103494 (rustdoc: remove redundant CSS `a.test-arrow:hover`) - rust-lang#103495 (rustdoc: Use `unix_sigpipe` instead of `rustc_driver::set_sigpipe_handler`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The issue here is that when we have:
The anonymous lifetime
'_
that we generate forarg: impl Trait
doesn't end up in the argument type (which is a param) but in a where-clause of the function, in a predicate whose self type is that param ty.Fixes #101660
r? @cjgillot