Merge pull request #4277 from rust-lang/rustup-2025-04-17
Automatic Rustup
This commit is contained in:
commit
a9433c1eb6
|
|
@ -31,7 +31,6 @@ Term | Meaning
|
||||||
<span id="generics">generics</span> | The list of generic parameters defined on an item. There are three kinds of generic parameters: Type, lifetime and const parameters.
|
<span id="generics">generics</span> | The list of generic parameters defined on an item. There are three kinds of generic parameters: Type, lifetime and const parameters.
|
||||||
<span id="hir">HIR</span> | The _high-level [IR](#ir)_, created by lowering and desugaring the AST. ([see more](../hir.md))
|
<span id="hir">HIR</span> | The _high-level [IR](#ir)_, created by lowering and desugaring the AST. ([see more](../hir.md))
|
||||||
<span id="hir-id">`HirId`</span> | Identifies a particular node in the HIR by combining a def-id with an "intra-definition offset". See [the HIR chapter for more](../hir.md#identifiers-in-the-hir).
|
<span id="hir-id">`HirId`</span> | Identifies a particular node in the HIR by combining a def-id with an "intra-definition offset". See [the HIR chapter for more](../hir.md#identifiers-in-the-hir).
|
||||||
<span id="hir-map">HIR map</span> | The HIR map, accessible via `tcx.hir()`, allows you to quickly navigate the HIR and convert between various forms of identifiers.
|
|
||||||
<span id="ice">ICE</span> | Short for _internal compiler error_, this is when the compiler crashes.
|
<span id="ice">ICE</span> | Short for _internal compiler error_, this is when the compiler crashes.
|
||||||
<span id="ich">ICH</span> | Short for _incremental compilation hash_, these are used as fingerprints for things such as HIR and crate metadata, to check if changes have been made. This is useful in incremental compilation to see if part of a crate has changed and should be recompiled.
|
<span id="ich">ICH</span> | Short for _incremental compilation hash_, these are used as fingerprints for things such as HIR and crate metadata, to check if changes have been made. This is useful in incremental compilation to see if part of a crate has changed and should be recompiled.
|
||||||
<span id="infcx">`infcx`</span> | The type inference context (`InferCtxt`). (see `rustc_middle::infer`)
|
<span id="infcx">`infcx`</span> | The type inference context (`InferCtxt`). (see `rustc_middle::infer`)
|
||||||
|
|
|
||||||
|
|
@ -109,11 +109,16 @@ like Python or LLVM.
|
||||||
|
|
||||||
Here is an example of how can `opt-dist` be used locally (outside of CI):
|
Here is an example of how can `opt-dist` be used locally (outside of CI):
|
||||||
|
|
||||||
1. Build the tool with the following command:
|
1. Enable metrics in your `bootstrap.toml` file, because `opt-dist` expects it to be enabled:
|
||||||
|
```toml
|
||||||
|
[build]
|
||||||
|
metrics = true
|
||||||
|
```
|
||||||
|
2. Build the tool with the following command:
|
||||||
```bash
|
```bash
|
||||||
./x build tools/opt-dist
|
./x build tools/opt-dist
|
||||||
```
|
```
|
||||||
2. Run the tool with the `local` mode and provide necessary parameters:
|
3. Run the tool with the `local` mode and provide necessary parameters:
|
||||||
```bash
|
```bash
|
||||||
./build/host/stage0-tools-bin/opt-dist local \
|
./build/host/stage0-tools-bin/opt-dist local \
|
||||||
--target-triple <target> \ # select target, e.g. "x86_64-unknown-linux-gnu"
|
--target-triple <target> \ # select target, e.g. "x86_64-unknown-linux-gnu"
|
||||||
|
|
|
||||||
|
|
@ -301,7 +301,8 @@ Right below you can find elaborate explainers on a selected few.
|
||||||
|
|
||||||
Some compiler options for debugging specific features yield graphviz graphs -
|
Some compiler options for debugging specific features yield graphviz graphs -
|
||||||
e.g. the `#[rustc_mir(borrowck_graphviz_postflow="suffix.dot")]` attribute
|
e.g. the `#[rustc_mir(borrowck_graphviz_postflow="suffix.dot")]` attribute
|
||||||
dumps various borrow-checker dataflow graphs.
|
on a function dumps various borrow-checker dataflow graphs in conjunction with
|
||||||
|
`-Zdump-mir-dataflow`.
|
||||||
|
|
||||||
These all produce `.dot` files. To view these files, install graphviz (e.g.
|
These all produce `.dot` files. To view these files, install graphviz (e.g.
|
||||||
`apt-get install graphviz`) and then run the following commands:
|
`apt-get install graphviz`) and then run the following commands:
|
||||||
|
|
|
||||||
43
src/hir.md
43
src/hir.md
|
|
@ -100,7 +100,7 @@ The HIR uses a bunch of different identifiers that coexist and serve different p
|
||||||
a wrapper around a [`HirId`]. For more info about HIR bodies, please refer to the
|
a wrapper around a [`HirId`]. For more info about HIR bodies, please refer to the
|
||||||
[HIR chapter][hir-bodies].
|
[HIR chapter][hir-bodies].
|
||||||
|
|
||||||
These identifiers can be converted into one another through the [HIR map][map].
|
These identifiers can be converted into one another through the `TyCtxt`.
|
||||||
|
|
||||||
[`DefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefId.html
|
[`DefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefId.html
|
||||||
[`LocalDefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.LocalDefId.html
|
[`LocalDefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.LocalDefId.html
|
||||||
|
|
@ -110,30 +110,24 @@ These identifiers can be converted into one another through the [HIR map][map].
|
||||||
[`CrateNum`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.CrateNum.html
|
[`CrateNum`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.CrateNum.html
|
||||||
[`DefIndex`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefIndex.html
|
[`DefIndex`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.DefIndex.html
|
||||||
[`Body`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Body.html
|
[`Body`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Body.html
|
||||||
[hir-map]: ./hir.md#the-hir-map
|
|
||||||
[hir-bodies]: ./hir.md#hir-bodies
|
[hir-bodies]: ./hir.md#hir-bodies
|
||||||
[map]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html
|
|
||||||
|
|
||||||
## The HIR Map
|
## HIR Operations
|
||||||
|
|
||||||
Most of the time when you are working with the HIR, you will do so via
|
Most of the time when you are working with the HIR, you will do so via
|
||||||
the **HIR Map**, accessible in the tcx via [`tcx.hir()`] (and defined in
|
`TyCtxt`. It contains a number of methods, defined in the `hir::map` module and
|
||||||
the [`hir::map`] module). The [HIR map] contains a [number of methods] to
|
mostly prefixed with `hir_`, to convert between IDs of various kinds and to
|
||||||
convert between IDs of various kinds and to lookup data associated
|
lookup data associated with a HIR node.
|
||||||
with a HIR node.
|
|
||||||
|
|
||||||
[`tcx.hir()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir
|
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html
|
||||||
[`hir::map`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/index.html
|
|
||||||
[HIR map]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html
|
|
||||||
[number of methods]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#methods
|
|
||||||
|
|
||||||
For example, if you have a [`LocalDefId`], and you would like to convert it
|
For example, if you have a [`LocalDefId`], and you would like to convert it
|
||||||
to a [`HirId`], you can use [`tcx.hir().local_def_id_to_hir_id(def_id)`][local_def_id_to_hir_id].
|
to a [`HirId`], you can use [`tcx.local_def_id_to_hir_id(def_id)`][local_def_id_to_hir_id].
|
||||||
You need a `LocalDefId`, rather than a `DefId`, since only local items have HIR nodes.
|
You need a `LocalDefId`, rather than a `DefId`, since only local items have HIR nodes.
|
||||||
|
|
||||||
[local_def_id_to_hir_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.local_def_id_to_hir_id
|
[local_def_id_to_hir_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.local_def_id_to_hir_id
|
||||||
|
|
||||||
Similarly, you can use [`tcx.hir().find(n)`][find] to lookup the node for a
|
Similarly, you can use [`tcx.hir_node(n)`][hir_node] to lookup the node for a
|
||||||
[`HirId`]. This returns a `Option<Node<'hir>>`, where [`Node`] is an enum
|
[`HirId`]. This returns a `Option<Node<'hir>>`, where [`Node`] is an enum
|
||||||
defined in the map. By matching on this, you can find out what sort of
|
defined in the map. By matching on this, you can find out what sort of
|
||||||
node the `HirId` referred to and also get a pointer to the data
|
node the `HirId` referred to and also get a pointer to the data
|
||||||
|
|
@ -142,15 +136,16 @@ that `n` must be some HIR expression, you can do
|
||||||
[`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the
|
[`tcx.hir_expect_expr(n)`][expect_expr], which will extract and return the
|
||||||
[`&hir::Expr`][Expr], panicking if `n` is not in fact an expression.
|
[`&hir::Expr`][Expr], panicking if `n` is not in fact an expression.
|
||||||
|
|
||||||
[find]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.find
|
[hir_node]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_node
|
||||||
[`Node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html
|
[`Node`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.Node.html
|
||||||
[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.expect_expr
|
[expect_expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.expect_expr
|
||||||
[Expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Expr.html
|
[Expr]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Expr.html
|
||||||
|
|
||||||
Finally, you can use the HIR map to find the parents of nodes, via
|
Finally, you can find the parents of nodes, via
|
||||||
calls like [`tcx.hir().get_parent(n)`][get_parent].
|
calls like [`tcx.parent_hir_node(n)`][parent_hir_node].
|
||||||
|
|
||||||
|
[get_parent_item]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.parent_hir_node
|
||||||
|
|
||||||
[get_parent]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.get_parent
|
|
||||||
|
|
||||||
## HIR Bodies
|
## HIR Bodies
|
||||||
|
|
||||||
|
|
@ -158,10 +153,10 @@ A [`rustc_hir::Body`] represents some kind of executable code, such as the body
|
||||||
of a function/closure or the definition of a constant. Bodies are
|
of a function/closure or the definition of a constant. Bodies are
|
||||||
associated with an **owner**, which is typically some kind of item
|
associated with an **owner**, which is typically some kind of item
|
||||||
(e.g. an `fn()` or `const`), but could also be a closure expression
|
(e.g. an `fn()` or `const`), but could also be a closure expression
|
||||||
(e.g. `|x, y| x + y`). You can use the HIR map to find the body
|
(e.g. `|x, y| x + y`). You can use the `TyCtxt` to find the body
|
||||||
associated with a given def-id ([`maybe_body_owned_by`]) or to find
|
associated with a given def-id ([`hir_maybe_body_owned_by`]) or to find
|
||||||
the owner of a body ([`body_owner_def_id`]).
|
the owner of a body ([`hir_body_owner_def_id`]).
|
||||||
|
|
||||||
[`rustc_hir::Body`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Body.html
|
[`rustc_hir::Body`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.Body.html
|
||||||
[`maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.maybe_body_owned_by
|
[`hir_maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_maybe_body_owned_by
|
||||||
[`body_owner_def_id`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.body_owner_def_id
|
[`hir_body_owner_def_id`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_body_owner_def_id
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ for more details.
|
||||||
| `normalize-stdout` | Normalize actual stdout with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
|
| `normalize-stdout` | Normalize actual stdout with a rule `"<raw>" -> "<normalized>"` before comparing against snapshot | `ui`, `incremental` | `"<RAW>" -> "<NORMALIZED>"`, `<RAW>`/`<NORMALIZED>` is regex capture and replace syntax |
|
||||||
| `dont-check-compiler-stderr` | Don't check actual compiler stderr vs stderr snapshot | `ui` | N/A |
|
| `dont-check-compiler-stderr` | Don't check actual compiler stderr vs stderr snapshot | `ui` | N/A |
|
||||||
| `dont-check-compiler-stdout` | Don't check actual compiler stdout vs stdout snapshot | `ui` | N/A |
|
| `dont-check-compiler-stdout` | Don't check actual compiler stdout vs stdout snapshot | `ui` | N/A |
|
||||||
|
| `dont-require-annotations` | Don't require line annotations for the given diagnostic kind (`//~ KIND`) to be exhaustive | `ui`, `incremental` | `ERROR`, `WARN`, `NOTE`, `HELP`, `SUGGESTION` |
|
||||||
| `run-rustfix` | Apply all suggestions via `rustfix`, snapshot fixed output, and check fixed output builds | `ui` | N/A |
|
| `run-rustfix` | Apply all suggestions via `rustfix`, snapshot fixed output, and check fixed output builds | `ui` | N/A |
|
||||||
| `rustfix-only-machine-applicable` | `run-rustfix` but only machine-applicable suggestions | `ui` | N/A |
|
| `rustfix-only-machine-applicable` | `run-rustfix` but only machine-applicable suggestions | `ui` | N/A |
|
||||||
| `exec-env` | Env var to set when executing a test | `ui`, `crashes` | `<KEY>=<VALUE>` |
|
| `exec-env` | Env var to set when executing a test | `ui`, `crashes` | `<KEY>=<VALUE>` |
|
||||||
|
|
|
||||||
|
|
@ -303,8 +303,7 @@ It should be preferred to using `error-pattern`, which is imprecise and non-exha
|
||||||
### `error-pattern`
|
### `error-pattern`
|
||||||
|
|
||||||
The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't
|
The `error-pattern` [directive](directives.md) can be used for runtime messages, which don't
|
||||||
have a specific span, or for compile time messages if imprecise matching is required due to
|
have a specific span, or in exceptional cases for compile time messages.
|
||||||
multi-line platform specific diagnostics.
|
|
||||||
|
|
||||||
Let's think about this test:
|
Let's think about this test:
|
||||||
|
|
||||||
|
|
@ -318,7 +317,7 @@ fn main() {
|
||||||
```
|
```
|
||||||
|
|
||||||
We want to ensure this shows "index out of bounds" but we cannot use the `ERROR`
|
We want to ensure this shows "index out of bounds" but we cannot use the `ERROR`
|
||||||
annotation since the error doesn't have any span. Then it's time to use the
|
annotation since the runtime error doesn't have any span. Then it's time to use the
|
||||||
`error-pattern` directive:
|
`error-pattern` directive:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
|
|
@ -331,29 +330,51 @@ fn main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
But for strict testing, try to use the `ERROR` annotation as much as possible,
|
Use of `error-pattern` is not recommended in general.
|
||||||
including `//~?` annotations for diagnostics without span.
|
|
||||||
For compile time diagnostics `error-pattern` should very rarely be necessary.
|
|
||||||
|
|
||||||
Per-line annotations (`//~`) are still checked in tests using `error-pattern`.
|
For strict testing of compile time output, try to use the line annotations `//~` as much as
|
||||||
To opt out of these checks, use `//@ compile-flags: --error-format=human`.
|
possible, including `//~?` annotations for diagnostics without span.
|
||||||
Do that only in exceptional cases.
|
|
||||||
|
|
||||||
### Error levels
|
If the compile time output is target dependent or too verbose, use directive
|
||||||
|
`//@ dont-require-annotations: <diagnostic-kind>` to make the line annotation checking
|
||||||
|
non-exhaustive, some of the compiler messages can stay uncovered by annotations in this mode.
|
||||||
|
|
||||||
The error levels that you can have are:
|
For checking runtime output `//@ check-run-results` may be preferable.
|
||||||
|
|
||||||
|
Only use `error-pattern` if none of the above works.
|
||||||
|
|
||||||
|
Line annotations `//~` are still checked in tests using `error-pattern`.
|
||||||
|
In exceptional cases use `//@ compile-flags: --error-format=human` to opt out of these checks.
|
||||||
|
|
||||||
|
### Diagnostic kinds (error levels)
|
||||||
|
|
||||||
|
The diagnostic kinds that you can have are:
|
||||||
|
|
||||||
- `ERROR`
|
- `ERROR`
|
||||||
- `WARN` or `WARNING`
|
- `WARN` (or `WARNING`)
|
||||||
- `NOTE`
|
- `NOTE`
|
||||||
- `HELP` and `SUGGESTION`
|
- `HELP`
|
||||||
|
- `SUGGESTION`
|
||||||
|
|
||||||
You are allowed to not include a level, but you should include it at least for
|
The `SUGGESTION` kind is used for specifying what the expected replacement text
|
||||||
the primary message.
|
|
||||||
|
|
||||||
The `SUGGESTION` level is used for specifying what the expected replacement text
|
|
||||||
should be for a diagnostic suggestion.
|
should be for a diagnostic suggestion.
|
||||||
|
|
||||||
|
`ERROR` and `WARN` kinds are required to be exhaustively covered by line annotations
|
||||||
|
`//~` by default.
|
||||||
|
|
||||||
|
Other kinds only need to be line-annotated if at least one annotation of that kind appears
|
||||||
|
in the test file. For example, one `//~ NOTE` will also require all other `//~ NOTE`s in the file
|
||||||
|
to be written out explicitly.
|
||||||
|
|
||||||
|
Use directive `//@ dont-require-annotations` to opt out of exhaustive annotations.
|
||||||
|
E.g. use `//@ dont-require-annotations: NOTE` to annotate notes selectively.
|
||||||
|
Avoid using this directive for `ERROR`s and `WARN`ings, unless there's a serious reason, like
|
||||||
|
target-dependent compiler output.
|
||||||
|
|
||||||
|
Missing diagnostic kinds (`//~ message`) are currently accepted, but are being phased away.
|
||||||
|
They will match any compiler output kind, but will not force exhaustive annotations for that kind.
|
||||||
|
Prefer explicit kind and `//@ dont-require-annotations` to achieve the same effect.
|
||||||
|
|
||||||
UI tests use the `-A unused` flag by default to ignore all unused warnings, as
|
UI tests use the `-A unused` flag by default to ignore all unused warnings, as
|
||||||
unused warnings are usually not the focus of a test. However, simple code
|
unused warnings are usually not the focus of a test. However, simple code
|
||||||
samples often have unused warnings. If the test is specifically testing an
|
samples often have unused warnings. If the test is specifically testing an
|
||||||
|
|
|
||||||
|
|
@ -61,11 +61,11 @@ Here is a summary:
|
||||||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| Describe the *syntax* of a type: what the user wrote (with some desugaring). | Describe the *semantics* of a type: the meaning of what the user wrote. |
|
| Describe the *syntax* of a type: what the user wrote (with some desugaring). | Describe the *semantics* of a type: the meaning of what the user wrote. |
|
||||||
| Each `rustc_hir::Ty` has its own spans corresponding to the appropriate place in the program. | Doesn’t correspond to a single place in the user’s program. |
|
| Each `rustc_hir::Ty` has its own spans corresponding to the appropriate place in the program. | Doesn’t correspond to a single place in the user’s program. |
|
||||||
| `rustc_hir::Ty` has generics and lifetimes; however, some of those lifetimes are special markers like [`LifetimeName::Implicit`][implicit]. | `ty::Ty` has the full type, including generics and lifetimes, even if the user left them out |
|
| `rustc_hir::Ty` has generics and lifetimes; however, some of those lifetimes are special markers like [`LifetimeKind::Implicit`][implicit]. | `ty::Ty` has the full type, including generics and lifetimes, even if the user left them out |
|
||||||
| `fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`, each has its own `Span`s, and `rustc_hir::Ty` doesn’t tell us that both are the same type | `fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program, and `ty::Ty` tells us that both usages of `u32` mean the same type. |
|
| `fn foo(x: u32) → u32 { }` - Two `rustc_hir::Ty` representing each usage of `u32`, each has its own `Span`s, and `rustc_hir::Ty` doesn’t tell us that both are the same type | `fn foo(x: u32) → u32 { }` - One `ty::Ty` for all instances of `u32` throughout the program, and `ty::Ty` tells us that both usages of `u32` mean the same type. |
|
||||||
| `fn foo(x: &u32) -> &u32)` - Two `rustc_hir::Ty` again. Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeName::Implicit`][implicit]. | `fn foo(x: &u32) -> &u32)`- A single `ty::Ty`. The `ty::Ty` has the hidden lifetime param. |
|
| `fn foo(x: &u32) -> &u32)` - Two `rustc_hir::Ty` again. Lifetimes for the references show up in the `rustc_hir::Ty`s using a special marker, [`LifetimeKind::Implicit`][implicit]. | `fn foo(x: &u32) -> &u32)`- A single `ty::Ty`. The `ty::Ty` has the hidden lifetime param. |
|
||||||
|
|
||||||
[implicit]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.LifetimeName.html#variant.Implicit
|
[implicit]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/enum.LifetimeKind.html#variant.Implicit
|
||||||
|
|
||||||
**Order**
|
**Order**
|
||||||
|
|
||||||
|
|
@ -323,4 +323,4 @@ When looking at the debug output of `Ty` or simply talking about different types
|
||||||
- Generic parameters: `{name}/#{index}` e.g. `T/#0`, where `index` corresponds to its position in the list of generic parameters
|
- Generic parameters: `{name}/#{index}` e.g. `T/#0`, where `index` corresponds to its position in the list of generic parameters
|
||||||
- Inference variables: `?{id}` e.g. `?x`/`?0`, where `id` identifies the inference variable
|
- Inference variables: `?{id}` e.g. `?x`/`?0`, where `id` identifies the inference variable
|
||||||
- Variables from binders: `^{binder}_{index}` e.g. `^0_x`/`^0_2`, where `binder` and `index` identify which variable from which binder is being referred to
|
- Variables from binders: `^{binder}_{index}` e.g. `^0_x`/`^0_2`, where `binder` and `index` identify which variable from which binder is being referred to
|
||||||
- Placeholders: `!{id}` or `!{id}_{universe}` e.g. `!x`/`!0`/`!x_2`/`!0_2`, representing some unique type in the specified universe. The universe is often elided when it is `0`
|
- Placeholders: `!{id}` or `!{id}_{universe}` e.g. `!x`/`!0`/`!x_2`/`!0_2`, representing some unique type in the specified universe. The universe is often elided when it is `0`
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue