Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions src/librustc_mir/transform/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
*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) => {
Expand All @@ -689,10 +684,11 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {

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>> {
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/mir/issue-67710-inline-projection.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// 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(());
}