|
| 1 | +error[E0308]: mismatched types |
| 2 | + --> $DIR/issue-100605.rs:4:18 |
| 3 | + | |
| 4 | +LL | takes_option(&None); |
| 5 | + | ------------ ^^^^^ expected enum `Option`, found `&Option<_>` |
| 6 | + | | |
| 7 | + | arguments to this function are incorrect |
| 8 | + | |
| 9 | + = note: expected enum `Option<&String>` |
| 10 | + found reference `&Option<_>` |
| 11 | +note: function defined here |
| 12 | + --> $DIR/issue-100605.rs:1:4 |
| 13 | + | |
| 14 | +LL | fn takes_option(_arg: Option<&String>) {} |
| 15 | + | ^^^^^^^^^^^^ --------------------- |
| 16 | +help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()` |
| 17 | + | |
| 18 | +LL | takes_option(None.as_ref()); |
| 19 | + | ~~~~~~~~~~~~~ |
| 20 | +help: consider removing the borrow |
| 21 | + | |
| 22 | +LL - takes_option(&None); |
| 23 | +LL + takes_option(None); |
| 24 | + | |
| 25 | + |
| 26 | +error[E0308]: mismatched types |
| 27 | + --> $DIR/issue-100605.rs:8:18 |
| 28 | + | |
| 29 | +LL | takes_option(&res); |
| 30 | + | ------------ ^^^^ |
| 31 | + | | | |
| 32 | + | | expected enum `Option`, found `&Option<String>` |
| 33 | + | | help: you can convert from `&Option<T>` to `Option<&T>` using `.as_ref()`: `res.as_ref()` |
| 34 | + | arguments to this function are incorrect |
| 35 | + | |
| 36 | + = note: expected enum `Option<&String>` |
| 37 | + found reference `&Option<String>` |
| 38 | +note: function defined here |
| 39 | + --> $DIR/issue-100605.rs:1:4 |
| 40 | + | |
| 41 | +LL | fn takes_option(_arg: Option<&String>) {} |
| 42 | + | ^^^^^^^^^^^^ --------------------- |
| 43 | + |
| 44 | +error: aborting due to 2 previous errors |
| 45 | + |
| 46 | +For more information about this error, try `rustc --explain E0308`. |
0 commit comments