提交 fd77500e 编写于 作者: O Oliver Scherer

Clear up nonpromotable const fn call qualification

上级 ee7f4a27
......@@ -1000,11 +1000,7 @@ fn visit_terminator_kind(&mut self,
}
// non-const fn calls.
if is_const_fn {
if !is_promotable_const_fn && self.mode == Mode::Fn {
self.qualif = Qualif::NOT_PROMOTABLE;
}
} else {
if !is_const_fn {
self.qualif = Qualif::NOT_CONST;
if self.mode != Mode::Fn {
self.tcx.sess.delay_span_bug(
......@@ -1022,6 +1018,11 @@ fn visit_terminator_kind(&mut self,
// Be conservative about the returned value of a const fn.
let tcx = self.tcx;
let ty = dest.ty(self.mir, tcx).to_ty(tcx);
if is_const_fn && !is_promotable_const_fn && self.mode == Mode::Fn {
self.qualif = Qualif::NOT_PROMOTABLE;
} else {
self.qualif = Qualif::empty();
}
self.add_type(ty);
}
self.assign(dest, location);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册