]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #37442 - estebank:cast-deref-hint, r=jonathandturner
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)
committerGitHub <noreply@github.com>
Wed, 23 Nov 2016 11:18:09 +0000 (12:18 +0100)
commit464cce99f1fe09db35d56ca07ae4c05f591eb651
treef4e030f5660d678509d4ba5c44d8824c8e1ca259
parentccdc26fd42dfccc5832114baa275f0936738095a
parentec24442e60bce2605a64ac3aef5784510e4a5fd5
Rollup merge of #37442 - estebank:cast-deref-hint, r=jonathandturner

Provide hint when cast needs a dereference

For a given code:

``` rust
vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
```

display:

``` nocode
error: casting `&f64` as `i16` is invalid
 --> file3.rs:2:35
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect::<Vec<i16>>();
  |                              -    ^^^
  |                              |
  |                              did you mean `*s`?
```

instead of:

``` nocode
error: casting `&f64` as `i16` is invalid
 --> <anon>:2:30
  |
2 |     vec![0.0].iter().map(|s| s as i16).collect();
  |                              ^^^^^^^^
  |
  = help: cast through a raw pointer first
```

Fixes #37338.