summaryrefslogtreecommitdiffstats
path: root/tests/ui/typeck/issue-89856.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/typeck/issue-89856.rs')
-rw-r--r--tests/ui/typeck/issue-89856.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/ui/typeck/issue-89856.rs b/tests/ui/typeck/issue-89856.rs
index b021e349e..cfe6e19b3 100644
--- a/tests/ui/typeck/issue-89856.rs
+++ b/tests/ui/typeck/issue-89856.rs
@@ -1,8 +1,18 @@
-fn take_str_maybe(x: Option<&str>) -> Option<&str> { None }
+// run-rustfix
+fn take_str_maybe(_: Option<&str>) { }
fn main() {
let string = String::from("Hello, world");
- let option = Some(&string);
+
+ let option: Option<String> = Some(string.clone());
take_str_maybe(option);
//~^ ERROR: mismatched types [E0308]
+
+ let option_ref = Some(&string);
+ take_str_maybe(option_ref);
+ //~^ ERROR: mismatched types [E0308]
+
+ let option_ref_ref = option_ref.as_ref();
+ take_str_maybe(option_ref_ref);
+ //~^ ERROR: mismatched types [E0308]
}