-
Notifications
You must be signed in to change notification settings - Fork 13.3k
create LifetimeRes::Fresh
firstly when lower lifetime binder
#119021
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ LL | f2(|_: (), _: ()| {}); | |
| | | ||
| expected due to this | ||
| | ||
= note: expected closure signature `for<'a, 'b> fn(&'a (), &'b ()) -> _` | ||
= note: expected closure signature `for<'b, 'a> fn(&'a (), &'b ()) -> _` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems acceptable. Alternatively, we could sort this before displaying the diagnostics? |
||
found closure signature `fn((), ()) -> _` | ||
note: required by a bound in `f2` | ||
--> $DIR/anonymous-higher-ranked-lifetime.rs:17:25 | ||
|
@@ -66,7 +66,7 @@ LL | f4(|_: (), _: ()| {}); | |
| | | ||
| expected due to this | ||
| | ||
= note: expected closure signature `for<'r, 'a> fn(&'a (), &'r ()) -> _` | ||
= note: expected closure signature `for<'a, 'r> fn(&'a (), &'r ()) -> _` | ||
found closure signature `fn((), ()) -> _` | ||
note: required by a bound in `f4` | ||
--> $DIR/anonymous-higher-ranked-lifetime.rs:19:25 | ||
|
@@ -206,7 +206,7 @@ LL | h2(|_: (), _: (), _: (), _: ()| {}); | |
| | | ||
| expected due to this | ||
| | ||
= note: expected closure signature `for<'t0, 'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _` | ||
= note: expected closure signature `for<'a, 't0> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>, &'t0 (), for<'a, 'b> fn(&'a (), &'b ())) -> _` | ||
found closure signature `fn((), (), (), ()) -> _` | ||
note: required by a bound in `h2` | ||
--> $DIR/anonymous-higher-ranked-lifetime.rs:30:25 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#![allow(incomplete_features)] | ||
#![feature(non_lifetime_binders)] | ||
|
||
type T = dyn for<V = A(&())> Fn(()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should probably just ban parameter defaults in non-lifetime binders before we get to AST->HIR lowering. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree this is a promising approach. I'll give it a try. |
||
//~^ ERROR cannot find type `A` in this scope | ||
//~| ERROR late-bound type parameter not allowed on trait object types | ||
|
||
fn main() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error[E0412]: cannot find type `A` in this scope | ||
--> $DIR/issue-118697.rs:4:22 | ||
| | ||
LL | type T = dyn for<V = A(&())> Fn(()); | ||
| ^ not found in this scope | ||
|
||
error: late-bound type parameter not allowed on trait object types | ||
--> $DIR/issue-118697.rs:4:18 | ||
| | ||
LL | type T = dyn for<V = A(&())> Fn(()); | ||
| ^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0412`. |
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.
Why does this fix the issue?
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.
An invocation of a
def_id
inextra_lifetimes
occurs during lower_generic_params_mut
. This rearrangement ensures that the def_id
is not None.