Skip to content

Commit bd52f58

Browse files
committed
create type alias
1 parent a5c895e commit bd52f58

File tree

3 files changed

+10
-16
lines changed

3 files changed

+10
-16
lines changed

compiler/rustc_mir_dataflow/src/move_paths/builder.rs

+7-11
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,12 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
207207
}
208208
}
209209

210+
pub type MoveDat<'tcx> = (FxHashMap<Local, Place<'tcx>>, MoveData<'tcx>);
211+
210212
impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> {
211213
fn finalize(
212214
self,
213-
) -> Result<
214-
(FxHashMap<rustc_middle::mir::Local, rustc_middle::mir::Place<'tcx>>, MoveData<'tcx>),
215-
(MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>),
216-
> {
215+
) -> Result<MoveDat<'tcx>, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
217216
debug!("{}", {
218217
debug!("moves for {:?}:", self.body.span);
219218
for (j, mo) in self.data.moves.iter_enumerated() {
@@ -226,10 +225,10 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> {
226225
"done dumping moves"
227226
});
228227

229-
if !self.errors.is_empty() {
230-
Err((self.data, self.errors))
231-
} else {
228+
if self.errors.is_empty() {
232229
Ok((self.un_derefer.derefer_sidetable, self.data))
230+
} else {
231+
Err((self.data, self.errors))
233232
}
234233
}
235234
}
@@ -238,10 +237,7 @@ pub(super) fn gather_moves<'tcx>(
238237
body: &Body<'tcx>,
239238
tcx: TyCtxt<'tcx>,
240239
param_env: ty::ParamEnv<'tcx>,
241-
) -> Result<
242-
(FxHashMap<rustc_middle::mir::Local, rustc_middle::mir::Place<'tcx>>, MoveData<'tcx>),
243-
(MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>),
244-
> {
240+
) -> Result<MoveDat<'tcx>, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
245241
let mut builder = MoveDataBuilder::new(body, tcx, param_env);
246242

247243
builder.gather_args();

compiler/rustc_mir_dataflow/src/move_paths/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::move_paths::builder::MoveDat;
12
use rustc_data_structures::fx::FxHashMap;
23
use rustc_index::vec::IndexVec;
34
use rustc_middle::mir::*;
@@ -386,10 +387,7 @@ impl<'tcx> MoveData<'tcx> {
386387
body: &Body<'tcx>,
387388
tcx: TyCtxt<'tcx>,
388389
param_env: ParamEnv<'tcx>,
389-
) -> Result<
390-
(FxHashMap<rustc_middle::mir::Local, rustc_middle::mir::Place<'tcx>>, MoveData<'tcx>),
391-
(MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>),
392-
> {
390+
) -> Result<MoveDat<'tcx>, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
393391
builder::gather_moves(body, tcx, param_env)
394392
}
395393

compiler/rustc_mir_dataflow/src/rustc_peek.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'tcx> MirPass<'tcx> for SanityCheck {
3131

3232
let param_env = tcx.param_env(def_id);
3333
let (_, move_data) = MoveData::gather_moves(body, tcx, param_env).unwrap();
34-
let mdpe = MoveDataParamEnv { move_data: move_data, param_env };
34+
let mdpe = MoveDataParamEnv { move_data, param_env };
3535

3636
if has_rustc_mir_with(tcx, def_id, sym::rustc_peek_maybe_init).is_some() {
3737
let flow_inits = MaybeInitializedPlaces::new(tcx, body, &mdpe)

0 commit comments

Comments
 (0)