diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index 3244c237b47..87af90d059b 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -962,10 +962,6 @@ rustc_queries! { desc { "converting literal to const" } } - query lit_to_constant(key: LitToConstInput<'tcx>) -> Result, LitToConstError> { - desc { "converting literal to mir constant"} - } - query check_match(key: DefId) { desc { |tcx| "match-checking `{}`", tcx.def_path_str(key) } cache_on_disk_if { key.is_local() } diff --git a/compiler/rustc_mir_build/src/build/expr/as_constant.rs b/compiler/rustc_mir_build/src/build/expr/as_constant.rs index f83b974437e..6856ded3498 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_constant.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_constant.rs @@ -31,17 +31,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { this.as_constant(&this.thir[value]) } ExprKind::Literal { lit, neg } => { - let literal = match tcx.at(expr.span).lit_to_constant(LitToConstInput { - lit: &lit.node, - ty, - neg, - }) { - Ok(c) => c, - Err(LitToConstError::Reported) => ConstantKind::Ty(tcx.const_error(ty)), - Err(LitToConstError::TypeError) => { - bug!("encountered type error in `lit_to_constant") - } - }; + let literal = + match lit_to_constant(tcx, LitToConstInput { lit: &lit.node, ty, neg }) { + Ok(c) => c, + Err(LitToConstError::Reported) => ConstantKind::Ty(tcx.const_error(ty)), + Err(LitToConstError::TypeError) => { + bug!("encountered type error in `lit_to_constant") + } + }; Constant { span, user_ty: None, literal: literal.into() } } diff --git a/compiler/rustc_mir_build/src/build/mod.rs b/compiler/rustc_mir_build/src/build/mod.rs index ed2d8179f9a..ab3dc8f020c 100644 --- a/compiler/rustc_mir_build/src/build/mod.rs +++ b/compiler/rustc_mir_build/src/build/mod.rs @@ -1078,5 +1078,4 @@ mod matches; mod misc; mod scope; -crate use expr::as_constant; pub(crate) use expr::category::Category as ExprCategory; diff --git a/compiler/rustc_mir_build/src/lib.rs b/compiler/rustc_mir_build/src/lib.rs index 5b9f3020556..6687e1160ed 100644 --- a/compiler/rustc_mir_build/src/lib.rs +++ b/compiler/rustc_mir_build/src/lib.rs @@ -27,7 +27,6 @@ use rustc_middle::ty::query::Providers; pub fn provide(providers: &mut Providers) { providers.check_match = thir::pattern::check_match; providers.lit_to_const = thir::constant::lit_to_const; - providers.lit_to_constant = build::as_constant::lit_to_constant; providers.mir_built = build::mir_built; providers.thir_check_unsafety = check_unsafety::thir_check_unsafety; providers.thir_check_unsafety_for_const_arg = check_unsafety::thir_check_unsafety_for_const_arg; diff --git a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs index 676f7ee53ec..490c04e7be2 100644 --- a/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs +++ b/compiler/rustc_trait_selection/src/traits/const_evaluatable.rs @@ -442,7 +442,7 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> { self.tcx.const_error(node.ty) } Err(LitToConstError::TypeError) => { - bug!("encountered type error in lit_to_constant") + bug!("encountered type error in lit_to_const") } };