Skip to content

Miscellaneous inlining improvements #99028

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_middle/src/ty/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,27 @@ impl<'a> HashStable<StableHashingContext<'a>> for AdtDefData {
pub struct AdtDef<'tcx>(pub Interned<'tcx, AdtDefData>);

impl<'tcx> AdtDef<'tcx> {
#[inline]
pub fn did(self) -> DefId {
self.0.0.did
}

#[inline]
pub fn variants(self) -> &'tcx IndexVec<VariantIdx, VariantDef> {
&self.0.0.variants
}

#[inline]
pub fn variant(self, idx: VariantIdx) -> &'tcx VariantDef {
&self.0.0.variants[idx]
}

#[inline]
pub fn flags(self) -> AdtFlags {
self.0.0.flags
}

#[inline]
pub fn repr(self) -> ReprOptions {
self.0.0.repr
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/structural_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,7 @@ impl<'tcx> TypeVisitable<'tcx> for ty::Predicate<'tcx> {
self.outer_exclusive_binder() > binder
}

#[inline]
fn has_type_flags(&self, flags: ty::TypeFlags) -> bool {
self.flags().intersects(flags)
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ pub struct Region<'tcx>(pub Interned<'tcx, RegionKind<'tcx>>);
impl<'tcx> Deref for Region<'tcx> {
type Target = RegionKind<'tcx>;

#[inline]
fn deref(&self) -> &RegionKind<'tcx> {
&self.0.0
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_middle/src/ty/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ impl<'tcx> Ty<'tcx> {
ty
}

#[inline]
pub fn outer_exclusive_binder(self) -> ty::DebruijnIndex {
self.0.outer_exclusive_binder
}
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_query_system/src/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ pub enum DepNodeColor {
}

impl DepNodeColor {
#[inline]
pub fn is_green(self) -> bool {
match self {
DepNodeColor::Red => false,
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_query_system/src/query/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ pub struct QueryJob {

impl QueryJob {
/// Creates a new query job.
#[inline]
pub fn new(id: QueryJobId, span: Span, parent: Option<QueryJobId>) -> Self {
QueryJob {
id,
Expand All @@ -106,6 +107,7 @@ impl QueryJob {
///
/// This does nothing for single threaded rustc,
/// as there are no concurrent jobs which could be waiting on us
#[inline]
pub fn signal_complete(self) {
#[cfg(parallel_compiler)]
{
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_query_system/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub struct QuerySideEffects {
}

impl QuerySideEffects {
#[inline]
pub fn is_empty(&self) -> bool {
let QuerySideEffects { diagnostics } = self;
diagnostics.is_empty()
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,7 @@ impl SourceFile {
self.name.is_real()
}

#[inline]
pub fn is_imported(&self) -> bool {
self.src.is_none()
}
Expand Down