Skip to content

Commit ce316ea

Browse files
committed
just a rebase, things will still fail
1 parent 71e0978 commit ce316ea

File tree

4 files changed

+53
-135
lines changed

4 files changed

+53
-135
lines changed

src/librustc_middle/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ pub type PlaceElem<'tcx> = ProjectionElem<Local, Ty<'tcx>>;
15831583

15841584
// At least on 64 bit systems, `PlaceElem` should not be larger than two pointers.
15851585
#[cfg(target_arch = "x86_64")]
1586-
static_assert_size!(PlaceElem<'_>, 16);
1586+
static_assert_size!(PlaceElem<'_>, 24);
15871587

15881588
/// Alias for projections as they appear in `UserTypeProjection`, where we
15891589
/// need neither the `V` parameter for `Index` nor the `T` for `Field`.
@@ -2297,7 +2297,7 @@ impl<'tcx> UserTypeProjections {
22972297
self.map_projections(|pat_ty_proj| pat_ty_proj.index())
22982298
}
22992299

2300-
pub fn subslice(self, from: u32, to: u32) -> Self {
2300+
pub fn subslice(self, from: u64, to: u64) -> Self {
23012301
self.map_projections(|pat_ty_proj| pat_ty_proj.subslice(from, to))
23022302
}
23032303

@@ -2343,7 +2343,7 @@ impl UserTypeProjection {
23432343
self
23442344
}
23452345

2346-
pub(crate) fn subslice(mut self, from: u32, to: u32) -> Self {
2346+
pub(crate) fn subslice(mut self, from: u64, to: u64) -> Self {
23472347
self.projs.push(ProjectionElem::Subslice { from, to, from_end: true });
23482348
self
23492349
}

src/librustc_mir/transform/elaborate_drops.rs

+32-33
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use crate::dataflow;
2-
use crate::dataflow::impls::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
32
use crate::dataflow::move_paths::{LookupResult, MoveData, MovePathIndex};
43
use crate::dataflow::on_lookup_result_bits;
54
use crate::dataflow::MoveDataParamEnv;
65
use crate::dataflow::{on_all_children_bits, on_all_drop_children_bits};
76
use crate::dataflow::{Analysis, ResultsCursor};
7+
use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
88
use crate::transform::{MirPass, MirSource};
99
use crate::util::elaborate_drops::{elaborate_drop, DropFlagState, Unwind};
1010
use crate::util::elaborate_drops::{DropElaborator, DropFlagMode, DropStyle};
@@ -48,7 +48,6 @@ impl<'tcx> MirPass<'tcx> for ElaborateDrops {
4848
.into_results_cursor(body);
4949

5050
let uninits = MaybeUninitializedPlaces::new(tcx, body, &env)
51-
.mark_inactive_variants_as_uninit()
5251
.into_engine(tcx, body, def_id)
5352
.dead_unwinds(&dead_unwinds)
5453
.iterate_to_fixpoint()
@@ -86,27 +85,27 @@ fn find_dead_unwinds<'tcx>(
8685
.iterate_to_fixpoint()
8786
.into_results_cursor(body);
8887
for (bb, bb_data) in body.basic_blocks().iter_enumerated() {
89-
let place = match bb_data.terminator().kind {
90-
TerminatorKind::Drop { ref place, unwind: Some(_), .. }
91-
| TerminatorKind::DropAndReplace { ref place, unwind: Some(_), .. } => place,
88+
let location = match bb_data.terminator().kind {
89+
TerminatorKind::Drop { ref location, unwind: Some(_), .. }
90+
| TerminatorKind::DropAndReplace { ref location, unwind: Some(_), .. } => location,
9291
_ => continue,
9392
};
9493

9594
debug!("find_dead_unwinds @ {:?}: {:?}", bb, bb_data);
9695

97-
let path = match env.move_data.rev_lookup.find(place.as_ref()) {
96+
let path = match env.move_data.rev_lookup.find(location.as_ref()) {
9897
LookupResult::Exact(e) => e,
9998
LookupResult::Parent(..) => {
10099
debug!("find_dead_unwinds: has parent; skipping");
101100
continue;
102101
}
103102
};
104103

105-
flow_inits.seek_before_primary_effect(body.terminator_loc(bb));
104+
flow_inits.seek_before(body.terminator_loc(bb));
106105
debug!(
107106
"find_dead_unwinds @ {:?}: path({:?})={:?}; init_data={:?}",
108107
bb,
109-
place,
108+
location,
110109
path,
111110
flow_inits.get()
112111
);
@@ -132,8 +131,8 @@ struct InitializationData<'mir, 'tcx> {
132131

133132
impl InitializationData<'_, '_> {
134133
fn seek_before(&mut self, loc: Location) {
135-
self.inits.seek_before_primary_effect(loc);
136-
self.uninits.seek_before_primary_effect(loc);
134+
self.inits.seek_before(loc);
135+
self.uninits.seek_before(loc);
137136
}
138137

139138
fn maybe_live_dead(&self, path: MovePathIndex) -> (bool, bool) {
@@ -214,31 +213,31 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> {
214213

215214
fn field_subpath(&self, path: Self::Path, field: Field) -> Option<Self::Path> {
216215
dataflow::move_path_children_matching(self.ctxt.move_data(), path, |e| match e {
217-
ProjectionElem::Field(idx, _) => idx == field,
216+
ProjectionElem::Field(idx, _) => *idx == field,
218217
_ => false,
219218
})
220219
}
221220

222-
fn array_subpath(&self, path: Self::Path, index: u32, size: u32) -> Option<Self::Path> {
221+
fn array_subpath(&self, path: Self::Path, index: u64, size: u64) -> Option<Self::Path> {
223222
dataflow::move_path_children_matching(self.ctxt.move_data(), path, |e| match e {
224223
ProjectionElem::ConstantIndex { offset, min_length, from_end } => {
225-
debug_assert!(size == min_length, "min_length should be exact for arrays");
224+
debug_assert!(size == *min_length as u64, "min_length should be exact for arrays");
226225
assert!(!from_end, "from_end should not be used for array element ConstantIndex");
227-
offset == index
226+
*offset == index
228227
}
229228
_ => false,
230229
})
231230
}
232231

233232
fn deref_subpath(&self, path: Self::Path) -> Option<Self::Path> {
234233
dataflow::move_path_children_matching(self.ctxt.move_data(), path, |e| {
235-
e == ProjectionElem::Deref
234+
*e == ProjectionElem::Deref
236235
})
237236
}
238237

239238
fn downcast_subpath(&self, path: Self::Path, variant: VariantIdx) -> Option<Self::Path> {
240239
dataflow::move_path_children_matching(self.ctxt.move_data(), path, |e| match e {
241-
ProjectionElem::Downcast(_, idx) => idx == variant,
240+
ProjectionElem::Downcast(_, idx) => *idx == variant,
242241
_ => false,
243242
})
244243
}
@@ -295,16 +294,16 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
295294
fn collect_drop_flags(&mut self) {
296295
for (bb, data) in self.body.basic_blocks().iter_enumerated() {
297296
let terminator = data.terminator();
298-
let place = match terminator.kind {
299-
TerminatorKind::Drop { ref place, .. }
300-
| TerminatorKind::DropAndReplace { ref place, .. } => place,
297+
let location = match terminator.kind {
298+
TerminatorKind::Drop { ref location, .. }
299+
| TerminatorKind::DropAndReplace { ref location, .. } => location,
301300
_ => continue,
302301
};
303302

304303
self.init_data.seek_before(self.body.terminator_loc(bb));
305304

306-
let path = self.move_data().rev_lookup.find(place.as_ref());
307-
debug!("collect_drop_flags: {:?}, place {:?} ({:?})", bb, place, path);
305+
let path = self.move_data().rev_lookup.find(location.as_ref());
306+
debug!("collect_drop_flags: {:?}, place {:?} ({:?})", bb, location, path);
308307

309308
let path = match path {
310309
LookupResult::Exact(e) => e,
@@ -316,7 +315,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
316315
terminator.source_info.span,
317316
"drop of untracked, uninitialized value {:?}, place {:?} ({:?})",
318317
bb,
319-
place,
318+
location,
320319
path
321320
);
322321
}
@@ -329,7 +328,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
329328
debug!(
330329
"collect_drop_flags: collecting {:?} from {:?}@{:?} - {:?}",
331330
child,
332-
place,
331+
location,
333332
path,
334333
(maybe_live, maybe_dead)
335334
);
@@ -347,13 +346,13 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
347346

348347
let resume_block = self.patch.resume_block();
349348
match terminator.kind {
350-
TerminatorKind::Drop { place, target, unwind } => {
349+
TerminatorKind::Drop { location, target, unwind } => {
351350
self.init_data.seek_before(loc);
352-
match self.move_data().rev_lookup.find(place.as_ref()) {
351+
match self.move_data().rev_lookup.find(location.as_ref()) {
353352
LookupResult::Exact(path) => elaborate_drop(
354353
&mut Elaborator { ctxt: self },
355354
terminator.source_info,
356-
place,
355+
location,
357356
path,
358357
target,
359358
if data.is_cleanup {
@@ -372,10 +371,10 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
372371
}
373372
}
374373
}
375-
TerminatorKind::DropAndReplace { place, ref value, target, unwind } => {
374+
TerminatorKind::DropAndReplace { location, ref value, target, unwind } => {
376375
assert!(!data.is_cleanup);
377376

378-
self.elaborate_replace(loc, place, value, target, unwind);
377+
self.elaborate_replace(loc, location, value, target, unwind);
379378
}
380379
_ => continue,
381380
}
@@ -397,7 +396,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
397396
fn elaborate_replace(
398397
&mut self,
399398
loc: Location,
400-
place: Place<'tcx>,
399+
location: Place<'tcx>,
401400
value: &Operand<'tcx>,
402401
target: BasicBlock,
403402
unwind: Option<BasicBlock>,
@@ -408,7 +407,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
408407
assert!(!data.is_cleanup, "DropAndReplace in unwind path not supported");
409408

410409
let assign = Statement {
411-
kind: StatementKind::Assign(box (place, Rvalue::Use(value.clone()))),
410+
kind: StatementKind::Assign(box (location, Rvalue::Use(value.clone()))),
412411
source_info: terminator.source_info,
413412
};
414413

@@ -428,14 +427,14 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
428427
is_cleanup: false,
429428
});
430429

431-
match self.move_data().rev_lookup.find(place.as_ref()) {
430+
match self.move_data().rev_lookup.find(location.as_ref()) {
432431
LookupResult::Exact(path) => {
433432
debug!("elaborate_drop_and_replace({:?}) - tracked {:?}", terminator, path);
434433
self.init_data.seek_before(loc);
435434
elaborate_drop(
436435
&mut Elaborator { ctxt: self },
437436
terminator.source_info,
438-
place,
437+
location,
439438
path,
440439
target,
441440
Unwind::To(unwind),
@@ -460,7 +459,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> {
460459
debug!("elaborate_drop_and_replace({:?}) - untracked {:?}", terminator, parent);
461460
self.patch.patch_terminator(
462461
bb,
463-
TerminatorKind::Drop { place, target, unwind: Some(unwind) },
462+
TerminatorKind::Drop { location, target, unwind: Some(unwind) },
464463
);
465464
}
466465
}

src/librustc_mir/util/aggregate.rs

-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ pub fn expand_aggregate<'tcx>(
5252
.enumerate()
5353
.map(move |(i, (op, ty))| {
5454
let lhs_field = if let AggregateKind::Array(_) = kind {
55-
// FIXME(eddyb) `offset` should be u64.
5655
let offset = i as u64;
5756
assert_eq!(offset as usize, i);
5857
tcx.mk_place_elem(

0 commit comments

Comments
 (0)