Return ConstAllocation from eval_static_initializer query directly
This commit is contained in:
parent
be6ccf13e3
commit
e2386270df
18 changed files with 53 additions and 82 deletions
|
@ -40,13 +40,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
const_eval::provide(providers);
|
||||
providers.eval_to_const_value_raw = const_eval::eval_to_const_value_raw_provider;
|
||||
providers.eval_to_allocation_raw = const_eval::eval_to_allocation_raw_provider;
|
||||
providers.eval_static_initializer_raw = |tcx, def_id| {
|
||||
assert!(tcx.is_static(def_id.to_def_id()));
|
||||
let instance = ty::Instance::mono(tcx, def_id.to_def_id());
|
||||
let gid = rustc_middle::mir::interpret::GlobalId { instance, promoted: None };
|
||||
let param_env = ty::ParamEnv::reveal_all();
|
||||
Ok(tcx.eval_to_allocation_raw(param_env.and(gid))?.alloc_id)
|
||||
};
|
||||
providers.eval_static_initializer = const_eval::eval_static_initializer_provider;
|
||||
providers.hooks.const_caller_location = util::caller_location::const_caller_location_provider;
|
||||
providers.eval_to_valtree = |tcx, param_env_and_value| {
|
||||
let (param_env, raw) = param_env_and_value.into_parts();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue