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

Tracking Issue for post #89862 cleanup #94483

Closed
7 of 16 tasks
lcnr opened this issue Mar 1, 2022 · 3 comments
Closed
7 of 16 tasks

Tracking Issue for post #89862 cleanup #94483

lcnr opened this issue Mar 1, 2022 · 3 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@lcnr
Copy link
Contributor

lcnr commented Mar 1, 2022

#89862 rewrote the inference error reporting, but slightly worsened some causes or requires some additional improvements.

  • readd a special diagnostic for for loops
  • maybe readd handling for try expressions ?
  • add InferSource for x.into() to <Type as Into<_>>::into(x)
  • add ty_msg back if no infer source is found
  • in the suggested type, try to only print _ for things while are fully inferred and use some different stuff for unresolved inference vars, e.g "specify the generic param T for Foo<i32, T, _>"
    • remember the used parameters in ty_to_string for this
  • remember the inferred type for InferSource::GenericArg and use them to compute the cost and for the error msg, generally improve cost computation, e.g. channel()
    • change source_cost to improve the diagnostics when using channel().
  • impl_candidates in emit_inference_failure_err IMPORTANT
  • figure out how to not mention macro internals in error messages.
  • fix the explicit FIXME(#89862) in some tests
  • inference var origins: https://github.com/rust-lang/rust/pull/89862/files#r870179263
  • figure out how to best deal with rewrite error handling for unresolved inference vars #89862 (comment)
  • autoborrow method call
  • ui/impl-trait/diagnostics/fully-qualified-path-impl-trait.rs fixme
  • help: type parameter declared here readd maybe
@lcnr lcnr added C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 1, 2022
@estebank
Copy link
Contributor

https://github.com/rust-lang/rust/pull/89862/files#diff-61d51b814405f1781530e7e1aa7ec33300b9a60d2338870adcae2404abea109e This test has a small regression. In method chains with inference errors, we should specify the full type of the generic that wasn't detected.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 3, 2022
…ebank

rewrite error handling for unresolved inference vars

Pretty much completely rewrites `fn emit_inference_failure_err`.

This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments.
Because this is a rewrite there are still some parts which are lacking, these are tracked in rust-lang#94483 and will be fixed in later PRs.

r? `@estebank` `@petrochenkov`
@aliemjay
Copy link
Member

aliemjay commented Aug 1, 2022

another regression I stumbled on: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=56db000bf6de1f611185c769fe098d5e

fn main() {
    |var: _| { // `_` placeholder is necessary.
    //^ Past : consider giving this closure parameter a type
        var.abc()
        //^ Present : cannot infer type
    };
}

@lcnr
Copy link
Contributor Author

lcnr commented Jan 26, 2024

closing this.

most of these points have been implemented while the remaining ones are either difficult to implement, underspecified or not worth the complexity. Any future improvements are worth it regardless of whether they are mentioned in this issue

@lcnr lcnr closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants