Skip to content

Conserve cause of ImplDerivedObligation in E0599 - #106702

Merged
bors merged 2 commits into
rust-lang:masterfrom
estebank:trait-bounds
Jan 12, 2023
Merged

Conserve cause of ImplDerivedObligation in E0599#106702
bors merged 2 commits into
rust-lang:masterfrom
estebank:trait-bounds

Conversation

@estebank

Copy link
Copy Markdown
Contributor

CC #86377.

@rustbot

Copy link
Copy Markdown
Collaborator

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbotrustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 11, 2023
@estebank
estebank marked this pull request as ready for review January 11, 2023 03:13
Comment threadsrc/test/ui/higher-rank-trait-bounds/issue-30786.stderr Outdated
Comment threadsrc/test/ui/suggestions/derive-trait-for-method-call.stderr Outdated
@compiler-errors

Copy link
Copy Markdown
Contributor

r? @compiler-errors@bors r+ as requested

@bors

bors commented Jan 11, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 3a16c1aa1a3fafd8103dc65f66c8b785e7ded725 has been approved by compiler-errors

It is now in the queue for this repository.

@borsbors 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 11, 2023
@estebank

Copy link
Copy Markdown
ContributorAuthor

@bors r=compiler-errors

@bors

bors commented Jan 11, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 5e8b8e7c03a397de79afce6adcc3218b7f742409 has been approved by compiler-errors

It is now in the queue for this repository.

@estebank

Copy link
Copy Markdown
ContributorAuthor

@bors r=compiler-errors

@bors

bors commented Jan 11, 2023

Copy link
Copy Markdown
Collaborator

📌 Commit 317adda has been approved by compiler-errors

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
…iaskrgr
Rollup of 10 pull requests
Successful merges:
- rust-lang#106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
- rust-lang#106309 (Prefer non-`[type error]` candidates during selection)
- rust-lang#106532 (Allow codegen to unsize `dyn*` to `dyn`)
- rust-lang#106596 (Hide more of long types in E0271)
- rust-lang#106638 (std tests: use __OsLocalKeyInner from realstd)
- rust-lang#106676 (Test that we cannot use trait impl methods arguments as defining uses)
- rust-lang#106702 (Conserve cause of `ImplDerivedObligation` in E0599)
- rust-lang#106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
- rust-lang#106733 (Revert "warn newer available version of the x tool")
- rust-lang#106748 (Clean up `OnUnimplementedFormatString::verify`)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 8a13157 into rust-lang:masterJan 12, 2023
@rustbotrustbot added this to the 1.68.0 milestone Jan 12, 2023
|_idx, span| {
let misc = traits::ObligationCause::misc(span, self.body_id);
let parent_trait_pred = ty::Binder::dummy(ty::TraitPredicate {
trait_ref: ty::TraitRef::from_method(self.tcx, impl_def_id, substs),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I should've caught this when reviewing this, but this is not correct. We cannot construct a trait ref out of an impl def id and impl substs, and it's not meaningful to even use tcx.impl_trait_ref(impl_def_id).subst(self.tcx, substs) here because this is an inherent impl by construction.

I fixed this in #110133

compiler-errors added a commit to compiler-errors/rust that referenced this pull request Apr 11, 2023
…trochenkov
Do not use ImplDerivedObligationCause for inherent impl method error reporting
We were constructing a `TraitRef` out of impl substs, for an *inherent* impl that has no corresponding trait. Instead of doing that, let's construct a meaningful obligation cause code, and instead adjust the error reporting machinery to handle that correctly.
Fixesrust-lang#110131
cc rust-lang#106702, which introduced this regression
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 12, 2023
…trochenkov
Do not use ImplDerivedObligationCause for inherent impl method error reporting
We were constructing a `TraitRef` out of impl substs, for an *inherent* impl that has no corresponding trait. Instead of doing that, let's construct a meaningful obligation cause code, and instead adjust the error reporting machinery to handle that correctly.
Fixesrust-lang#110131
cc rust-lang#106702, which introduced this regression
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

5 participants

@estebank@rustbot@compiler-errors@bors@davidtwco