-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for issue 127545
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
tests/ui/mismatched_types/transforming-option-ref-issue-127545.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/ui/mismatched_types/transforming-option-ref-issue-127545.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`. |