Skip to content

Commit d9170dc

Browse files
committed
Add regression test for issue 127545
1 parent 0ca92de commit d9170dc

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff 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 numberDiff line numberDiff 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<i32>>) -> Option<&[i32]> {
5+
| -------------- expected `Option<&[i32]>` because of return type
6+
LL | arg
7+
| ^^^ expected `Option<&[i32]>`, found `Option<&Vec<i32>>`
8+
|
9+
= note: expected enum `Option<&[i32]>`
10+
found enum `Option<&Vec<i32>>`
11+
12+
error: aborting due to 1 previous error
13+
14+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)