From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/suggestions/as-ref.rs | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 src/test/ui/suggestions/as-ref.rs (limited to 'src/test/ui/suggestions/as-ref.rs') diff --git a/src/test/ui/suggestions/as-ref.rs b/src/test/ui/suggestions/as-ref.rs deleted file mode 100644 index a05353441..000000000 --- a/src/test/ui/suggestions/as-ref.rs +++ /dev/null @@ -1,27 +0,0 @@ -struct Foo; - -fn takes_ref(_: &Foo) {} - -fn main() { - let ref opt = Some(Foo); - opt.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] - opt.and_then(|arg| Some(takes_ref(arg))); //~ ERROR mismatched types [E0308] - let ref opt: Result<_, ()> = Ok(Foo); - opt.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] - opt.and_then(|arg| Ok(takes_ref(arg))); //~ ERROR mismatched types [E0308] - let x: &Option = &Some(3); - let y: Option<&usize> = x; //~ ERROR mismatched types [E0308] - let x: &Result = &Ok(3); - let y: Result<&usize, &usize> = x; - //~^ ERROR mismatched types [E0308] - // note: do not suggest because of `E: usize` - let x: &Result = &Ok(3); - let y: Result<&usize, usize> = x; //~ ERROR mismatched types [E0308] - - let multiple_ref_opt = &&Some(Foo); - multiple_ref_opt.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] - multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); //~ ERROR mismatched types [E0308] - let multiple_ref_result = &&Ok(Foo); - multiple_ref_result.map(|arg| takes_ref(arg)); //~ ERROR mismatched types [E0308] - multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); //~ ERROR mismatched types [E0308] -} -- cgit v1.2.3