|
5 | 5 | use crate::thir::pattern::pat_from_hir; |
6 | 6 | use crate::thir::util::UserAnnotatedTyHelpers; |
7 | 7 |
|
8 | | -use rustc_ast as ast; |
9 | 8 | use rustc_data_structures::steal::Steal; |
10 | 9 | use rustc_errors::ErrorGuaranteed; |
11 | 10 | use rustc_hir as hir; |
12 | 11 | use rustc_hir::def_id::{DefId, LocalDefId}; |
13 | 12 | use rustc_hir::HirId; |
14 | 13 | use rustc_hir::Node; |
15 | 14 | use rustc_middle::middle::region; |
16 | | -use rustc_middle::mir::interpret::{LitToConstError, LitToConstInput}; |
17 | | -use rustc_middle::mir::ConstantKind; |
18 | 15 | use rustc_middle::thir::*; |
19 | | -use rustc_middle::ty::{self, RvalueScopes, Ty, TyCtxt}; |
| 16 | +use rustc_middle::ty::{self, RvalueScopes, TyCtxt}; |
20 | 17 | use rustc_span::Span; |
21 | 18 |
|
22 | 19 | pub(crate) fn thir_body<'tcx>( |
@@ -80,24 +77,6 @@ impl<'tcx> Cx<'tcx> { |
80 | 77 | } |
81 | 78 | } |
82 | 79 |
|
83 | | - #[instrument(skip(self), level = "debug")] |
84 | | - pub(crate) fn const_eval_literal( |
85 | | - &mut self, |
86 | | - lit: &'tcx ast::LitKind, |
87 | | - ty: Ty<'tcx>, |
88 | | - sp: Span, |
89 | | - neg: bool, |
90 | | - ) -> ConstantKind<'tcx> { |
91 | | - match self.tcx.at(sp).lit_to_mir_constant(LitToConstInput { lit, ty, neg }) { |
92 | | - Ok(c) => c, |
93 | | - Err(LitToConstError::Reported) => { |
94 | | - // create a dummy value and continue compiling |
95 | | - ConstantKind::Ty(self.tcx.const_error(ty)) |
96 | | - } |
97 | | - Err(LitToConstError::TypeError) => bug!("const_eval_literal: had type error"), |
98 | | - } |
99 | | - } |
100 | | - |
101 | 80 | #[tracing::instrument(level = "debug", skip(self))] |
102 | 81 | pub(crate) fn pattern_from_hir(&mut self, p: &hir::Pat<'_>) -> Pat<'tcx> { |
103 | 82 | let p = match self.tcx.hir().get(p.hir_id) { |
|
0 commit comments