Skip to content

Commit 83587e8

Browse files
committed
Small performance tweaks
1 parent 17b53b9 commit 83587e8

File tree

3 files changed

+9
-9
lines changed
  • compiler

3 files changed

+9
-9
lines changed

compiler/rustc_data_structures/src/tagged_ptr/copy.rs

+2
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,11 @@ where
9494
// SAFETY: pointer_raw returns the original pointer
9595
unsafe { std::mem::transmute_copy(&self.pointer_raw()) }
9696
}
97+
#[inline]
9798
pub fn tag(&self) -> T {
9899
unsafe { T::from_usize(self.packed.get() >> Self::TAG_BIT_SHIFT) }
99100
}
101+
#[inline]
100102
pub fn set_tag(&mut self, tag: T) {
101103
let mut packed = self.packed.get();
102104
let new_tag = T::into_usize(tag) << Self::TAG_BIT_SHIFT;

compiler/rustc_middle/src/ty/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1339,21 +1339,25 @@ impl<'tcx> ParamEnv<'tcx> {
13391339
self
13401340
}
13411341

1342+
#[inline]
13421343
pub fn with_constness(mut self, constness: hir::Constness) -> Self {
13431344
self.packed.set_tag(ParamTag { constness, ..self.packed.tag() });
13441345
self
13451346
}
13461347

1348+
#[inline]
13471349
pub fn with_const(mut self) -> Self {
13481350
self.packed.set_tag(ParamTag { constness: hir::Constness::Const, ..self.packed.tag() });
13491351
self
13501352
}
13511353

1354+
#[inline]
13521355
pub fn without_const(mut self) -> Self {
13531356
self.packed.set_tag(ParamTag { constness: hir::Constness::NotConst, ..self.packed.tag() });
13541357
self
13551358
}
13561359

1360+
#[inline]
13571361
pub fn remap_constness_with(&mut self, mut constness: ty::BoundConstness) {
13581362
*self = self.with_constness(constness.and(self.constness()))
13591363
}

compiler/rustc_typeck/src/check/check.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -1506,17 +1506,11 @@ pub(super) fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
15061506
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
15071507
}
15081508

1509-
pub(super) fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
1510-
wfcheck::check_item_well_formed(tcx, def_id);
1511-
}
1509+
pub(super) use wfcheck::check_item_well_formed;
15121510

1513-
pub(super) fn check_trait_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
1514-
wfcheck::check_trait_item(tcx, def_id);
1515-
}
1511+
pub(super) use wfcheck::check_trait_item as check_trait_item_well_formed;
15161512

1517-
pub(super) fn check_impl_item_well_formed(tcx: TyCtxt<'_>, def_id: LocalDefId) {
1518-
wfcheck::check_impl_item(tcx, def_id);
1519-
}
1513+
pub(super) use wfcheck::check_impl_item as check_impl_item_well_formed;
15201514

15211515
fn async_opaque_type_cycle_error(tcx: TyCtxt<'tcx>, span: Span) {
15221516
struct_span_err!(tcx.sess, span, E0733, "recursion in an `async fn` requires boxing")

0 commit comments

Comments
 (0)