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

Improve some inference diagnostics #98497

Merged
merged 4 commits into from
Jul 2, 2022

Conversation

compiler-errors
Copy link
Member

  • Properly point out point location where "type must be known at this point", or else omit the note if it's not associated with a useful span.
  • Fix up some type ambiguity diagnostics, errors shouldn't say "cannot infer type for reference &'a ()" when the given type has no inference variables.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 25, 2022
@rust-highfive
Copy link
Collaborator

Some changes occured in need_type_info.rs

cc @lcnr

@rust-highfive
Copy link
Collaborator

r? @jackh726

(rust-highfive has picked a reviewer for you, use r? to override)

@compiler-errors compiler-errors marked this pull request as ready for review June 25, 2022 19:46
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 25, 2022
@lcnr
Copy link
Contributor

lcnr commented Jun 25, 2022

r? @lcnr

@rust-highfive rust-highfive assigned lcnr and unassigned jackh726 Jun 25, 2022
Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

some nits, then r=me

@lcnr lcnr 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 Jun 28, 2022
@compiler-errors
Copy link
Member Author

@lcnr left some comments, couldn't really find anything to change without regressing diagnostics.

@rustbot ready

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

rustbot commented Jul 1, 2022

Some changes occurred in need_type_info.rs

cc @lcnr

Comment on lines 2002 to 2004
// Pick the first substitution that still contains inference variables as the one
// we're going to emit an error for. If there are none (see above), fall back to
// the substitution for `Self`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Pick the first substitution that still contains inference variables as the one
// we're going to emit an error for. If there are none (see above), fall back to
// the substitution for `Self`.
// Pick the first substitution that still contains inference variables as the one
// we're going to emit an error for. If there are none (see above), fall back
// to a more general error.

@lcnr
Copy link
Contributor

lcnr commented Jul 1, 2022

r=me after that last nit ^^

@compiler-errors
Copy link
Member Author

@bors r=lcnr

@bors
Copy link
Contributor

bors commented Jul 1, 2022

📌 Commit 6711313 has been approved by lcnr

@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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 1, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 1, 2022
…laumeGomez

Rollup of 5 pull requests

Successful merges:

 - rust-lang#97249 (`<details>`/`<summary>` UI fixes)
 - rust-lang#98418 (Allow macOS to build LLVM as shared library)
 - rust-lang#98460 (Use CSS variables to handle theming)
 - rust-lang#98497 (Improve some inference diagnostics)
 - rust-lang#98708 (rustdoc: fix 98690 Panic if invalid path for -Z persist-doctests)

Failed merges:

 - rust-lang#98761 (more `need_type_info` improvements)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b0935b1 into rust-lang:master Jul 2, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 2, 2022
@compiler-errors compiler-errors deleted the span-inference-note branch August 11, 2023 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

6 participants