Skip to content

Commit 1684423

Browse files
committed
obey line length limit (part 3)
1 parent 1b62c12 commit 1684423

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/opaque-types-type-alias-impl-trait-inference.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@ pub fn main() {
4343
* `m::produce_singleton`
4444
* `m::produce_doubleton`
4545
* In the `main` function, the opaque type is out of scope:
46-
* When `main` calls `m::produce_singleton`, it gets back a reference to the opaque type `Seq<i32>`.
47-
* The `is_send` call checks that `Seq<i32>: Send`. `Send` is not listed amongst the bounds of the impl trait, but because of auto-trait leakage, we are able to infer that it holds.
48-
* The for loop desugaring requires that `Seq<T>: IntoIterator`, which is provable from the bounds declared on `Seq<T>`.
46+
* When `main` calls `m::produce_singleton`,
47+
it gets back a reference to the opaque type `Seq<i32>`.
48+
* The `is_send` call checks that `Seq<i32>:
49+
Send`. `Send` is not listed amongst the bounds of the impl trait,
50+
but because of auto-trait leakage,
51+
we are able to infer that it holds.
52+
* The for loop desugaring requires that `Seq<T>: IntoIterator`,
53+
which is provable from the bounds declared on `Seq<T>`.
4954

5055
### Type-checking `main`
5156

@@ -97,7 +102,9 @@ flowchart TD
97102

98103
### Within the `type_of` query
99104

100-
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.
105+
The `type_of` query, when applied to an opaque type O, returns the hidden type.
106+
That hidden type is computed by combining the results from each constraining function
107+
within defining scope of O.
101108

102109
```mermaid
103110
flowchart TD
@@ -164,7 +171,9 @@ flowchart TD
164171

165172
### Interactions with queries
166173

167-
When queries encounter a `opaque_ty_obligation`, they do not try to process them, but instead just store the constraints into the infcx.
174+
When queries encounter a `opaque_ty_obligation`,
175+
they do not try to process them,
176+
but instead just store the constraints into the infcx.
168177

169178
```mermaid
170179
graph TD
@@ -184,9 +193,13 @@ graph TD
184193
end
185194
```
186195

187-
The registered hidden types are stored into the `QueryResponse` struct in the `opaque_types` field (the function `take_opaque_types_for_query_response` reads them out).
196+
The registered hidden types are stored into the `QueryResponse` struct in
197+
the `opaque_types` field
198+
(the function `take_opaque_types_for_query_response` reads them out).
188199

189-
When the `QueryResponse` is instantiated into the surrounding infcx in `query_response_substitution_guess`, we convert each hidden type constraint by invoking `handle_opaque_type` (as above).
200+
When the `QueryResponse` is instantiated into the surrounding infcx in
201+
`query_response_substitution_guess`,
202+
we convert each hidden type constraint by invoking `handle_opaque_type` (as above).
190203

191204
There is one bit of "weirdness".
192205
The instantiated opaque types are stored in a *map*,

0 commit comments

Comments
 (0)