提交 c6512fd4 编写于 作者: R Ralf Jung

run const_eval_raw with root_span

上级 60496504
......@@ -891,7 +891,7 @@ pub fn const_eval_raw(
// 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)
}
......
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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册