Skip to content
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

Suggest copying trait associated type bounds on lifetime error #92683

Merged
merged 1 commit into from Feb 18, 2022

Conversation

@jackh726
Copy link
Contributor

@jackh726 jackh726 commented Jan 9, 2022

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 Jan 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Jan 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Jan 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis commented Jan 10, 2022

r=me but I'll let @estebank do a review if he wants to

@bors
Copy link
Contributor

@bors bors commented Jan 15, 2022

The latest upstream changes (presumably #92927) made this pull request unmergeable. Please resolve the merge conflicts.

@jackh726 jackh726 force-pushed the issue-92033 branch 2 times, most recently from 9bac686 to 814a62d Jan 16, 2022
@bors
Copy link
Contributor

@bors bors commented Feb 8, 2022

The latest upstream changes (presumably #92007) made this pull request unmergeable. Please resolve the merge conflicts.

@estebank
Copy link
Contributor

@estebank estebank commented Feb 17, 2022

r=me after fixing rebase

@jackh726
Copy link
Contributor Author

@jackh726 jackh726 commented Feb 17, 2022

@bors r=estebank

@bors
Copy link
Contributor

@bors bors commented Feb 17, 2022

📌 Commit 3d19c8d has been approved by estebank

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 17, 2022
Suggest copying trait associated type bounds on lifetime error

Closes rust-lang#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`
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 17, 2022
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#92683 (Suggest copying trait associated type bounds on lifetime error)
 - rust-lang#92933 (Deny mixing bin crate type with lib crate types)
 - rust-lang#92959 (Add more info and suggestions to use of #[test] on invalid items)
 - rust-lang#93024 (Do not ICE when inlining a function with un-satisfiable bounds)
 - rust-lang#93072 (Compatible variants suggestion with desugaring)
 - rust-lang#93613 (Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`)
 - rust-lang#93634 (compiler: clippy::complexity fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 18, 2022
…askrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#92683 (Suggest copying trait associated type bounds on lifetime error)
 - rust-lang#92933 (Deny mixing bin crate type with lib crate types)
 - rust-lang#92959 (Add more info and suggestions to use of #[test] on invalid items)
 - rust-lang#93024 (Do not ICE when inlining a function with un-satisfiable bounds)
 - rust-lang#93613 (Move `{core,std}::stream::Stream` to `{core,std}::async_iter::AsyncIterator`)
 - rust-lang#93634 (compiler: clippy::complexity fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dd11126 into rust-lang:master Feb 18, 2022
10 checks passed
@rustbot rustbot added this to the 1.60.0 milestone Feb 18, 2022
@jackh726 jackh726 deleted the issue-92033 branch Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants