Skip to content

Commit

Permalink
Rollup merge of rust-lang#129110 - nnethercote:Ty-kind-ret-ty-comment…
Browse files Browse the repository at this point in the history
…, r=jieyouxu

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

At least we'll get a useful comment out of rust-lang#126069 :)

r? ``@lcnr``
  • Loading branch information
workingjubilee authored Aug 16, 2024
2 parents 8fd4899 + 99aad72 commit bdd592a
Showing 1 changed file with 4 additions and 0 deletions.
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.
#[inline(always)]
pub fn kind(self) -> &'tcx TyKind<'tcx> {
self.0.0
Expand Down

0 comments on commit bdd592a

Please sign in to comment.