avoid computing precise span for const_eval query

This commit is contained in:
Ralf Jung 2020-06-13 13:47:37 +02:00
parent 32b01c78d0
commit 60496504ac
2 changed files with 3 additions and 3 deletions

View File

@ -860,7 +860,7 @@ pub(super) fn const_eval(
} else {
self.param_env
};
let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.cur_span()))?;
let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.root_span))?;
// Even though `ecx.const_eval` is called from `eval_const_to_op` we can never have a
// recursion deeper than one level, because the `tcx.const_eval` above is guaranteed to not

View File

@ -17,8 +17,8 @@ LL | bytes: [u8; std::mem::size_of::<Foo>()]
note: ...which requires const-evaluating `std::mem::size_of`...
--> $SRC_DIR/libcore/mem/mod.rs:LL:COL
|
LL | intrinsics::size_of::<T>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | pub const fn size_of<T>() -> usize {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which requires const-evaluating + checking `std::intrinsics::size_of`...
--> $SRC_DIR/libcore/intrinsics.rs:LL:COL
|