Skip to content

Commit c0daff0

Browse files
committed
Fix rustc_index imports outside the compiler
1 parent 5d809b1 commit c0daff0

File tree

7 files changed

+27
-25
lines changed

7 files changed

+27
-25
lines changed

compiler/rustc_codegen_cranelift/src/abi/returning.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use smallvec::{smallvec, SmallVec};
99
/// this adds an extra parameter pointing to where the return value needs to be stored.
1010
pub(super) fn codegen_return_param<'tcx>(
1111
fx: &mut FunctionCx<'_, '_, 'tcx>,
12-
ssa_analyzed: &rustc_index::vec::IndexVec<Local, crate::analyze::SsaKind>,
12+
ssa_analyzed: &rustc_index::IndexSlice<Local, crate::analyze::SsaKind>,
1313
block_params_iter: &mut impl Iterator<Item = Value>,
1414
) -> CPlace<'tcx> {
1515
let (ret_place, ret_param): (_, SmallVec<[_; 2]>) = match fx.fn_abi.as_ref().unwrap().ret.mode {

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
2020
use rustc_hir::lang_items::LangItem;
2121
use rustc_hir::{BodyId, Mutability};
2222
use rustc_hir_analysis::check::intrinsic::intrinsic_operation_unsafety;
23-
use rustc_index::vec::IndexVec;
23+
use rustc_index::IndexVec;
2424
use rustc_middle::ty::fast_reject::SimplifiedType;
2525
use rustc_middle::ty::{self, TyCtxt, Visibility};
2626
use rustc_resolve::rustdoc::{add_doc_fragment, attrs_to_doc_fragments, inner_docs, DocFragment};

src/tools/miri/src/concurrency/data_race.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use std::{
4848

4949
use rustc_ast::Mutability;
5050
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
51-
use rustc_index::vec::{Idx, IndexVec};
51+
use rustc_index::{Idx, IndexVec};
5252
use rustc_middle::mir;
5353
use rustc_span::Span;
5454
use rustc_target::abi::{Align, Size};

src/tools/miri/src/concurrency/init_once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::collections::VecDeque;
22
use std::num::NonZeroU32;
33

4-
use rustc_index::vec::Idx;
4+
use rustc_index::Idx;
55

66
use super::sync::EvalContextExtPriv as _;
77
use super::thread::MachineCallback;

src/tools/miri/src/concurrency/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::ops::Not;
55
use log::trace;
66

77
use rustc_data_structures::fx::FxHashMap;
8-
use rustc_index::vec::{Idx, IndexVec};
8+
use rustc_index::{Idx, IndexVec};
99

1010
use super::init_once::InitOnce;
1111
use super::vector_clock::VClock;

src/tools/miri/src/concurrency/thread.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use log::trace;
1010

1111
use rustc_data_structures::fx::FxHashMap;
1212
use rustc_hir::def_id::DefId;
13-
use rustc_index::vec::{Idx, IndexVec};
13+
use rustc_index::{Idx, IndexVec};
1414
use rustc_middle::mir::Mutability;
1515
use rustc_middle::ty::layout::TyAndLayout;
1616
use rustc_span::Span;
@@ -272,8 +272,9 @@ impl Time {
272272
fn get_wait_time(&self, clock: &Clock) -> Duration {
273273
match self {
274274
Time::Monotonic(instant) => instant.duration_since(clock.now()),
275-
Time::RealTime(time) =>
276-
time.duration_since(SystemTime::now()).unwrap_or(Duration::new(0, 0)),
275+
Time::RealTime(time) => {
276+
time.duration_since(SystemTime::now()).unwrap_or(Duration::new(0, 0))
277+
}
277278
}
278279
}
279280
}
@@ -603,10 +604,11 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
603604
// this allows us to have a deterministic scheduler.
604605
for thread in self.threads.indices() {
605606
match self.timeout_callbacks.entry(thread) {
606-
Entry::Occupied(entry) =>
607+
Entry::Occupied(entry) => {
607608
if entry.get().call_time.get_wait_time(clock) == Duration::new(0, 0) {
608609
return Some((thread, entry.remove().callback));
609-
},
610+
}
611+
}
610612
Entry::Vacant(_) => {}
611613
}
612614
}

src/tools/miri/src/concurrency/vector_clock.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_index::vec::Idx;
1+
use rustc_index::Idx;
22
use rustc_span::{Span, SpanData, DUMMY_SP};
33
use smallvec::SmallVec;
44
use std::{
@@ -212,14 +212,16 @@ impl PartialOrd for VClock {
212212
for (l, r) in iter {
213213
match order {
214214
Ordering::Equal => order = l.cmp(r),
215-
Ordering::Less =>
215+
Ordering::Less => {
216216
if l > r {
217217
return None;
218-
},
219-
Ordering::Greater =>
218+
}
219+
}
220+
Ordering::Greater => {
220221
if l < r {
221222
return None;
222-
},
223+
}
224+
}
223225
}
224226
}
225227

@@ -234,18 +236,16 @@ impl PartialOrd for VClock {
234236
Ordering::Equal => Some(order),
235237
// Right has at least 1 element > than the implicit 0,
236238
// so the only valid values are Ordering::Less or None.
237-
Ordering::Less =>
238-
match order {
239-
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
240-
Ordering::Greater => None,
241-
},
239+
Ordering::Less => match order {
240+
Ordering::Less | Ordering::Equal => Some(Ordering::Less),
241+
Ordering::Greater => None,
242+
},
242243
// Left has at least 1 element > than the implicit 0,
243244
// so the only valid values are Ordering::Greater or None.
244-
Ordering::Greater =>
245-
match order {
246-
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
247-
Ordering::Less => None,
248-
},
245+
Ordering::Greater => match order {
246+
Ordering::Greater | Ordering::Equal => Some(Ordering::Greater),
247+
Ordering::Less => None,
248+
},
249249
}
250250
}
251251

0 commit comments

Comments
 (0)