-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Conserve cause of ImplDerivedObligation
in E0599
#106702
Conversation
r? @davidtwco (rustbot has picked a reviewer for you, use r? to override) |
6c8ca19
to
3a16c1a
Compare
r? @compiler-errors @bors r+ as requested |
📌 Commit 3a16c1aa1a3fafd8103dc65f66c8b785e7ded725 has been approved by It is now in the queue for this repository. |
@bors r=compiler-errors |
📌 Commit 5e8b8e7c03a397de79afce6adcc3218b7f742409 has been approved by It is now in the queue for this repository. |
5e8b8e7
to
317adda
Compare
@bors r=compiler-errors |
…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
|_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), |
There was a problem hiding this comment.
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
…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. Fixes rust-lang#110131 cc rust-lang#106702, which introduced this regression
…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. Fixes rust-lang#110131 cc rust-lang#106702, which introduced this regression
CC #86377.