Stop using the const_eval query for initializers of statics

As a side effect, we now represent most promoteds as `ConstValue::Scalar` again. This is useful because all implict promoteds are just references anyway and most explicit promoteds are numeric arguments to `asm!` or SIMD instructions.
This commit is contained in:
Oliver Scherer
2020-07-31 13:27:54 +02:00
parent 083f1d7a37
commit 2d7ac728e4
17 changed files with 53 additions and 108 deletions

View File

@@ -631,14 +631,11 @@ pub fn write_allocations<'tcx>(
None => write!(w, " (deallocated)")?,
Some(GlobalAlloc::Function(inst)) => write!(w, " (fn: {})", inst)?,
Some(GlobalAlloc::Static(did)) if !tcx.is_foreign_item(did) => {
match tcx.const_eval_poly(did) {
Ok(ConstValue::ByRef { alloc, .. }) => {
match tcx.eval_static_initializer(did) {
Ok(alloc) => {
write!(w, " (static: {}, ", tcx.def_path_str(did))?;
write_allocation_track_relocs(w, alloc)?;
}
Ok(_) => {
span_bug!(tcx.def_span(did), " static item without `ByRef` initializer")
}
Err(_) => write!(
w,
" (static: {}, error during initializer evaluation)",