about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorHackMD <no-reply@hackmd.io>2022-02-07 22:45:11 +0000
committerTshepang Mbambo <tshepang@gmail.com>2022-07-17 23:34:12 +0200
commit0f778223df9c7177397a67b030cd9bfd623f68b3 (patch)
treeee96e3ad643c82e2c828c5c60ab95ade79c79038 /src
parentfd17e926c410631642e746f56eaf6c38b83acc82 (diff)
downloadrust-0f778223df9c7177397a67b030cd9bfd623f68b3.tar.gz
rust-0f778223df9c7177397a67b030cd9bfd623f68b3.zip
sync with hackmd
Diffstat (limited to 'src')
-rw-r--r--src/doc/rustc-dev-guide/src/opaque-types-type-alias-impl-trait-inference.md33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/src/opaque-types-type-alias-impl-trait-inference.md b/src/doc/rustc-dev-guide/src/opaque-types-type-alias-impl-trait-inference.md
index b47216aae9e..0d738c88f5a 100644
--- a/src/doc/rustc-dev-guide/src/opaque-types-type-alias-impl-trait-inference.md
+++ b/src/doc/rustc-dev-guide/src/opaque-types-type-alias-impl-trait-inference.md
@@ -55,24 +55,43 @@ Let's start by looking what happens when we type-check `main`. Initially we invo
 
 #### Type-checking the `is_send` call
 
+* Explain how it invokes `type_of`
+    * We look at the bounds, we are able to type check it as is
+
 ```mermaid
 flowchart TD
     TypeChecking["type checking `main`"]
     subgraph TypeOfSeq["type_of(Seq<T>) query"]
-        WalkModuleHir["Walk the HIR for the module `m`"]
-        VisitProduceSingleton["visit produce_singleton"]
-        VisitProduceDoubleton["visit produce_doubleton"]
+        WalkModuleHir["Walk the HIR for the module `m`\nto find the hidden types from each\nfunction within"]
+        VisitProduceSingleton["visit `produce_singleton`"]
+        InterimType["`produce_singleton` hidden type is `Vec<T>`\nkeep searching"]
+        VisitProduceDoubleton["visit `produce_doubleton`"]
+        CompareType["`produce_doubleton` hidden type is also Vec<T>\nthis matches what we saw before ✅"]
+        Done["Return `Vec<T>`"]
     end
+    
+    BorrowCheckProduceSingleton["`borrow_check(produce_singleton)`"]
+    TypeCheckProduceSingleton["`type_check(produce_singleton)`"]
+
+    BorrowCheckProduceDoubleton["`borrow_check(produce_doubleton)`"]
+    TypeCheckProduceDoubleton["`type_check(produce_doubleton)`"]
+    
+    Substitute["Substitute `T => u32`,\nyielding `Vec<i32>` as the hidden type"]
+    CheckSend["Check that `Vec<i32>: Send` ✅"]
 
     TypeChecking -- trait code for auto traits --> TypeOfSeq
     TypeOfSeq --> WalkModuleHir
     WalkModuleHir --> VisitProduceSingleton
-    VisitProduceSingleton --> VisitProduceDoubleton
+    VisitProduceSingleton --> BorrowCheckProduceSingleton
+    BorrowCheckProduceSingleton --> TypeCheckProduceSingleton
+    TypeCheckProduceSingleton --> InterimType
+    InterimType --> VisitProduceDoubleton
+    VisitProduceDoubleton --> BorrowCheckProduceDoubleton
+    BorrowCheckProduceDoubleton --> TypeCheckProduceDoubleton
+    TypeCheckProduceDoubleton --> CompareType --> Done
+    Done --> Substitute --> CheckSend    
 ```
 
-* Explain how it invokes `type_of`
-    * We look at the bounds, we are able to type check it as is
-
 ### Within the `type_of` query
 
 The `type_of` query, when applied to an opaque type O, returns the hidden type. That hidden type is computed by combining the results from each constraining function within defining scope of O.