Rollup merge of #129110 - nnethercote:Ty-kind-ret-ty-comment, r=jieyouxu

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

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

r? ````@lcnr````
This commit is contained in:
Jubilee 2024-08-15 18:44:18 -07:00 committed by GitHub
commit c6bde8d2e0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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