We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0ca92de commit d9170dcCopy full SHA for d9170dc
tests/ui/mismatched_types/transforming-option-ref-issue-127545.rs
@@ -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
+}
tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/transforming-option-ref-issue-127545.rs:5:5
+ |
+LL | pub fn foo(arg: Option<&Vec<i32>>) -> Option<&[i32]> {
+ | -------------- expected `Option<&[i32]>` because of return type
+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