-
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
Rename _ to {integer} and {float} for unknown numeric types #35080
Conversation
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
Keep in mind that integer and floating-point inference variables are different and sometimes it's helpful to tell them apart. |
@eddyb - agreed. I can change this to make that more explicit. Since being more explicit can also make types more cumbersome, I wanted to start simple. |
We could use {float} and {integer}... |
+1, this is a great change. I like having |
@nrc Small problem is with generics, e.g. |
219aeea
to
ea77049
Compare
r=me on the patch, do we want to solicit any more feedback? Or just run with it? (I'm happy either way) |
Should update the PR title and description to use |
@eddyb - done |
This is awesome, such a small fix and such a fundamental improvement. Why haven't this been done years ago? |
@bors r+ |
📌 Commit ea77049 has been approved by |
@bors: rollup assuming this isn't very platform-specific and green travis means it's good to go whenever |
…d_found, r=nikomatsakis Rename _ to {integer} and {float} for unknown numeric types This PR renames _ to {integer} or {float} for unknown numeric types, to help people parse error messages that have numeric types that haven't been nailed down. Example: ```rust fn main() { let x: String = 4; } ``` Before: ``` error[E0308]: mismatched types --> quicktest.rs:2:21 | 2 | let x: String = 4; | ^ expected struct `std::string::String`, found integral variable | = note: expected type `std::string::String` = note: found type `_` error: aborting due to previous error ``` after: ``` error[E0308]: mismatched types --> quicktest.rs:2:21 | 2 | let x: String = 4; | ^ expected struct `std::string::String`, found integral variable | = note: expected type `std::string::String` = note: found type `{integer}` error: aborting due to previous error ``` ```
…d_found, r=nikomatsakis Rename _ to {integer} and {float} for unknown numeric types This PR renames _ to {integer} or {float} for unknown numeric types, to help people parse error messages that have numeric types that haven't been nailed down. Example: ```rust fn main() { let x: String = 4; } ``` Before: ``` error[E0308]: mismatched types --> quicktest.rs:2:21 | 2 | let x: String = 4; | ^ expected struct `std::string::String`, found integral variable | = note: expected type `std::string::String` = note: found type `_` error: aborting due to previous error ``` after: ``` error[E0308]: mismatched types --> quicktest.rs:2:21 | 2 | let x: String = 4; | ^ expected struct `std::string::String`, found integral variable | = note: expected type `std::string::String` = note: found type `{integer}` error: aborting due to previous error ``` ```
This PR renames _ to {integer} or {float} for unknown numeric types, to help people parse error messages that have numeric types that haven't been nailed down.
Example:
Before:
after: