Skip to content

Commit

Permalink
Auto merge of rust-lang#86212 - pnkfelix:mainline-targetted-revert-81…
Browse files Browse the repository at this point in the history
…473-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 rust-lang#83171

The intent is to just address issue rust-lang#81658 on all release channels, rather that keep repeatedly reverting PR rust-lang#83171 on beta.

However, our intent is *also* to reland PR rust-lang#83171 after we have addressed issue rust-lang#81658 , most likely by coupling the re-landing of PR rust-lang#83171 with an enhancement like PR rust-lang#83004
  • Loading branch information
bors committed Jul 22, 2021
2 parents e742158 + ee2bb1f commit 0271870
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 120 deletions.
8 changes: 2 additions & 6 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ impl<'tcx> MarkSymbolVisitor<'tcx> {
}
}

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

#[allow(dead_code)] // FIXME(81658): should be used + lint reinstated after #83171 relands.
fn check_for_self_assign(&mut self, assign: &'tcx hir::Expr<'tcx>) {
fn check_for_self_assign_helper(
tcx: TyCtxt<'tcx>,
Expand Down Expand Up @@ -338,12 +340,6 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
hir::ExprKind::MethodCall(..) => {
self.lookup_and_handle_method(expr.hir_id);
}
hir::ExprKind::Assign(ref left, ref right, ..) => {
self.handle_assign(left);
self.check_for_self_assign(expr);
self.visit_expr(right);
return;
}
hir::ExprKind::Field(ref lhs, ..) => {
self.handle_field_access(&lhs, expr.hir_id);
}
Expand Down
1 change: 0 additions & 1 deletion src/test/ui/borrowck/borrowck-assign-to-subfield.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// run-pass
// pretty-expanded FIXME #23616
#![allow(dead_code)]

pub fn main() {
struct A {
Expand Down
2 changes: 2 additions & 0 deletions src/test/ui/lint/dead-code/self-assign.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Test that dead code warnings are issued for superfluous assignments of
// fields or variables to themselves (issue #75356).

// ignore-test FIXME(81658, 83171)

// check-pass
#![allow(unused_assignments)]
#![warn(dead_code)]
Expand Down
69 changes: 0 additions & 69 deletions src/test/ui/lint/dead-code/write-only-field.rs

This file was deleted.

44 changes: 0 additions & 44 deletions src/test/ui/lint/dead-code/write-only-field.stderr

This file was deleted.

0 comments on commit 0271870

Please sign in to comment.