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

Suggest correct cast for struct fields with shorthand syntax #57769

Merged
merged 2 commits into from Jan 21, 2019

Conversation

Projects
None yet
4 participants
@estebank
Copy link
Contributor

estebank commented Jan 20, 2019

error[E0308]: mismatched types
  --> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
   |
LL |     let _ = RGB { r, g, b };
   |                   ^ expected f64, found f32
help: you can cast an `f32` to `f64` in a lossless way
   |
LL |     let _ = RGB { r: r.into(), g, b };
   |                   ^^^^^^^^^^^

Fix #52497.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Jan 20, 2019

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@matthewjasper

This comment has been minimized.

Copy link
Contributor

matthewjasper commented Jan 20, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Jan 20, 2019

📌 Commit 5b44b3c has been approved by matthewjasper

Centril added a commit to Centril/rust that referenced this pull request Jan 21, 2019

Rollup merge of rust-lang#57769 - estebank:cast-suggestion-struct-fie…
…ld, r=matthewjasper

Suggest correct cast for struct fields with shorthand syntax

```
error[E0308]: mismatched types
  --> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
   |
LL |     let _ = RGB { r, g, b };
   |                   ^ expected f64, found f32
help: you can cast an `f32` to `f64` in a lossless way
   |
LL |     let _ = RGB { r: r.into(), g, b };
   |                   ^^^^^^^^^^^
```

Fix rust-lang#52497.

bors added a commit that referenced this pull request Jan 21, 2019

Auto merge of #57792 - Centril:rollup, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #56796 (Change bounds on `TryFrom` blanket impl to use `Into` instead of `From`)
 - #57768 (Continue parsing after parent type args and suggest using angle brackets)
 - #57769 (Suggest correct cast for struct fields with shorthand syntax)
 - #57783 (Add "dereference boxed value" suggestion.)
 - #57784 (Add span for bad doc comment)

Failed merges:

r? @ghost

@bors bors merged commit 5b44b3c into rust-lang:master Jan 21, 2019

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