diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-15 09:46:21 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-08-15 09:46:21 +1000 |
| commit | 99aad72af55e9cfd77adeeca0f9b403758201d42 (patch) | |
| tree | 0647fb754619bc2cc69e47629e45ebbf7e39d460 | |
| parent | 13a52890dde8cfeb95069d77c223ac37c0cf3a46 (diff) | |
| download | rust-99aad72af55e9cfd77adeeca0f9b403758201d42.tar.gz rust-99aad72af55e9cfd77adeeca0f9b403758201d42.zip | |
Add a comment explaining the return type of `Ty::kind`.
| -rw-r--r-- | compiler/rustc_middle/src/ty/sty.rs | 4 |
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 |
