about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2024-08-15 18:44:18 -0700
committerGitHub <noreply@github.com>2024-08-15 18:44:18 -0700
commitc6bde8d2e051b6f85e7fa5785a20f6fb64a60b7e (patch)
treeb298c1a9b14c009652df89e4a6c672d27b84bbe4
parent4f46643698cf59a0f47ea70de2784db35b0e7f80 (diff)
parent99aad72af55e9cfd77adeeca0f9b403758201d42 (diff)
downloadrust-c6bde8d2e051b6f85e7fa5785a20f6fb64a60b7e.tar.gz
rust-c6bde8d2e051b6f85e7fa5785a20f6fb64a60b7e.zip
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````
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 0a277fea49c..d60bfb9faa1 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -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