Skip to content

Commit

Permalink
Add regression test for issue 127545
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jul 11, 2024
1 parent 0ca92de commit d9170dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Regression test for <https://github.com/rust-lang/rust/issues/127545>.
#![crate_type = "lib"]

pub fn foo(arg: Option<&Vec<i32>>) -> Option<&[i32]> {
arg //~ ERROR 5:5: 5:8: mismatched types [E0308]
}
Original file line number Diff line number Diff line change
@@ -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
| ^^^ expected `Option<&[i32]>`, found `Option<&Vec<i32>>`
|
= note: expected enum `Option<&[i32]>`
found enum `Option<&Vec<i32>>`

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0308`.

0 comments on commit d9170dc

Please sign in to comment.