1
Fork 0

rebase and remove dead code

This commit is contained in:
b-naber 2022-04-02 12:17:07 +02:00
parent 9b28d3b494
commit 14e3d038c0
7 changed files with 4 additions and 234 deletions

View file

@ -5,7 +5,6 @@
use crate::thir::pattern::pat_from_hir;
use crate::thir::util::UserAnnotatedTyHelpers;
use rustc_ast::ast;
use rustc_data_structures::steal::Steal;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
@ -13,10 +12,8 @@ use rustc_hir::def_id::{DefId, LocalDefId};
use rustc_hir::HirId;
use rustc_hir::Node;
use rustc_middle::middle::region;
use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput};
use rustc_middle::mir::ConstantKind;
use rustc_middle::thir::*;
use rustc_middle::ty::{self, Ty, TyCtxt};
use rustc_middle::ty::{self, TyCtxt};
use rustc_span::Span;
crate fn thir_body<'tcx>(
@ -78,24 +75,6 @@ impl<'tcx> Cx<'tcx> {
}
}
#[instrument(skip(self), level = "debug")]
crate fn const_eval_literal(
&mut self,
lit: &'tcx ast::LitKind,
ty: Ty<'tcx>,
sp: Span,
neg: bool,
) -> ConstantKind<'tcx> {
match self.tcx.at(sp).lit_to_mir_constant(LitToConstInput { lit, ty, neg }) {
Ok(c) => c,
Err(LitToConstError::Reported) => {
// create a dummy value and continue compiling
ConstantKind::Ty(self.tcx.const_error(ty))
}
Err(LitToConstError::TypeError) => bug!("const_eval_literal: had type error"),
}
}
crate fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Pat<'tcx> {
let p = match self.tcx.hir().get(p.hir_id) {
Node::Pat(p) | Node::Binding(p) => p,

View file

@ -739,7 +739,6 @@ impl<'tcx> PatternFoldable<'tcx> for PatKind<'tcx> {
}
}
// FIXME: Get rid of this function once valtrees land
#[instrument(skip(tcx), level = "debug")]
crate fn compare_const_vals<'tcx>(
tcx: TyCtxt<'tcx>,
@ -759,8 +758,7 @@ crate fn compare_const_vals<'tcx>(
// Early return for equal constants (so e.g. references to ZSTs can be compared, even if they
// are just integer addresses).
// FIXME This might be wrong
if a == b {
if a.val() == b.val() {
return from_bool(true);
}