Skip to content
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

Add a comment explaining the return type of Ty::kind. #129110

Merged
merged 1 commit into from
Aug 16, 2024
Merged
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
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,10 @@ impl<'tcx> rustc_type_ir::inherent::Ty<TyCtxt<'tcx>> for Ty<'tcx> {

/// Type utilities
impl<'tcx> Ty<'tcx> {
// It would be nicer if this returned the value instead of a reference,
// like how `Predicate::kind` and `Region::kind` do. (It would result in
// many fewer subsequent dereferences.) But that gives a small but
// noticeable performance hit. See #126069 for details.
Comment on lines +973 to +976
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: this give me

// Increment counter here if you tried and failed this too:
// let hours_wasted = 10;

vibes, which I find amusing.

#[inline(always)]
pub fn kind(self) -> &'tcx TyKind<'tcx> {
self.0.0
Expand Down
Loading