From d5a13e2ca0c45a7f25d783cc94e447246cb97afd Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 9 Jun 2022 09:08:04 +1000 Subject: [PATCH] Remove dead code from `compare_const_vals`. It's never executed when running the entire test suite. I think it's because of the early return at the top of the function if `a.ty() != ty` succeeds. --- compiler/rustc_mir_build/src/thir/pattern/mod.rs | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/mod.rs b/compiler/rustc_mir_build/src/thir/pattern/mod.rs index f5d957e30ff0..1c35e402a99e 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/mod.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/mod.rs @@ -15,7 +15,6 @@ use rustc_hir::def::{CtorOf, DefKind, Res}; use rustc_hir::pat_util::EnumerateAndAdjustIterator; use rustc_hir::RangeEnd; use rustc_index::vec::Idx; -use rustc_middle::mir::interpret::{get_slice_bytes, ConstValue}; use rustc_middle::mir::interpret::{ErrorHandled, LitToConstError, LitToConstInput}; use rustc_middle::mir::{self, UserTypeProjection}; use rustc_middle::mir::{BorrowKind, Field, Mutability}; @@ -795,15 +794,5 @@ pub(crate) fn compare_const_vals<'tcx>( }; } - if let ty::Str = ty.kind() && let ( - Some(a_val @ ConstValue::Slice { .. }), - Some(b_val @ ConstValue::Slice { .. }), - ) = (a.try_to_value(tcx), b.try_to_value(tcx)) - { - let a_bytes = get_slice_bytes(&tcx, a_val); - let b_bytes = get_slice_bytes(&tcx, b_val); - return from_bool(a_bytes == b_bytes); - } - fallback() }