Skip to content

Commit 0271870

Browse files
committed
Auto merge of #86212 - pnkfelix:mainline-targetted-revert-81473-warn-write-only-fields, r=simulacrum
Revert PR 81473 to resolve (on mainline) issues 81626 and 81658. This is a nightly-targetted variant of PR #83171 The intent is to just address issue #81658 on all release channels, rather that keep repeatedly reverting PR #83171 on beta. However, our intent is *also* to reland PR #83171 after we have addressed issue #81658 , most likely by coupling the re-landing of PR #83171 with an enhancement like PR #83004
2 parents e742158 + ee2bb1f commit 0271870

File tree

5 files changed

+4
-120
lines changed

5 files changed

+4
-120
lines changed

compiler/rustc_passes/src/dead.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
134134
}
135135
}
136136

137+
#[allow(dead_code)] // FIXME(81658): should be used + lint reinstated after #83171 relands.
137138
fn handle_assign(&mut self, expr: &'tcx hir::Expr<'tcx>) {
138139
if self
139140
.typeck_results()
@@ -150,6 +151,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
150151
}
151152
}
152153

154+
#[allow(dead_code)] // FIXME(81658): should be used + lint reinstated after #83171 relands.
153155
fn check_for_self_assign(&mut self, assign: &'tcx hir::Expr<'tcx>) {
154156
fn check_for_self_assign_helper(
155157
tcx: TyCtxt<'tcx>,
@@ -338,12 +340,6 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
338340
hir::ExprKind::MethodCall(..) => {
339341
self.lookup_and_handle_method(expr.hir_id);
340342
}
341-
hir::ExprKind::Assign(ref left, ref right, ..) => {
342-
self.handle_assign(left);
343-
self.check_for_self_assign(expr);
344-
self.visit_expr(right);
345-
return;
346-
}
347343
hir::ExprKind::Field(ref lhs, ..) => {
348344
self.handle_field_access(&lhs, expr.hir_id);
349345
}

src/test/ui/borrowck/borrowck-assign-to-subfield.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// run-pass
22
// pretty-expanded FIXME #23616
3-
#![allow(dead_code)]
43

54
pub fn main() {
65
struct A {

src/test/ui/lint/dead-code/self-assign.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Test that dead code warnings are issued for superfluous assignments of
22
// fields or variables to themselves (issue #75356).
33

4+
// ignore-test FIXME(81658, 83171)
5+
46
// check-pass
57
#![allow(unused_assignments)]
68
#![warn(dead_code)]

src/test/ui/lint/dead-code/write-only-field.rs

-69
This file was deleted.

src/test/ui/lint/dead-code/write-only-field.stderr

-44
This file was deleted.

0 commit comments

Comments
 (0)