Add regression test for issue 127545 · rust-lang/rust@d9170dc (original) (raw)
File tree
2 files changed
lines changed
- tests/ui/mismatched_types
2 files changed
lines changed
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 1 | +// Regression test for https://github.com/rust-lang/rust/issues/127545. | |
| 2 | +#![crate_type = "lib"] | |
| 3 | + | |
| 4 | +pub fn foo(arg: Option<&Vec<i32>>) -> Option<&[i32]> { | |
| 5 | + arg //~ ERROR 5:5: 5:8: mismatched types [E0308] | |
| 6 | +} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| 1 | +error[E0308]: mismatched types | |
| 2 | + --> $DIR/transforming-option-ref-issue-127545.rs:5:5 | |
| 3 | + | | |
| 4 | +LL | pub fn foo(arg: Option<&Vec>) -> Option<&[i32]> { | |
| 5 | + | -------------- expected `Option<&[i32]>` because of return type | |
| 6 | +LL | arg | |
| 7 | + | ^^^ expected `Option<&[i32]>`, found `Option<&Vec>` | |
| 8 | + | | |
| 9 | + = note: expected enum `Option<&[i32]>` | |
| 10 | + found enum `Option<&Vec>` | |
| 11 | + | |
| 12 | +error: aborting due to 1 previous error | |
| 13 | + | |
| 14 | +For more information about this error, try `rustc --explain E0308`. |