run const_eval_raw with root_span

This commit is contained in:
Ralf Jung 2020-06-13 13:55:01 +02:00
parent 60496504ac
commit c6512fd4e9
2 changed files with 5 additions and 5 deletions

View File

@ -891,7 +891,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
// FIXME: We can hit delay_span_bug if this is an invalid const, interning finds
// that problem, but we never run validation to show an error. Can we ensure
// this does not happen?
let val = self.tcx.at(self.cur_span()).const_eval_raw(param_env.and(gid))?;
let val = self.tcx_at().const_eval_raw(param_env.and(gid))?;
self.raw_const_to_mplace(val)
}

View File

@ -1,14 +1,14 @@
error[E0391]: cycle detected when const-evaluating `a`
--> $DIR/infinite-recursion-const-fn.rs:3:25
--> $DIR/infinite-recursion-const-fn.rs:3:1
|
LL | const fn a() -> usize { b() }
| ^^^
| ^^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires const-evaluating `b`...
--> $DIR/infinite-recursion-const-fn.rs:4:25
--> $DIR/infinite-recursion-const-fn.rs:4:1
|
LL | const fn b() -> usize { a() }
| ^^^
| ^^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating `a`, completing the cycle
note: cycle used when const-evaluating `ARR::{{constant}}#0`
--> $DIR/infinite-recursion-const-fn.rs:5:18