diff --git a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs index d63bcdb3c2b..e1d3e0bd35a 100644 --- a/compiler/rustc_data_structures/src/tagged_ptr/copy.rs +++ b/compiler/rustc_data_structures/src/tagged_ptr/copy.rs @@ -94,9 +94,11 @@ where // 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; diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 8a768558668..d0d2a46fc4c 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1339,21 +1339,25 @@ impl<'tcx> ParamEnv<'tcx> { 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())) } diff --git a/compiler/rustc_typeck/src/check/check.rs b/compiler/rustc_typeck/src/check/check.rs index 4e06608be5d..5a6bac9ec03 100644 --- a/compiler/rustc_typeck/src/check/check.rs +++ b/compiler/rustc_typeck/src/check/check.rs @@ -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")