File tree 6 files changed +10
-9
lines changed
src/test/ui/consts/const-eval
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 {
1484
1484
}
1485
1485
hir:: ItemKind :: Static ( _, _, body_id) => {
1486
1486
let def_id = cx. tcx . hir ( ) . body_owner_def_id ( body_id) . to_def_id ( ) ;
1487
+ // FIXME: Use ensure here
1487
1488
let _ = cx. tcx . eval_static_initializer ( def_id) ;
1488
1489
}
1489
1490
_ => { }
Original file line number Diff line number Diff line change @@ -69,9 +69,9 @@ impl<'tcx> TyCtxt<'tcx> {
69
69
// improve caching of queries.
70
70
let inputs = self . erase_regions ( & param_env. and ( cid) ) ;
71
71
if let Some ( span) = span {
72
- self . at ( span) . eval_to_const_value ( inputs)
72
+ self . at ( span) . eval_to_const_value_raw ( inputs)
73
73
} else {
74
- self . eval_to_const_value ( inputs)
74
+ self . eval_to_const_value_raw ( inputs)
75
75
}
76
76
}
77
77
Original file line number Diff line number Diff line change @@ -724,7 +724,7 @@ rustc_queries! {
724
724
///
725
725
/// **Do not use this** directly, use one of the following wrappers: `tcx.const_eval_poly`,
726
726
/// `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>>)
728
728
-> EvalToConstValueResult <' tcx> {
729
729
desc { |tcx|
730
730
"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>(
200
200
) ;
201
201
assert ! (
202
202
!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"
204
204
) ;
205
205
// Turn this into a proper constant.
206
206
op_to_const ( & ecx, mplace. into ( ) )
207
207
}
208
208
209
- pub fn eval_to_const_value_provider < ' tcx > (
209
+ pub fn eval_to_const_value_raw_provider < ' tcx > (
210
210
tcx : TyCtxt < ' tcx > ,
211
211
key : ty:: ParamEnvAnd < ' tcx , GlobalId < ' tcx > > ,
212
212
) -> :: rustc_middle:: mir:: interpret:: EvalToConstValueResult < ' tcx > {
213
213
// see comment in const_eval_raw_provider for what we're doing here
214
214
if key. param_env . reveal ( ) == Reveal :: All {
215
215
let mut key = key;
216
216
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) {
218
218
// try again with reveal all as requested
219
219
Err ( ErrorHandled :: TooGeneric ) => { }
220
220
// deduplicate calls
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ pub fn provide(providers: &mut Providers) {
52
52
transform:: provide ( providers) ;
53
53
monomorphize:: partitioning:: provide ( providers) ;
54
54
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 ;
56
56
providers. eval_to_allocation_raw = const_eval:: eval_to_allocation_raw_provider;
57
57
providers. const_caller_location = const_eval:: const_caller_location;
58
58
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);
10
10
11
11
query stack during panic:
12
12
#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]`
15
15
#3 [normalize_generic_arg_after_erasing_regions] normalizing `main::promoted[1]`
16
16
#4 [optimized_mir] optimizing MIR for `main`
17
17
#5 [collect_and_partition_mono_items] collect_and_partition_mono_items
You can’t perform that action at this time.
0 commit comments