Small performance tweaks
This commit is contained in:
parent
17b53b9645
commit
83587e8d30
@ -94,9 +94,11 @@ pub fn pointer_mut(&mut self) -> &mut P::Target
|
||||
// SAFETY: pointer_raw returns the original pointer
|
||||
unsafe { std::mem::transmute_copy(&self.pointer_raw()) }
|
||||
}
|
||||
#[inline]
|
||||
pub fn tag(&self) -> T {
|
||||
unsafe { T::from_usize(self.packed.get() >> Self::TAG_BIT_SHIFT) }
|
||||
}
|
||||
#[inline]
|
||||
pub fn set_tag(&mut self, tag: T) {
|
||||
let mut packed = self.packed.get();
|
||||
let new_tag = T::into_usize(tag) << Self::TAG_BIT_SHIFT;
|
||||
|
@ -1339,21 +1339,25 @@ pub fn with_user_facing(mut self) -> Self {
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn with_constness(mut self, constness: hir::Constness) -> Self {
|
||||
self.packed.set_tag(ParamTag { constness, ..self.packed.tag() });
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn with_const(mut self) -> Self {
|
||||
self.packed.set_tag(ParamTag { constness: hir::Constness::Const, ..self.packed.tag() });
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn without_const(mut self) -> Self {
|
||||
self.packed.set_tag(ParamTag { constness: hir::Constness::NotConst, ..self.packed.tag() });
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn remap_constness_with(&mut self, mut constness: ty::BoundConstness) {
|
||||
*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 });
|
||||
}
|
||||
|
||||
pub(super) fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
wfcheck::check_item_well_formed(tcx, def_id);
|
||||
}
|
||||
pub(super) use wfcheck::check_item_well_formed;
|
||||
|
||||
pub(super) fn check_trait_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
wfcheck::check_trait_item(tcx, def_id);
|
||||
}
|
||||
pub(super) use wfcheck::check_trait_item as check_trait_item_well_formed;
|
||||
|
||||
pub(super) fn check_impl_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
wfcheck::check_impl_item(tcx, def_id);
|
||||
}
|
||||
pub(super) use wfcheck::check_impl_item as check_impl_item_well_formed;
|
||||
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user