diff options
| author | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-05-03 20:56:34 +0000 |
| commit | 88f19c6dab716c6281af7602e30f413e809c5974 (patch) | |
| tree | f7af4b32537043e9dfbdd884f811ee8fe0122d90 /src/test/ui/lint/dead-code/write-only-field.rs | |
| parent | 9a1dfd2dc5c42a2ee84b4606aa08cdadf8c0ee87 (diff) | |
| parent | 47c7b9c5788055ddbbb59d0d1fc909af7b48668d (diff) | |
| download | rust-1.52.0.tar.gz rust-1.52.0.zip | |
Auto merge of #84864 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.52.0
[stable] 1.52.0 release This includes the release notes (#84183) as well as cherry-picked commits from: * [beta] revert PR #77885 #84710 * [beta] remove assert_matches #84759 * Revert PR 81473 to resolve (on beta) issues 81626 and 81658. #83171 * [beta] rustdoc revert deref recur #84868 * Fix ICE of for-loop mut borrowck where no suggestions are available #83401 Additionally in "fresh work" we're also: * reverting: directly expose copy and copy_nonoverlapping intrinsics #81238 to avoid https://github.com/rust-lang/rust/issues/84297 on 1.52
Diffstat (limited to 'src/test/ui/lint/dead-code/write-only-field.rs')
| -rw-r--r-- | src/test/ui/lint/dead-code/write-only-field.rs | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/src/test/ui/lint/dead-code/write-only-field.rs b/src/test/ui/lint/dead-code/write-only-field.rs deleted file mode 100644 index 7b3f1e9f5b6..00000000000 --- a/src/test/ui/lint/dead-code/write-only-field.rs +++ /dev/null @@ -1,69 +0,0 @@ -#![deny(dead_code)] - -struct S { - f: i32, //~ ERROR: field is never read - sub: Sub, //~ ERROR: field is never read -} - -struct Sub { - f: i32, //~ ERROR: field is never read -} - -fn field_write(s: &mut S) { - s.f = 1; - s.sub.f = 2; -} - -fn main() { - let mut s = S { f: 0, sub: Sub { f: 0 } }; - field_write(&mut s); - - auto_deref(); - nested_boxes(); -} - -fn auto_deref() { - struct E { - x: bool, - y: bool, //~ ERROR: field is never read - } - - struct P<'a> { - e: &'a mut E - } - - impl P<'_> { - fn f(&mut self) { - self.e.x = true; - self.e.y = true; - } - } - - let mut e = E { x: false, y: false }; - let mut p = P { e: &mut e }; - p.f(); - assert!(e.x); -} - -fn nested_boxes() { - struct A { - b: Box<B>, - } - - struct B { - c: Box<C>, - } - - struct C { - u: u32, //~ ERROR: field is never read - v: u32, //~ ERROR: field is never read - } - - let mut a = A { - b: Box::new(B { - c: Box::new(C { u: 0, v: 0 }), - }), - }; - a.b.c.v = 10; - a.b.c = Box::new(C { u: 1, v: 2 }); -} |
