File tree Expand file tree Collapse file tree 6 files changed +10
-9
lines changed
src/test/ui/consts/const-eval Expand file tree Collapse file tree 6 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -1484,6 +1484,7 @@ impl<'tcx> LateLintPass<'tcx> for UnusedBrokenConst {
14841484 }
14851485 hir:: ItemKind :: Static ( _, _, body_id) => {
14861486 let def_id = cx. tcx . hir ( ) . body_owner_def_id ( body_id) . to_def_id ( ) ;
1487+ // FIXME: Use ensure here
14871488 let _ = cx. tcx . eval_static_initializer ( def_id) ;
14881489 }
14891490 _ => { }
Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ impl<'tcx> TyCtxt<'tcx> {
6969 // improve caching of queries.
7070 let inputs = self . erase_regions ( & param_env. and ( cid) ) ;
7171 if let Some ( span) = span {
72- self . at ( span) . eval_to_const_value ( inputs)
72+ self . at ( span) . eval_to_const_value_raw ( inputs)
7373 } else {
74- self . eval_to_const_value ( inputs)
74+ self . eval_to_const_value_raw ( inputs)
7575 }
7676 }
7777
Original file line number Diff line number Diff line change @@ -724,7 +724,7 @@ rustc_queries! {
724724 ///
725725 /// **Do not use this** directly, use one of the following wrappers: `tcx.const_eval_poly`,
726726 /// `tcx.const_eval_resolve`, `tcx.const_eval_instance`, or `tcx.const_eval_global_id`.
727- query eval_to_const_value ( key: ty:: ParamEnvAnd <' tcx, GlobalId <' tcx>>)
727+ query eval_to_const_value_raw ( key: ty:: ParamEnvAnd <' tcx, GlobalId <' tcx>>)
728728 -> EvalToConstValueResult <' tcx> {
729729 desc { |tcx|
730730 "simplifying constant for the type system `{}`" ,
Original file line number Diff line number Diff line change @@ -200,21 +200,21 @@ fn turn_into_const_value<'tcx>(
200200 ) ;
201201 assert ! (
202202 !is_static || cid. promoted. is_some( ) ,
203- "the `eval_to_const_value ` query should not be used for statics, use `eval_to_allocation` instead"
203+ "the `eval_to_const_value_raw ` query should not be used for statics, use `eval_to_allocation` instead"
204204 ) ;
205205 // Turn this into a proper constant.
206206 op_to_const ( & ecx, mplace. into ( ) )
207207}
208208
209- pub fn eval_to_const_value_provider < ' tcx > (
209+ pub fn eval_to_const_value_raw_provider < ' tcx > (
210210 tcx : TyCtxt < ' tcx > ,
211211 key : ty:: ParamEnvAnd < ' tcx , GlobalId < ' tcx > > ,
212212) -> :: rustc_middle:: mir:: interpret:: EvalToConstValueResult < ' tcx > {
213213 // see comment in const_eval_raw_provider for what we're doing here
214214 if key. param_env . reveal ( ) == Reveal :: All {
215215 let mut key = key;
216216 key. param_env = key. param_env . with_user_facing ( ) ;
217- match tcx. eval_to_const_value ( key) {
217+ match tcx. eval_to_const_value_raw ( key) {
218218 // try again with reveal all as requested
219219 Err ( ErrorHandled :: TooGeneric ) => { }
220220 // deduplicate calls
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ pub fn provide(providers: &mut Providers) {
5252 transform:: provide ( providers) ;
5353 monomorphize:: partitioning:: provide ( providers) ;
5454 monomorphize:: polymorphize:: provide ( providers) ;
55- providers. eval_to_const_value = const_eval:: eval_to_const_value_provider ;
55+ providers. eval_to_const_value_raw = const_eval:: eval_to_const_value_raw_provider ;
5656 providers. eval_to_allocation_raw = const_eval:: eval_to_allocation_raw_provider;
5757 providers. const_caller_location = const_eval:: const_caller_location;
5858 providers. destructure_const = |tcx, param_env_and_value| {
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ LL | let x: &'static i32 = &(1 / 0);
1010
1111query stack during panic:
1212#0 [eval_to_allocation_raw] const-evaluating + checking `main::promoted[1]`
13- #1 [eval_to_const_value ] simplifying constant for the type system `main::promoted[1]`
14- #2 [eval_to_const_value ] simplifying constant for the type system `main::promoted[1]`
13+ #1 [eval_to_const_value_raw ] simplifying constant for the type system `main::promoted[1]`
14+ #2 [eval_to_const_value_raw ] simplifying constant for the type system `main::promoted[1]`
1515#3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]`
1616#4 [optimized_mir] optimizing MIR for `main`
1717#5 [collect_and_partition_mono_items] collect_and_partition_mono_items
You can’t perform that action at this time.
0 commit comments