Skip to content

Commit a0fc455

Browse files
committed
Replace absolute paths with relative ones
Modern compilers allow reaching external crates like std or core via relative paths in modules outside of lib.rs and main.rs.
1 parent f54072b commit a0fc455

File tree

32 files changed

+73
-76
lines changed

32 files changed

+73
-76
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ unsafe fn configure_llvm(sess: &Session) {
122122

123123
llvm::LLVMInitializePasses();
124124

125-
::rustc_llvm::initialize_available_targets();
125+
rustc_llvm::initialize_available_targets();
126126

127127
llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int, llvm_args.as_ptr());
128128
}

compiler/rustc_codegen_ssa/src/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1175,7 +1175,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
11751175
// necessary. There's already optimizations in place to avoid sending work
11761176
// back to the coordinator if LTO isn't requested.
11771177
return thread::spawn(move || {
1178-
let max_workers = ::num_cpus::get();
1178+
let max_workers = num_cpus::get();
11791179
let mut worker_id_counter = 0;
11801180
let mut free_worker_ids = Vec::new();
11811181
let mut get_worker_id = |free_worker_ids: &mut Vec<usize>| {

compiler/rustc_codegen_ssa/src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
695695
total_codegen_time.into_inner(),
696696
);
697697

698-
::rustc_incremental::assert_module_sources::assert_module_sources(tcx);
698+
rustc_incremental::assert_module_sources::assert_module_sources(tcx);
699699

700700
symbol_names_test::report_symbol_names(tcx);
701701

@@ -754,8 +754,8 @@ impl<B: ExtraBackendMethods> Drop for AbortCodegenOnDrop<B> {
754754
}
755755

756756
fn finalize_tcx(tcx: TyCtxt<'_>) {
757-
tcx.sess.time("assert_dep_graph", || ::rustc_incremental::assert_dep_graph(tcx));
758-
tcx.sess.time("serialize_dep_graph", || ::rustc_incremental::save_dep_graph(tcx));
757+
tcx.sess.time("assert_dep_graph", || rustc_incremental::assert_dep_graph(tcx));
758+
tcx.sess.time("serialize_dep_graph", || rustc_incremental::save_dep_graph(tcx));
759759

760760
// We assume that no queries are run past here. If there are new queries
761761
// after this point, they'll show up as "<unknown>" in self-profiling data.

compiler/rustc_codegen_ssa/src/traits/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ impl<'tcx, T> CodegenMethods<'tcx> for T where
8585
}
8686

8787
pub trait HasCodegen<'tcx>:
88-
Backend<'tcx> + ::std::ops::Deref<Target = <Self as HasCodegen<'tcx>>::CodegenCx>
88+
Backend<'tcx> + std::ops::Deref<Target = <Self as HasCodegen<'tcx>>::CodegenCx>
8989
{
9090
type CodegenCx: CodegenMethods<'tcx>
9191
+ BackendTypes<

compiler/rustc_data_structures/src/fingerprint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ impl Fingerprint {
7171
}
7272
}
7373

74-
impl ::std::fmt::Display for Fingerprint {
75-
fn fmt(&self, formatter: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
74+
impl std::fmt::Display for Fingerprint {
75+
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7676
write!(formatter, "{:x}-{:x}", self.0, self.1)
7777
}
7878
}

compiler/rustc_data_structures/src/obligation_forest/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub enum ProcessResult<O, E> {
129129
struct ObligationTreeId(usize);
130130

131131
type ObligationTreeIdGenerator =
132-
::std::iter::Map<::std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>;
132+
std::iter::Map<std::ops::RangeFrom<usize>, fn(usize) -> ObligationTreeId>;
133133

134134
pub struct ObligationForest<O: ForestObligation> {
135135
/// The list of obligations. In between calls to `process_obligations`,

compiler/rustc_data_structures/src/sorted_map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ impl<K: Ord, V> SortedMap<K, V> {
9393

9494
/// Iterate over elements, sorted by key
9595
#[inline]
96-
pub fn iter(&self) -> ::std::slice::Iter<'_, (K, V)> {
96+
pub fn iter(&self) -> std::slice::Iter<'_, (K, V)> {
9797
self.data.iter()
9898
}
9999

@@ -134,7 +134,7 @@ impl<K: Ord, V> SortedMap<K, V> {
134134
R: RangeBounds<K>,
135135
{
136136
let (start, end) = self.range_slice_indices(range);
137-
self.data.splice(start..end, ::std::iter::empty());
137+
self.data.splice(start..end, std::iter::empty());
138138
}
139139

140140
/// Mutate all keys with the given function `f`. This mutation must not
@@ -241,7 +241,7 @@ impl<K: Ord, V> SortedMap<K, V> {
241241

242242
impl<K: Ord, V> IntoIterator for SortedMap<K, V> {
243243
type Item = (K, V);
244-
type IntoIter = ::std::vec::IntoIter<(K, V)>;
244+
type IntoIter = std::vec::IntoIter<(K, V)>;
245245

246246
fn into_iter(self) -> Self::IntoIter {
247247
self.data.into_iter()

compiler/rustc_data_structures/src/stable_hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct StableHasher {
2020
}
2121

2222
impl ::std::fmt::Debug for StableHasher {
23-
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
23+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
2424
write!(f, "{:?}", self.state)
2525
}
2626
}

compiler/rustc_hir/src/definitions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl DefKey {
118118

119119
let DisambiguatedDefPathData { ref data, disambiguator } = self.disambiguated_data;
120120

121-
::std::mem::discriminant(data).hash(&mut hasher);
121+
std::mem::discriminant(data).hash(&mut hasher);
122122
if let Some(name) = data.get_opt_name() {
123123
// Get a stable hash by considering the symbol chars rather than
124124
// the symbol index.

compiler/rustc_infer/src/infer/nll_relate/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ where
341341
// been fully instantiated and hence the set of scopes we have
342342
// doesn't matter -- just to be sure, put an empty vector
343343
// in there.
344-
let old_a_scopes = ::std::mem::take(pair.vid_scopes(self));
344+
let old_a_scopes = std::mem::take(pair.vid_scopes(self));
345345

346346
// Relate the generalized kind to the original one.
347347
let result = pair.relate_generalized_ty(self, generalized_ty);
@@ -680,7 +680,7 @@ where
680680
// itself occurs. Note that `'b` and `'c` must both
681681
// include P. At the point, the call works because of
682682
// subtyping (i.e., `&'b u32 <: &{P} u32`).
683-
let variance = ::std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant);
683+
let variance = std::mem::replace(&mut self.ambient_variance, ty::Variance::Covariant);
684684

685685
self.relate(a.skip_binder(), b.skip_binder())?;
686686

@@ -709,7 +709,7 @@ where
709709
// Reset ambient variance to contravariance. See the
710710
// covariant case above for an explanation.
711711
let variance =
712-
::std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant);
712+
std::mem::replace(&mut self.ambient_variance, ty::Variance::Contravariant);
713713

714714
self.relate(a.skip_binder(), b.skip_binder())?;
715715

0 commit comments

Comments
 (0)