Skip to content

Commit c6bde8d

Browse files
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````
2 parents 4f46643 + 99aad72 commit c6bde8d

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/sty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,10 @@ impl<'tcx> rustc_type_ir::inherent::Ty<TyCtxt<'tcx>> for Ty<'tcx> {
970970

971971
/// Type utilities
972972
impl<'tcx> Ty<'tcx> {
973+
// It would be nicer if this returned the value instead of a reference,
974+
// like how `Predicate::kind` and `Region::kind` do. (It would result in
975+
// many fewer subsequent dereferences.) But that gives a small but
976+
// noticeable performance hit. See #126069 for details.
973977
#[inline(always)]
974978
pub fn kind(self) -> &'tcx TyKind<'tcx> {
975979
self.0.0

0 commit comments

Comments
 (0)