Skip to content

Rollup of 7 pull requests #67495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
db6d0b1
Check associated type implementations for generic mismatches
matthewjasper Dec 8, 2019
c5028f6
Resolve names in the generics of impl associated types
matthewjasper Dec 8, 2019
4b164f6
Correctly lower paths to generic associated types
matthewjasper Dec 8, 2019
6394032
Correctly lower bounds on GATs
matthewjasper Dec 8, 2019
cd3ead1
Use `delay_span_bug` less often
matthewjasper Dec 8, 2019
0a5c91c
Generate correct `Deref` predicate
matthewjasper Dec 9, 2019
2206218
Remove rustc-dev from the default nightly components
cuviper Dec 20, 2019
bec4fc1
[mir-opt] Fix `Inline` pass to handle inlining into `box` expressions
wesleywiser Dec 15, 2019
f1325a7
Move the rest of the mir-opt inline tests into a folder
wesleywiser Dec 15, 2019
c268798
Update tests for GATs
matthewjasper Dec 8, 2019
e7b8bfe
Fix rustdoc
matthewjasper Dec 8, 2019
28af652
Drop petgraph dependency from bootstrap
Mark-Simulacrum Dec 21, 2019
519fc84
Document privacy of RangeInclusive fields
Mark-Simulacrum Dec 21, 2019
c93198f
use _val to ignore parameter of any::type_name_of_val
tesuji Dec 21, 2019
f3d7e03
use Result::map_or for bootstrap
tesuji Dec 21, 2019
b50c3b7
Rollup merge of #67160 - matthewjasper:gat-generics, r=nikomatsakis
Centril Dec 21, 2019
ac6dbff
Rollup merge of #67333 - wesleywiser:fix_inline_into_box_place, r=oli…
Centril Dec 21, 2019
9fa2046
Rollup merge of #67420 - lzutao:_val, r=Centril
Centril Dec 21, 2019
b9a6d74
Rollup merge of #67469 - cuviper:no-default-rustc-dev, r=Mark-Simulacrum
Centril Dec 21, 2019
2135cc4
Rollup merge of #67489 - Mark-Simulacrum:drop-petgraph, r=Centril
Centril Dec 21, 2019
5a0f17e
Rollup merge of #67490 - Mark-Simulacrum:i-67371, r=Dylan-DPC
Centril Dec 21, 2019
7d29704
Rollup merge of #67491 - lzutao:res-map-or, r=Mark-Simulacrum
Centril Dec 21, 2019
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
30 changes: 20 additions & 10 deletions src/librustc_mir/transform/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ impl<'a, 'tcx> Integrator<'a, 'tcx> {

fn make_integrate_local(&self, local: &Local) -> Local {
if *local == RETURN_PLACE {
match self.destination.as_local() {
Some(l) => return l,
ref place => bug!("Return place is {:?}, not local", place),
match self.destination.base {
PlaceBase::Local(l) => return l,
PlaceBase::Static(ref s) => bug!("Return place is {:?}, not local", s),
}
}

Expand Down Expand Up @@ -695,14 +695,24 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Integrator<'a, 'tcx> {
fn visit_place(
&mut self,
place: &mut Place<'tcx>,
context: PlaceContext,
location: Location,
_context: PlaceContext,
_location: Location,
) {
if let Some(RETURN_PLACE) = place.as_local() {
// Return pointer; update the place itself
*place = self.destination.clone();
} else {
self.super_place(place, context, location);
match &mut place.base {
PlaceBase::Static(_) => {},
PlaceBase::Local(l) => {
// If this is the `RETURN_PLACE`, we need to rebase any projections onto it.
let dest_proj_len = self.destination.projection.len();
if *l == RETURN_PLACE && dest_proj_len > 0 {
let mut projs = Vec::with_capacity(dest_proj_len + place.projection.len());
projs.extend(self.destination.projection);
projs.extend(place.projection);

place.projection = self.tcx.intern_place_elems(&*projs);
}

*l = self.make_integrate_local(l);
}
}
}

Expand Down
71 changes: 71 additions & 0 deletions src/test/mir-opt/inline/inline-into-box-place.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// ignore-tidy-linelength
// ignore-wasm32-bare compiled with panic=abort by default
#![feature(box_syntax)]

fn main() {
let _x: Box<Vec<u32>> = box Vec::new();
}

// END RUST SOURCE
// START rustc.main.Inline.before.mir
// let mut _0: ();
// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] };
// let mut _2: std::boxed::Box<std::vec::Vec<u32>>;
// let mut _3: ();
// scope 1 {
// debug _x => _1;
// }
// bb0: {
// StorageLive(_1);
// StorageLive(_2);
// _2 = Box(std::vec::Vec<u32>);
// (*_2) = const std::vec::Vec::<u32>::new() -> [return: bb2, unwind: bb4];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// _1 = move _2;
// StorageDead(_2);
// _0 = ();
// drop(_1) -> [return: bb3, unwind: bb1];
// }
// bb3: {
// StorageDead(_1);
// return;
// }
// bb4 (cleanup): {
// _3 = const alloc::alloc::box_free::<std::vec::Vec<u32>>(move (_2.0: std::ptr::Unique<std::vec::Vec<u32>>)) -> bb1;
// }
// END rustc.main.Inline.before.mir
// START rustc.main.Inline.after.mir
// let mut _0: ();
// let _1: std::boxed::Box<std::vec::Vec<u32>> as UserTypeProjection { base: UserType(0), projs: [] };
// let mut _2: std::boxed::Box<std::vec::Vec<u32>>;
// let mut _3: ();
// let mut _4: &mut std::vec::Vec<u32>;
// scope 1 {
// debug _x => _1;
// }
// scope 2 {
// }
// bb0: {
// StorageLive(_1);
// StorageLive(_2);
// _2 = Box(std::vec::Vec<u32>);
// _4 = &mut (*_2);
// ((*_4).0: alloc::raw_vec::RawVec<u32>) = const alloc::raw_vec::RawVec::<u32>::NEW;
// ((*_4).1: usize) = const 0usize;
// _1 = move _2;
// StorageDead(_2);
// _0 = ();
// drop(_1) -> [return: bb2, unwind: bb1];
// }
// bb1 (cleanup): {
// resume;
// }
// bb2: {
// StorageDead(_1);
// return;
// }
// END rustc.main.Inline.after.mir