Conversation
|
This PR changes a file inside |
|
☔ The latest upstream changes (presumably #163419) made this pull request unmergeable. Please resolve the merge conflicts by rebasing. |
| @@ -803,9 +778,12 @@ fn field_tys_satisfy_relation_after_normalization_and_resolution<'tcx>( | |||
| else { | |||
| return false; | |||
| }; | |||
| if source_region != target_region { | |||
| return false; | |||
| } | |||
| infcx.sub_regions( | |||
| SubregionOrigin::RelateObjectBound(span), | |||
| target_region, | |||
| source_region, | |||
| ty::VisibleForLeakCheck::Yes, | |||
| ); | |||
| if ocx.sup(&cause, param_env, target_referent_ty, source_referent_ty).is_err() { | |||
| return false; | |||
| } | |||
There was a problem hiding this comment.
I couldn't find any in-tree docs about the lifetime handling. Should probably add some now that you aren't requiring equality anymore. I had to grab a variance table and poke at the code and tests here until I was sure it was all in the right direction 😆
| if trait_impl_lifetime_params_count(tcx, impl_did) != 1 { | ||
| if trait_impl_lifetime_params_count(tcx, impl_did) == 0 { | ||
| return Err(tcx | ||
| .dcx() | ||
| .emit_err(diagnostics::CoerceSharedNotSingleLifetimeParam { span, trait_name })); |
There was a problem hiding this comment.
probably needs updating of the diagnostic (and at minimum of the diagnostic struct name)
|
|
||
| let Some(last) = path.segments.last_mut() else { | ||
| // FIXME(reborrow): we might want to support CoerceShared<Foo> for Bar at some point. | ||
| cx.dcx().emit_err(MalformedTarget { span: attr.span }); |
There was a problem hiding this comment.
probably want to use more precise for all the MalformedTarget errors, usually you have a specific item available which has its own span
|
Reminder, once the PR becomes ready for a review, use |
The
Reborrow/CoerceSharedborrow checking code is now robust enough to properly handle multiple lifetimes, and for that we can allow multiple lifetimes in the traits. This requires making theCoerceSharedderive macro produce multiple lifetimes and in particular produce'a_ where'a: 'a_` additions to the generics, and removing some now-unnecessary checks from the wf-checks.The derive trait code is some of the uglies stuff I've ever written.
r? @oli-obk