9

Suggest copying trait associated type bounds on lifetime error by jackh726 路 Pul...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/92683
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Copy link

Contributor

jackh726 commented on Jan 9

Closes #92033

Kind of the most simple suggestion to make - we don't try to be fancy. Turns out, it's still pretty useful (the couple existing tests that trigger this error end up fixed - for this error - upon applying the fix).

r? @estebank cc @nikomatsakis

@@ -64,7 +64,7 @@ impl<'cx, 'tcx> NiceRegionError<'cx, 'tcx> {

.or_else(|| self.try_report_mismatched_static_lifetime())

}

pub fn regions(&self) -> Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)> {

pub(super) fn regions(&self) -> Option<(Span, ty::Region<'tcx>, ty::Region<'tcx>)> {

Copy link

Contributor

Author

@jackh726 jackh726 on Jan 9

Drive by change.

let origin = SubregionOrigin::from_obligation_cause(&cause, || {

infer::RelateParamBound(cause.span, sup_type, None)

});

let origin = infer::RelateRegionParamBound(cause.span);

Copy link

Contributor

Author

@jackh726 jackh726 on Jan 9

This and the one below are drive-by changes. These shouldn't ever be displayed anyways. But wanted to stop using from_obligation_cause (was potentially going a different direction for this PR).

@@ -8,7 +8,7 @@ trait A<'a> {

// FIXME(generic_associated_types): Remove one of the below bounds

// https://github.com/rust-lang/rust/pull/90678#discussion_r744976085

where

'a: 'b, Self: 'a, Self: 'b;

Copy link

Contributor

Author

@jackh726 jackh726 on Jan 9

This bound was required because of a bug that has since been fixed. FIXME still stands for the two remaining though.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK