Skip to content

Commit 6049650

Browse files
committed
avoid computing precise span for const_eval query
1 parent 32b01c7 commit 6049650

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/librustc_mir/interpret/eval_context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
860860
} else {
861861
self.param_env
862862
};
863-
let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.cur_span()))?;
863+
let val = self.tcx.const_eval_global_id(param_env, gid, Some(self.root_span))?;
864864

865865
// Even though `ecx.const_eval` is called from `eval_const_to_op` we can never have a
866866
// recursion deeper than one level, because the `tcx.const_eval` above is guaranteed to not

src/test/ui/consts/const-size_of-cycle.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ LL | bytes: [u8; std::mem::size_of::<Foo>()]
1717
note: ...which requires const-evaluating `std::mem::size_of`...
1818
--> $SRC_DIR/libcore/mem/mod.rs:LL:COL
1919
|
20-
LL | intrinsics::size_of::<T>()
21-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
20+
LL | pub const fn size_of<T>() -> usize {
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2222
note: ...which requires const-evaluating + checking `std::intrinsics::size_of`...
2323
--> $SRC_DIR/libcore/intrinsics.rs:LL:COL
2424
|

0 commit comments

Comments
 (0)