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.
This commit is contained in:
parent
f54072bb81
commit
a0fc455d30
32 changed files with 73 additions and 76 deletions
|
@ -5,7 +5,7 @@ use crate::ich::StableHashingContext;
|
|||
|
||||
use rustc_ast as ast;
|
||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_span::SourceFile;
|
||||
use rustc_span::{BytePos, NormalizedPos, SourceFile};
|
||||
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -102,22 +102,19 @@ impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
|
|||
}
|
||||
}
|
||||
|
||||
fn stable_byte_pos(pos: ::rustc_span::BytePos, source_file_start: ::rustc_span::BytePos) -> u32 {
|
||||
fn stable_byte_pos(pos: BytePos, source_file_start: BytePos) -> u32 {
|
||||
pos.0 - source_file_start.0
|
||||
}
|
||||
|
||||
fn stable_multibyte_char(
|
||||
mbc: ::rustc_span::MultiByteChar,
|
||||
source_file_start: ::rustc_span::BytePos,
|
||||
) -> (u32, u32) {
|
||||
let ::rustc_span::MultiByteChar { pos, bytes } = mbc;
|
||||
fn stable_multibyte_char(mbc: rustc_span::MultiByteChar, source_file_start: BytePos) -> (u32, u32) {
|
||||
let rustc_span::MultiByteChar { pos, bytes } = mbc;
|
||||
|
||||
(pos.0 - source_file_start.0, bytes as u32)
|
||||
}
|
||||
|
||||
fn stable_non_narrow_char(
|
||||
swc: ::rustc_span::NonNarrowChar,
|
||||
source_file_start: ::rustc_span::BytePos,
|
||||
swc: rustc_span::NonNarrowChar,
|
||||
source_file_start: BytePos,
|
||||
) -> (u32, u32) {
|
||||
let pos = swc.pos();
|
||||
let width = swc.width();
|
||||
|
@ -125,11 +122,8 @@ fn stable_non_narrow_char(
|
|||
(pos.0 - source_file_start.0, width as u32)
|
||||
}
|
||||
|
||||
fn stable_normalized_pos(
|
||||
np: ::rustc_span::NormalizedPos,
|
||||
source_file_start: ::rustc_span::BytePos,
|
||||
) -> (u32, u32) {
|
||||
let ::rustc_span::NormalizedPos { pos, diff } = np;
|
||||
fn stable_normalized_pos(np: NormalizedPos, source_file_start: BytePos) -> (u32, u32) {
|
||||
let NormalizedPos { pos, diff } = np;
|
||||
|
||||
(pos.0 - source_file_start.0, diff)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ pub struct Allocation<Tag = (), Extra = ()> {
|
|||
pub extra: Extra,
|
||||
}
|
||||
|
||||
pub trait AllocationExtra<Tag>: ::std::fmt::Debug + Clone {
|
||||
pub trait AllocationExtra<Tag>: std::fmt::Debug + Clone {
|
||||
// There is no constructor in here because the constructor's type depends
|
||||
// on `MemoryKind`, and making things sufficiently generic leads to painful
|
||||
// inference failure.
|
||||
|
|
|
@ -58,7 +58,7 @@ impl<'tcx> ConstValue<'tcx> {
|
|||
|
||||
pub fn try_to_str_slice(&self) -> Option<&'tcx str> {
|
||||
if let ConstValue::Slice { data, start, end } = *self {
|
||||
::std::str::from_utf8(data.inspect_with_uninit_and_ptr_outside_interpreter(start..end))
|
||||
std::str::from_utf8(data.inspect_with_uninit_and_ptr_outside_interpreter(start..end))
|
||||
.ok()
|
||||
} else {
|
||||
None
|
||||
|
@ -465,7 +465,7 @@ impl<'tcx, Tag> Scalar<Tag> {
|
|||
|
||||
pub fn to_char(self) -> InterpResult<'tcx, char> {
|
||||
let val = self.to_u32()?;
|
||||
match ::std::char::from_u32(val) {
|
||||
match std::char::from_u32(val) {
|
||||
Some(c) => Ok(c),
|
||||
None => throw_ub!(InvalidChar(val)),
|
||||
}
|
||||
|
|
|
@ -775,7 +775,7 @@ mod binding_form_impl {
|
|||
impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for super::BindingForm<'tcx> {
|
||||
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
|
||||
use super::BindingForm::*;
|
||||
::std::mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
std::mem::discriminant(self).hash_stable(hcx, hasher);
|
||||
|
||||
match self {
|
||||
Var(binding) => binding.hash_stable(hcx, hasher),
|
||||
|
|
|
@ -1894,7 +1894,7 @@ impl<'tcx, T: HasTyCtxt<'tcx>> HasTyCtxt<'tcx> for LayoutCx<'tcx, T> {
|
|||
}
|
||||
}
|
||||
|
||||
pub type TyAndLayout<'tcx> = ::rustc_target::abi::TyAndLayout<'tcx, Ty<'tcx>>;
|
||||
pub type TyAndLayout<'tcx> = rustc_target::abi::TyAndLayout<'tcx, Ty<'tcx>>;
|
||||
|
||||
impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
type Ty = Ty<'tcx>;
|
||||
|
|
|
@ -23,7 +23,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
{
|
||||
debug!(
|
||||
"normalize_erasing_regions::<{}>(value={:?}, param_env={:?})",
|
||||
::std::any::type_name::<T>(),
|
||||
std::any::type_name::<T>(),
|
||||
value,
|
||||
param_env,
|
||||
);
|
||||
|
|
|
@ -1142,7 +1142,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||
// relocations (we have an active `str` reference here). We don't use this
|
||||
// result to affect interpreter execution.
|
||||
let slice = data.inspect_with_uninit_and_ptr_outside_interpreter(start..end);
|
||||
let s = ::std::str::from_utf8(slice).expect("non utf8 str from miri");
|
||||
let s = std::str::from_utf8(slice).expect("non utf8 str from miri");
|
||||
p!(write("{:?}", s));
|
||||
Ok(self)
|
||||
}
|
||||
|
|
|
@ -543,7 +543,7 @@ impl<'a, 'tcx> DecoderWithPosition for CacheDecoder<'a, 'tcx> {
|
|||
// tag matches and the correct amount of bytes was read.
|
||||
fn decode_tagged<D, T, V>(decoder: &mut D, expected_tag: T) -> Result<V, D::Error>
|
||||
where
|
||||
T: Decodable<D> + Eq + ::std::fmt::Debug,
|
||||
T: Decodable<D> + Eq + std::fmt::Debug,
|
||||
V: Decodable<D>,
|
||||
D: DecoderWithPosition,
|
||||
{
|
||||
|
@ -1023,7 +1023,7 @@ where
|
|||
let _timer = tcx
|
||||
.sess
|
||||
.prof
|
||||
.extra_verbose_generic_activity("encode_query_results_for", ::std::any::type_name::<Q>());
|
||||
.extra_verbose_generic_activity("encode_query_results_for", std::any::type_name::<Q>());
|
||||
|
||||
let state = Q::query_state(tcx);
|
||||
assert!(state.all_inactive());
|
||||
|
|
|
@ -646,8 +646,8 @@ impl<'tcx> ty::TyS<'tcx> {
|
|||
}
|
||||
ty::Char => Some(std::char::MAX as u128),
|
||||
ty::Float(fty) => Some(match fty {
|
||||
ast::FloatTy::F32 => ::rustc_apfloat::ieee::Single::INFINITY.to_bits(),
|
||||
ast::FloatTy::F64 => ::rustc_apfloat::ieee::Double::INFINITY.to_bits(),
|
||||
ast::FloatTy::F32 => rustc_apfloat::ieee::Single::INFINITY.to_bits(),
|
||||
ast::FloatTy::F64 => rustc_apfloat::ieee::Double::INFINITY.to_bits(),
|
||||
}),
|
||||
_ => None,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue