提交 f05a92d1 编写于 作者: M Michael Goulet

Remove some comments, inline interner fn

上级 34e05812
......@@ -382,6 +382,7 @@ impl<'a, 'tcx> TyDecoder for DecodeContext<'a, 'tcx> {
type I = TyInterner<'tcx>;
#[inline]
fn interner(&self) -> Self::I {
TyInterner { tcx: self.tcx() }
}
......
......@@ -94,43 +94,6 @@ pub struct TyInterner<'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)]
impl<'tcx> Interner for TyInterner<'tcx> {
type AdtDef = ty::AdtDef<'tcx>;
......@@ -1140,6 +1103,7 @@ pub struct GlobalCtxt<'tcx> {
}
impl<'tcx> TyCtxt<'tcx> {
#[inline]
pub fn interner(self) -> TyInterner<'tcx> {
TyInterner { tcx: self }
}
......
......@@ -463,7 +463,7 @@ pub(crate) struct TyS<'tcx> {
#[rustc_pass_by_value]
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);
/// "Static" bool only used for internal testing.
......
......@@ -4,7 +4,7 @@
use rustc_hir as hir;
use rustc_index::vec::Idx;
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_span::{Span, Symbol, DUMMY_SP};
use rustc_target::abi::{Pointer, VariantIdx};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册