Skip to content

new-school type mismatch label can be overly long #34905

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
arielb1 opened this issue Jul 18, 2016 · 2 comments
Closed

new-school type mismatch label can be overly long #34905

arielb1 opened this issue Jul 18, 2016 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arielb1
Copy link
Contributor

arielb1 commented Jul 18, 2016

Meta

$ rustc -V
rustc 1.12.0-dev (d5b9850d7 2016-07-16)

STR

fn main() {
    let y = Some(Err(()));
    let x: Option<Option<_>> = y;
}

Result

$ RUST_NEW_ERROR_FORMAT=y rustc fail.rs
error: mismatched types [--explain E0308]
 --> fail.rs:3:32
  |>
3 |>     let x: Option<Option<_>> = y;
  |>                                ^ expected enum `std::option::Option`, found enum `std::result::Result`
note: expected type `std::option::Option<std::option::Option<_>>`
note:    found type `std::option::Option<std::result::Result<_, ()>>`
error: aborting due to previous error

Observe the deeply nested label containing both "expected" and "found".

@arielb1 arielb1 added the A-diagnostics Area: Messages for errors, warnings, and lints label Jul 18, 2016
@steveklabnik steveklabnik removed the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 9, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-enhancement Category: An issue proposing an enhancement or a PR with one. label Jul 25, 2017
@estebank
Copy link
Contributor

Re: #21934, #43354 & #40186.

@crlf0710 crlf0710 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 11, 2020
@estebank
Copy link
Contributor

estebank commented Jun 8, 2022

Current output:

error[E0308]: mismatched types
 --> src/main.rs:5:32
  |
5 |     let x: Option<Option<_>> = y;
  |            -----------------   ^ expected enum `Option`, found enum `Result`
  |            |
  |            expected due to this
  |
  = note: expected enum `Option<Option<_>>`
             found enum `Option<Result<_, ()>>`
help: try wrapping the expression in `Some`
  |
5 |     let x: Option<Option<_>> = Some(y);
  |                                +++++ +

I believe that the other open tickets linked above are better for tracking the outstanding work needed to improve these errors.

@estebank estebank closed this as completed Jun 8, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-enhancement Category: An issue proposing an enhancement or a PR with one. 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

5 participants