mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-24 21:05:12 +00:00
Remove some comments, inline interner fn
This commit is contained in:
parent
34e05812e0
commit
f05a92d158
@ -382,6 +382,7 @@ impl<'a, 'tcx> TyDecoder for DecodeContext<'a, 'tcx> {
|
|||||||
|
|
||||||
type I = TyInterner<'tcx>;
|
type I = TyInterner<'tcx>;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
fn interner(&self) -> Self::I {
|
fn interner(&self) -> Self::I {
|
||||||
TyInterner { tcx: self.tcx() }
|
TyInterner { tcx: self.tcx() }
|
||||||
}
|
}
|
||||||
|
@ -94,43 +94,6 @@ pub struct TyInterner<'tcx> {
|
|||||||
pub tcx: TyCtxt<'tcx>,
|
pub tcx: TyCtxt<'tcx>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
/// We don't ever actually need this. It's only required for derives.
|
|
||||||
impl<'tcx> Hash for TyInterner<'tcx> {
|
|
||||||
fn hash<H: Hasher>(&self, _state: &mut H) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// We don't ever actually need this. It's only required for derives.
|
|
||||||
impl<'tcx> Ord for TyInterner<'tcx> {
|
|
||||||
fn cmp(&self, _other: &Self) -> Ordering {
|
|
||||||
Ordering::Equal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// We don't ever actually need this. It's only required for derives.
|
|
||||||
impl<'tcx> PartialOrd for TyInterner<'tcx> {
|
|
||||||
fn partial_cmp(&self, _other: &Self) -> Option<Ordering> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// We don't ever actually need this. It's only required for derives.
|
|
||||||
impl<'tcx> PartialEq for TyInterner<'tcx> {
|
|
||||||
fn eq(&self, _other: &Self) -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// We don't ever actually need this. It's only required for derives.
|
|
||||||
impl<'tcx> Eq for TyInterner<'tcx> {}
|
|
||||||
|
|
||||||
impl fmt::Debug for TyInterner<'_> {
|
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
||||||
write!(f, "TyInterner")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[allow(rustc::usage_of_ty_tykind)]
|
#[allow(rustc::usage_of_ty_tykind)]
|
||||||
impl<'tcx> Interner for TyInterner<'tcx> {
|
impl<'tcx> Interner for TyInterner<'tcx> {
|
||||||
type AdtDef = ty::AdtDef<'tcx>;
|
type AdtDef = ty::AdtDef<'tcx>;
|
||||||
@ -1140,6 +1103,7 @@ pub struct GlobalCtxt<'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
impl<'tcx> TyCtxt<'tcx> {
|
||||||
|
#[inline]
|
||||||
pub fn interner(self) -> TyInterner<'tcx> {
|
pub fn interner(self) -> TyInterner<'tcx> {
|
||||||
TyInterner { tcx: self }
|
TyInterner { tcx: self }
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ static_assert_size!(WithStableHash<TyS<'_>>, 56);
|
|||||||
#[rustc_pass_by_value]
|
#[rustc_pass_by_value]
|
||||||
pub struct Ty<'tcx>(Interned<'tcx, WithStableHash<TyS<'tcx>>>);
|
pub struct Ty<'tcx>(Interned<'tcx, WithStableHash<TyS<'tcx>>>);
|
||||||
|
|
||||||
const LEAKED_BOOL_TY_ALREADY: std::sync::atomic::AtomicBool =
|
static LEAKED_BOOL_TY_ALREADY: std::sync::atomic::AtomicBool =
|
||||||
std::sync::atomic::AtomicBool::new(false);
|
std::sync::atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
/// "Static" bool only used for internal testing.
|
/// "Static" bool only used for internal testing.
|
||||||
|
@ -4,7 +4,7 @@ use rustc_errors::struct_span_err;
|
|||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_index::vec::Idx;
|
use rustc_index::vec::Idx;
|
||||||
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
use rustc_middle::ty::layout::{LayoutError, SizeSkeleton};
|
||||||
use rustc_middle::ty::{self, FloatTy, InferTy, IntTy, Ty, TyCtxt, TypeFoldable, UintTy, Article};
|
use rustc_middle::ty::{self, Article, FloatTy, InferTy, IntTy, Ty, TyCtxt, TypeFoldable, UintTy};
|
||||||
use rustc_session::lint;
|
use rustc_session::lint;
|
||||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||||
use rustc_target::abi::{Pointer, VariantIdx};
|
use rustc_target::abi::{Pointer, VariantIdx};
|
||||||
|
Loading…
Reference in New Issue
Block a user