summaryrefslogtreecommitdiffstats
path: root/src/doc/rustc-dev-guide/src/type-inference.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /src/doc/rustc-dev-guide/src/type-inference.md
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/doc/rustc-dev-guide/src/type-inference.md')
-rw-r--r--src/doc/rustc-dev-guide/src/type-inference.md12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/doc/rustc-dev-guide/src/type-inference.md b/src/doc/rustc-dev-guide/src/type-inference.md
index ca88c1686..2bafeb247 100644
--- a/src/doc/rustc-dev-guide/src/type-inference.md
+++ b/src/doc/rustc-dev-guide/src/type-inference.md
@@ -36,18 +36,16 @@ signature, such as the `'a` in `for<'a> fn(&'a u32)`. A region is
## Creating an inference context
-You create and "enter" an inference context by doing something like
+You create an inference context by doing something like
the following:
```rust,ignore
-tcx.infer_ctxt().enter(|infcx| {
- // Use the inference context `infcx` here.
-})
+let infcx = tcx.infer_ctxt().build();
+// Use the inference context `infcx` here.
```
-Within the closure,
-`infcx` has the type `InferCtxt<'a, 'tcx>` for some fresh `'a`,
-while `'tcx` is the same as outside the inference context.
+`infcx` has the type `InferCtxt<'tcx>`, the same `'tcx` lifetime as on
+the `tcx` it was built from.
The `tcx.infer_ctxt` method actually returns a builder, which means
there are some kinds of configuration you can do before the `infcx` is