Skip to content

Commit

Permalink
Auto merge of rust-lang#83171 - pnkfelix:revert-81473-warn-write-only…
Browse files Browse the repository at this point in the history
…-fields, r=Mark-Simulacrum

Revert PR 81473 to resolve (on beta) issues 81626 and 81658.

Revert PR rust-lang#81473 to resolve (on beta) issues rust-lang#81626 and rust-lang#81658.

Revert "Add missing brace"

This reverts commit 85ad773.

Revert "Simplify base_expr"

This reverts commit 899aae4.

Revert "Warn write-only fields"

This reverts commit d3c69a4.
  • Loading branch information
bors committed Mar 18, 2021
2 parents 80eddb9 + 71e57ad commit 73f48e5
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 62 deletions.
15 changes: 0 additions & 15 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ fn should_explore(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> bool {
)
}

fn base_expr<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
loop {
match expr.kind {
hir::ExprKind::Field(base, ..) => expr = base,
_ => return expr,
}
}
}

struct MarkSymbolVisitor<'tcx> {
worklist: Vec<hir::HirId>,
tcx: TyCtxt<'tcx>,
Expand Down Expand Up @@ -272,12 +263,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, ..) => {
// Ignore write to field
self.visit_expr(base_expr(left));
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
20 changes: 0 additions & 20 deletions src/test/ui/lint/dead-code/write-only-field.rs

This file was deleted.

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

This file was deleted.

0 comments on commit 73f48e5

Please sign in to comment.