From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/borrowck/mutability-errors.rs | 82 ------------------------------- 1 file changed, 82 deletions(-) delete mode 100644 src/test/ui/borrowck/mutability-errors.rs (limited to 'src/test/ui/borrowck/mutability-errors.rs') diff --git a/src/test/ui/borrowck/mutability-errors.rs b/src/test/ui/borrowck/mutability-errors.rs deleted file mode 100644 index 5be0df137..000000000 --- a/src/test/ui/borrowck/mutability-errors.rs +++ /dev/null @@ -1,82 +0,0 @@ -// All the possible mutability error cases. - -#![allow(unused)] - -type MakeRef = fn() -> &'static (i32,); -type MakePtr = fn() -> *const (i32,); - -fn named_ref(x: &(i32,)) { - *x = (1,); //~ ERROR - x.0 = 1; //~ ERROR - &mut *x; //~ ERROR - &mut x.0; //~ ERROR -} - -fn unnamed_ref(f: MakeRef) { - *f() = (1,); //~ ERROR - f().0 = 1; //~ ERROR - &mut *f(); //~ ERROR - &mut f().0; //~ ERROR -} - -unsafe fn named_ptr(x: *const (i32,)) { - *x = (1,); //~ ERROR - (*x).0 = 1; //~ ERROR - &mut *x; //~ ERROR - &mut (*x).0; //~ ERROR -} - -unsafe fn unnamed_ptr(f: MakePtr) { - *f() = (1,); //~ ERROR - (*f()).0 = 1; //~ ERROR - &mut *f(); //~ ERROR - &mut (*f()).0; //~ ERROR -} - -fn fn_ref(f: F) -> F { f } - -fn ref_closure(mut x: (i32,)) { - fn_ref(|| { - x = (1,); //~ ERROR - x.0 = 1; //~ ERROR - &mut x; //~ ERROR - &mut x.0; //~ ERROR - }); - fn_ref(move || { - x = (1,); //~ ERROR - x.0 = 1; //~ ERROR - &mut x; //~ ERROR - &mut x.0; //~ ERROR - }); -} - -fn imm_local(x: (i32,)) { - &mut x; //~ ERROR - &mut x.0; //~ ERROR -} - -fn imm_capture(x: (i32,)) { - || { - x = (1,); //~ ERROR - x.0 = 1; //~ ERROR - &mut x; //~ ERROR - &mut x.0; //~ ERROR - }; - move || { - x = (1,); //~ ERROR - x.0 = 1; //~ ERROR - &mut x; //~ ERROR - &mut x.0; //~ ERROR - }; -} - -static X: (i32,) = (0,); - -fn imm_static() { - X = (1,); //~ ERROR - X.0 = 1; //~ ERROR - &mut X; //~ ERROR - &mut X.0; //~ ERROR -} - -fn main() {} -- cgit v1.2.3