mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-19 18:34:08 +00:00
Small performance tweaks
This commit is contained in:
parent
17b53b9645
commit
83587e8d30
@ -94,9 +94,11 @@ where
|
|||||||
// SAFETY: pointer_raw returns the original pointer
|
// SAFETY: pointer_raw returns the original pointer
|
||||||
unsafe { std::mem::transmute_copy(&self.pointer_raw()) }
|
unsafe { std::mem::transmute_copy(&self.pointer_raw()) }
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub fn tag(&self) -> T {
|
pub fn tag(&self) -> T {
|
||||||
unsafe { T::from_usize(self.packed.get() >> Self::TAG_BIT_SHIFT) }
|
unsafe { T::from_usize(self.packed.get() >> Self::TAG_BIT_SHIFT) }
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
pub fn set_tag(&mut self, tag: T) {
|
pub fn set_tag(&mut self, tag: T) {
|
||||||
let mut packed = self.packed.get();
|
let mut packed = self.packed.get();
|
||||||
let new_tag = T::into_usize(tag) << Self::TAG_BIT_SHIFT;
|
let new_tag = T::into_usize(tag) << Self::TAG_BIT_SHIFT;
|
||||||
|
@ -1339,21 +1339,25 @@ impl<'tcx> ParamEnv<'tcx> {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn with_constness(mut self, constness: hir::Constness) -> Self {
|
pub fn with_constness(mut self, constness: hir::Constness) -> Self {
|
||||||
self.packed.set_tag(ParamTag { constness, ..self.packed.tag() });
|
self.packed.set_tag(ParamTag { constness, ..self.packed.tag() });
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn with_const(mut self) -> Self {
|
pub fn with_const(mut self) -> Self {
|
||||||
self.packed.set_tag(ParamTag { constness: hir::Constness::Const, ..self.packed.tag() });
|
self.packed.set_tag(ParamTag { constness: hir::Constness::Const, ..self.packed.tag() });
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn without_const(mut self) -> Self {
|
pub fn without_const(mut self) -> Self {
|
||||||
self.packed.set_tag(ParamTag { constness: hir::Constness::NotConst, ..self.packed.tag() });
|
self.packed.set_tag(ParamTag { constness: hir::Constness::NotConst, ..self.packed.tag() });
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn remap_constness_with(&mut self, mut constness: ty::BoundConstness) {
|
pub fn remap_constness_with(&mut self, mut constness: ty::BoundConstness) {
|
||||||
*self = self.with_constness(constness.and(self.constness()))
|
*self = self.with_constness(constness.and(self.constness()))
|
||||||
}
|
}
|
||||||
|
@ -1506,17 +1506,11 @@ pub(super) fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
|
|||||||
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
|
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(super) fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
pub(super) use wfcheck::check_item_well_formed;
|
||||||
wfcheck::check_item_well_formed(tcx, def_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn check_trait_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
pub(super) use wfcheck::check_trait_item as check_trait_item_well_formed;
|
||||||
wfcheck::check_trait_item(tcx, def_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn check_impl_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
pub(super) use wfcheck::check_impl_item as check_impl_item_well_formed;
|
||||||
wfcheck::check_impl_item(tcx, def_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) {
|
fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) {
|
||||||
struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing")
|
struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing")
|
||||||
|
Loading…
Reference in New Issue
Block a user