Skip to content

Suggest copying trait associated type bounds on lifetime error #92683

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Feb 18, 2022

Conversation

jackh726
Copy link
Member

@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

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jan 9, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 9, 2022
@@ -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
Member Author

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
Member Author

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
Member Author

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

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

@bors
Copy link
Collaborator

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 Compare January 16, 2022 00:02
@bors
Copy link
Collaborator

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

r=me after fixing rebase

@estebank estebank added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 17, 2022
@jackh726
Copy link
Member Author

@bors r=estebank

@bors
Copy link
Collaborator

bors commented Feb 17, 2022

📌 Commit 3d19c8d has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 17, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request 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 pull request 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
@rustbot rustbot added this to the 1.60.0 milestone Feb 18, 2022
@jackh726 jackh726 deleted the issue-92033 branch February 18, 2022 22:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better diagnostics when where clauses need on associated type in impl
6 participants