-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Point at return expression for RPIT-related error #97818
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
r? rust-lang/diagnostics |
☔ The latest upstream changes (presumably #97980) made this pull request unmergeable. Please resolve the merge conflicts. |
let cause = ObligationCause::misc(span, body_id); | ||
let cause = ObligationCause::new(span, body_id, code.clone()); | ||
let ty_var = self.next_ty_var(TypeVariableOrigin { | ||
kind: TypeVariableOriginKind::TypeInference, | ||
span: cause.span, | ||
span, | ||
}); |
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.
We can certainly do this for now, but doesn't scale very well to longer inference chains or going through any kind of branching.
I would like to generally improve inference errors to know the start and end of the inference and improve diagnostics from that. So ideally we'd have a new TypeVariableOriginKind
and use that information to improve the spans right when the inference variable gets inferred to a concrete type.
So... short term, your change is the best effect-for-effort change we can make, but it should probably have a fixme or issue so we have a canonical thing to point to and collect experiments and other information.
@rustbot author needs a rebase and a minor fixme fix |
57bcc89
to
52409c4
Compare
@bors r=oli-obk |
📌 Commit 52409c4 has been approved by |
… r=oli-obk Point at return expression for RPIT-related error Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback. Fixes rust-lang#80583
Rollup of 10 pull requests Successful merges: - rust-lang#95446 (update CPU usage script) - rust-lang#96768 (Use futex based thread parker on Fuchsia.) - rust-lang#97454 (Add release notes for 1.62) - rust-lang#97516 (clarify how Rust atomics correspond to C++ atomics) - rust-lang#97818 (Point at return expression for RPIT-related error) - rust-lang#97895 (Simplify `likely!` and `unlikely!` macro) - rust-lang#98005 (Add some tests for impossible bounds) - rust-lang#98226 (Document unstable `--extern` options) - rust-lang#98356 (Add missing period) - rust-lang#98363 (remove use of &Alloc in btree tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Certainly this needs some diagnostic refining, but I wanted to show that it was possible first and foremost. Not sure if this is the right approach. Open to feedback.
Fixes #80583