about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2024-03-19 12:55:26 -0400
committerMichael Goulet <michael@errs.io>2024-03-19 16:59:24 -0400
commit541858ed787a66bbb00a4edd21f924ed0f208a9d (patch)
tree6c4e0bef4d7f271498bf198c47e33b340aff0840 /compiler/rustc_middle/src/ty
parentf1fef64e19909487ff2640bce58ce49fcfb4b85d (diff)
downloadrust-541858ed787a66bbb00a4edd21f924ed0f208a9d.tar.gz
rust-541858ed787a66bbb00a4edd21f924ed0f208a9d.zip
Add a few more comments
Diffstat (limited to 'compiler/rustc_middle/src/ty')
-rw-r--r--compiler/rustc_middle/src/ty/instance.rs2
-rw-r--r--compiler/rustc_middle/src/ty/sty.rs4
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs
index 18ef4ed549b..4748e961019 100644
--- a/compiler/rustc_middle/src/ty/instance.rs
+++ b/compiler/rustc_middle/src/ty/instance.rs
@@ -101,7 +101,7 @@ pub enum InstanceDef<'tcx> {
         // because the signature of `<{async fn} as FnMut>::call_mut` is:
         // `fn(&mut self, args: A) -> <Self as FnOnce>::Output`, that is to say
         // that it returns the `FnOnce`-flavored coroutine but takes the closure
-        // by ref (and similarly for `Fn::call`).
+        // by mut ref (and similarly for `Fn::call`).
         receiver_by_ref: bool,
     },
 
diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs
index 67908013041..6e0a9eb86dd 100644
--- a/compiler/rustc_middle/src/ty/sty.rs
+++ b/compiler/rustc_middle/src/ty/sty.rs
@@ -2461,6 +2461,10 @@ impl<'tcx> Ty<'tcx> {
     /// `AsyncFn`/`AsyncFnMut`/`AsyncFnOnce`, we only need to distinguish two coroutine
     /// bodies: by-ref and by-value.
     ///
+    /// See the definition of `AsyncFn` and `AsyncFnMut` and the `CallRefFuture`
+    /// associated type for why we don't distinguish [`ty::ClosureKind::Fn`] and
+    /// [`ty::ClosureKind::FnMut`] for the purpose of the generated MIR bodies.
+    ///
     /// This method should be used when constructing a `Coroutine` out of a
     /// `CoroutineClosure`, when the `Coroutine`'s `kind` field is being populated
     /// directly from the `CoroutineClosure`'s `kind`.