Skip to content

Revert PR 81473 to resolve (on mainline) issues 81626 and 81658. #86212

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
@@ -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()
@@ -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>,
@@ -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);
}
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 {
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)]
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.