未验证 提交 09c7a9be 编写于 作者: Y Yuki Okushi 提交者: GitHub

Rollup merge of #67796 - Aaron1011:fix/mir-inline-proj, r=wesleywiser

Ensure that we process projections during MIR inlining

Fixes #67710

Previously, we were not calling `super_place`, which resulted in us
failing to update any local references that occur in
ProjectionElem::Index. This caused the post-inlining MIR to contain a
reference to a local ID from the inlined callee, leading to an ICE
due to a type mismatch.
......@@ -671,12 +671,7 @@ fn visit_local(&mut self, local: &mut Local, _ctxt: PlaceContext, _location: Loc
*local = self.make_integrate_local(local);
}
fn visit_place(
&mut self,
place: &mut Place<'tcx>,
_context: PlaceContext,
_location: Location,
) {
fn visit_place(&mut self, place: &mut Place<'tcx>, context: PlaceContext, location: Location) {
match &mut place.base {
PlaceBase::Static(_) => {}
PlaceBase::Local(l) => {
......@@ -689,10 +684,11 @@ fn visit_place(
place.projection = self.tcx.intern_place_elems(&*projs);
}
*l = self.make_integrate_local(l);
}
}
// Handles integrating any locals that occur in the base
// or projections
self.super_place(place, context, location)
}
fn process_projection_elem(&mut self, elem: &PlaceElem<'tcx>) -> Option<PlaceElem<'tcx>> {
......
// compile-flags: -Z mir-opt-level=2
// build-pass
// This used to ICE due to the inling pass not examining projections
// for references to locals
pub fn parse(version: ()) {
p(&b'.', b"0");
}
#[inline(always)]
fn p(byte: &u8, s: &[u8]) {
!(s[0] == *byte);
}
fn main() {
parse(());
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册