Skip to content

Error message on Windows missing "required by" hint #66860

Closed

Description

@Cerber-Ursi

I've found some kind of regression in error reporting. In short, the same code compiled by nightly-2019-11-25 yields different error messages on Linux (Ubuntu) and Windows. On Ubuntu:

error[E0283]: type annotations needed: cannot resolve `_: error_mismatch::Trait`
 --> tests/fail.rs:4:13
  |
4 |     let _ = collect();
  |             ^^^^^^^
  | 
 ::: /home/runner/work/test-error-mismatch/test-error-mismatch/src/lib.rs:9:19
  |
9 | pub fn collect<T: Trait>() -> T {
  |                   ----- required by this bound in `error_mismatch::collect`

On Windows:

error[E0283]: type annotations needed: cannot resolve `_: error_mismatch::Trait`
 --> tests\fail.rs:4:13
  |
4 |     let _ = collect();
  |             ^^^^^^^

Reproduction is here: https://github.com/Cerber-Ursi/test-error-mismatch/runs/325632093 (tests are failing intentionally - in real project this is handled by trybuild).

Activity

  1. estebank commented on Dec 6, 2019

    @estebank
    Contributor
  2. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Jan 30, 2020
  3. mibac138 commented on May 5, 2020

    @mibac138
    Contributor

    I can reproduce this on 1.43, however I can't on nightly. I think this was fixed along with #53081 in #70642?

    1.43 output

    error[E0283]: type annotations needed
     --> tests\fail.rs:4:13
      |
    4 |     let _ = collect();
      |         -   ^^^^^^^
      |         |   |
      |         |   cannot infer type for type parameter `T` declared on the function `collect`
      |         |   help: consider specifying the type argument in the function call: `collect::<T>`
      |         consider giving this pattern a type
      |
      = note: cannot resolve `_: error_mismatch::Trait`
    
    

    nightly 2020-04-27 output

    error[E0283]: type annotations needed
     --> tests\fail.rs:4:13
    4 |     let _ = collect();
      |         -   ^^^^^^^ cannot infer type for type parameter `T` declared on the function `collect`
      |         |
      |         consider giving this pattern a type
     ::: C:\Users\mibac\IdeaProjects\test-error-mismatch\src\lib.rs:9:19
      |
    9 | pub fn collect<T: Trait>() -> T {
      |                   ----- required by this bound in `error_mismatch::collect`
      = note: cannot satisfy `_: error_mismatch::Trait`
    help: consider specifying the type argument in the function call
      |
    4 |     let _ = collect::<T>();
      |                    ^^^^^
    

  4. estebank commented on May 5, 2020

    @estebank
    Contributor

    I think that is correct @mibac138.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions