Skip to content

Rustc pull update #2347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 136 commits into from
Apr 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
136 commits
Select commit Hold shift + click to select a range
877f981
Rollup merge of #139523 - BoxyUwU:rgd-push, r=jieyouxu
matthiaskrgr Apr 8, 2025
69fdbc5
Rollup merge of #139526 - smanilov:issue-139505, r=RalfJung
matthiaskrgr Apr 8, 2025
af6d4f7
Rollup merge of #139528 - Zalathar:no-logfile, r=jieyouxu
matthiaskrgr Apr 8, 2025
8fcd548
Rollup merge of #139541 - compiler-errors:transmute, r=lcnr
matthiaskrgr Apr 8, 2025
b2148a8
Rollup merge of #139547 - joshtriplett:library-tracking-issue-templat…
matthiaskrgr Apr 8, 2025
cd593d4
Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgr
bors Apr 9, 2025
771483b
Auto merge of #139327 - cjgillot:gvn-place, r=oli-obk
bors Apr 9, 2025
f34fa18
Remove redundant words
timesince Apr 9, 2025
df1012c
Rollup merge of #138470 - spastorino:test-rfc2229-and-ergonomic-clone…
matthiaskrgr Apr 9, 2025
89ae2e6
Rollup merge of #138628 - spastorino:add-more-ergonomic-clone-tests, …
matthiaskrgr Apr 9, 2025
42776aa
Rollup merge of #139164 - xizheyin:issue-139034, r=joboet
matthiaskrgr Apr 9, 2025
0729b0d
Rollup merge of #139488 - GuillaumeGomez:add-missing-gui-test, r=camelid
matthiaskrgr Apr 9, 2025
370fa41
Rollup merge of #139489 - petrochenkov:noreqann, r=jieyouxu
matthiaskrgr Apr 9, 2025
5b53ce5
Rollup merge of #139521 - jieyouxu:compiler-doc-reviewers, r=Guillaum…
matthiaskrgr Apr 9, 2025
3b882a3
Rollup merge of #139532 - bjoernager:master, r=tgross35
matthiaskrgr Apr 9, 2025
32508ba
Rollup merge of #139551 - jogru0:121672, r=oli-obk
matthiaskrgr Apr 9, 2025
bc33f3a
Rollup merge of #139575 - timesince:master, r=wesleywiser
matthiaskrgr Apr 9, 2025
ece5fe4
Auto merge of #139595 - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgr
bors Apr 9, 2025
ac45025
Auto merge of #139279 - BoxyUwU:bump-boostrap, r=jieyouxu
bors Apr 10, 2025
eb617fa
Auto merge of #139000 - compiler-errors:rigid-missing-item, r=lcnr
bors Apr 10, 2025
5fb6b8e
rustc-dev-guide: document `needs-crate-type`
jieyouxu Apr 7, 2025
5e11c73
Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikoma…
bors Apr 10, 2025
d7631d2
mention --edition restrictions in rustc-dev-guide
pietroalbini Apr 10, 2025
929fb09
Auto merge of #137412 - scottmcm:redo-swap, r=cuviper
bors Apr 10, 2025
0423c7b
dev-guide: Document `dont-require-annotations`
petrochenkov Apr 10, 2025
a9f8f1e
Auto merge of #139410 - Zoxc:fix-dep-graph-no-prev-map, r=oli-obk
bors Apr 10, 2025
cc1799b
Rollup merge of #137447 - folkertdev:simd-extract-insert-dyn, r=scottmcm
Zalathar Apr 11, 2025
6eb87ab
Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-dead
Zalathar Apr 11, 2025
8203589
Rollup merge of #138904 - madsmtm:apple-test-no-std, r=tgross35
Zalathar Apr 11, 2025
cee93ce
Rollup merge of #138998 - rperier:donot_suggest_to_use_impl_trait_in_…
Zalathar Apr 11, 2025
f69bf05
Rollup merge of #139447 - izarma:issue-108131-fix, r=scottmcm
Zalathar Apr 11, 2025
a6bbbd8
Rollup merge of #139469 - jieyouxu:compiletest-supports-crate-type, r…
Zalathar Apr 11, 2025
96e5184
Rollup merge of #139564 - compiler-errors:deeply-norm, r=lcnr
Zalathar Apr 11, 2025
6de146f
Rollup merge of #139574 - onur-ozkan:better-channel-handling, r=onur-…
Zalathar Apr 11, 2025
ad31b96
Rollup merge of #139600 - tgross35:update-builtins, r=tgross35
Zalathar Apr 11, 2025
7a9ecba
Rollup merge of #139641 - BoxyUwU:allow_parend_array_len_infer, r=com…
Zalathar Apr 11, 2025
109b98a
Rollup merge of #139654 - nnethercote:AssocKind-descr, r=compiler-errors
Zalathar Apr 11, 2025
22551ca
Auto merge of #139657 - Zalathar:rollup-6oh6f9q, r=Zalathar
bors Apr 11, 2025
e5fa266
Auto merge of #139011 - Zoxc:no-rayon-iters, r=oli-obk
bors Apr 11, 2025
9f227ff
Auto merge of #139578 - ferrocene:pa-compiletest-edition, r=jieyouxu
bors Apr 11, 2025
4dc1ed6
Auto merge of #139453 - compiler-errors:incr, r=jieyouxu
bors Apr 11, 2025
15fe2af
Auto merge of #139588 - Kobzol:rust-analyzer-opt, r=jieyouxu
bors Apr 11, 2025
35acfcc
Document that `opt-dist` requires metrics to be enabled
Kobzol Apr 11, 2025
2c319b3
Auto merge of #139430 - scottmcm:polymorphic-array-into-iter, r=cuviper
bors Apr 11, 2025
7256791
Auto merge of #139640 - Zoxc:big-file-encoder, r=saethlin
bors Apr 12, 2025
de841b0
Rollup merge of #139107 - joboet:safe_cmath, r=ibraheemdev
ChrisDenton Apr 13, 2025
9f95722
Rollup merge of #139607 - reddevilmidzy:add-regression-test, r=petroc…
ChrisDenton Apr 13, 2025
7fff5b9
Rollup merge of #139691 - Kobzol:opt-dist-docs, r=jieyouxu
ChrisDenton Apr 13, 2025
0d352f9
Rollup merge of #139707 - Kobzol:fix-comment, r=jieyouxu
ChrisDenton Apr 13, 2025
79d8c09
Rollup merge of #139708 - samueltardieu:push-onttwlpwurov, r=petroche…
ChrisDenton Apr 13, 2025
0cb2eef
Rollup merge of #139709 - tshepang:patch-5, r=Kobzol
ChrisDenton Apr 13, 2025
3c3a67a
Auto merge of #139734 - ChrisDenton:rollup-28qn740, r=ChrisDenton
bors Apr 13, 2025
26a5711
Auto merge of #138881 - scottmcm:more-chaining-ord, r=Mark-Simulacrum
bors Apr 13, 2025
a71dce1
Rollup merge of #138972 - thaliaarchi:nuttx-build, r=Mark-Simulacrum
ChrisDenton Apr 13, 2025
36598bc
Rollup merge of #139177 - fneddy:fix_s390x_codegen_bswap, r=Mark-Simu…
ChrisDenton Apr 13, 2025
b514a60
Rollup merge of #139511 - Zalathar:panic-payload, r=Mark-Simulacrum
ChrisDenton Apr 13, 2025
93ed03c
Rollup merge of #139605 - oyvindln:update_miniz_oxide_0_8, r=Mark-Sim…
ChrisDenton Apr 13, 2025
6a7bff3
Rollup merge of #139618 - petrochenkov:virsugg, r=jieyouxu
ChrisDenton Apr 13, 2025
eeebd4c
Rollup merge of #139677 - jchecahi:profiler-builtin-rtlib-path-fix, r…
ChrisDenton Apr 13, 2025
95cae2e
Rollup merge of #139683 - ChrisDenton:windows-with-native, r=tgross35…
ChrisDenton Apr 13, 2025
ba9d8ee
Rollup merge of #139710 - thaliaarchi:move-args-pal, r=joboet
ChrisDenton Apr 13, 2025
7f4e654
Rollup merge of #139721 - dtolnay:stage0newline, r=onur-ozkan
ChrisDenton Apr 13, 2025
cc87909
Rollup merge of #139726 - Amanieu:select_unpredictable_hint, r=dtolnay
ChrisDenton Apr 13, 2025
5fcc3ff
Auto merge of #139746 - ChrisDenton:rollup-eq08b2e, r=ChrisDenton
bors Apr 13, 2025
b557b97
Documentation fixes.
nnethercote Apr 2, 2025
270e89f
Auto merge of #124141 - nnethercote:rm-Nonterminal-and-TokenKind-Inte…
bors Apr 14, 2025
5ab7e2b
Auto merge of #139241 - bvanjoi:less-decoding, r=petrochenkov
bors Apr 14, 2025
7996517
Auto merge of #139577 - davidtwco:sizedness-go-vroom, r=oli-obk
bors Apr 14, 2025
c484cd4
Rollup merge of #138374 - celinval:issue-136925-const-contract, r=com…
Zalathar Apr 15, 2025
02306a0
Rollup merge of #138393 - oli-obk:pattern-type-in-pattern, r=BoxyUwU
Zalathar Apr 15, 2025
2098ff4
Rollup merge of #139517 - Ayush1325:uefi-cmd-stdin-null, r=joboet
Zalathar Apr 15, 2025
8e9dbe8
Rollup merge of #139554 - lolbinarycat:std-output-exit_ok, r=tgross35
Zalathar Apr 15, 2025
d3fe043
Rollup merge of #139671 - m-ou-se:proc-macro-span, r=dtolnay
Zalathar Apr 15, 2025
6ca7376
Rollup merge of #139750 - no1wudi:fix, r=tgross35
Zalathar Apr 15, 2025
516d5cd
Rollup merge of #139772 - nnethercote:rm-hir-Map, r=Zalathar
Zalathar Apr 15, 2025
a22ebdb
Rollup merge of #139785 - fneddy:fix_test_cstring_merging_alignment, …
Zalathar Apr 15, 2025
061cfbe
Rollup merge of #139789 - lcnr:opaques-auto-trait-leakage, r=compiler…
Zalathar Apr 15, 2025
f0071f2
Rollup merge of #139791 - lcnr:ignore-global-where-bounds, r=compiler…
Zalathar Apr 15, 2025
3b1519e
Rollup merge of #139798 - lcnr:where-bounds-gt-alias-bound, r=compile…
Zalathar Apr 15, 2025
cea8d5f
Rollup merge of #139822 - 0x79de:fix-eopnotsupp-mapping, r=dtolnay
Zalathar Apr 15, 2025
7264d9a
Rollup merge of #139833 - nnethercote:fix-139633, r=oli-obk
Zalathar Apr 15, 2025
fa42121
Rollup merge of #139836 - glyn:test-mpmc-receiver-cloning, r=jhpratt
Zalathar Apr 15, 2025
dd38836
Auto merge of #139845 - Zalathar:rollup-u5u5y1v, r=Zalathar
bors Apr 15, 2025
d473cb1
Auto merge of #139632 - Darksonn:cfi-fmt, r=m-ou-se
bors Apr 15, 2025
33ba43c
Auto merge of #138906 - thaliaarchi:unsupported-test-exe, r=bjorn3
bors Apr 15, 2025
220d208
Rename `LifetimeName` as `LifetimeKind`.
nnethercote Mar 27, 2025
299077b
Improve `borrowck_graphviz_*` documentation.
nnethercote Apr 15, 2025
e3d7440
Auto merge of #139768 - compiler-errors:split-fold, r=lcnr
bors Apr 16, 2025
94acf3c
Auto merge of #136926 - wesleywiser:stabilize_dwarf-version, r=petroc…
bors Apr 16, 2025
220d9b5
Rollup merge of #139823 - WaffleLapkin:bootpaper, r=jieyouxu
matthiaskrgr Apr 16, 2025
82387c2
Rollup merge of #139867 - WaffleLapkin:tidypaper, r=jieyouxu
matthiaskrgr Apr 16, 2025
d1c1853
Rollup merge of #139886 - nnethercote:graphviz_borrowck, r=compiler-e…
matthiaskrgr Apr 16, 2025
133222d
Rollup merge of #139893 - reddevilmidzy:add-test, r=SparrowLii
matthiaskrgr Apr 16, 2025
f869bb3
Auto merge of #139912 - matthiaskrgr:rollup-va0rqvk, r=matthiaskrgr
bors Apr 16, 2025
525f20e
Auto merge of #138011 - tnewsome-lynx:lynxos_178-nostd, r=davidtwco
bors Apr 16, 2025
e00e27c
Rollup merge of #139084 - petrochenkov:transpaque, r=davidtwco
matthiaskrgr Apr 16, 2025
ab424e0
Rollup merge of #139236 - Zoxc:anon-counter, r=davidtwco
matthiaskrgr Apr 16, 2025
5230faf
Rollup merge of #139650 - Alexendoo:group-alias, r=davidtwco
matthiaskrgr Apr 16, 2025
960baa6
Rollup merge of #139770 - nnethercote:rename-LifetimeName, r=BoxyUwU
matthiaskrgr Apr 16, 2025
32e8599
Rollup merge of #139846 - nnethercote:kw-Empty-rustdoc, r=GuillaumeGomez
matthiaskrgr Apr 16, 2025
5f94f83
Rollup merge of #139891 - pvdrz:add-dso-local, r=scottmcm
matthiaskrgr Apr 16, 2025
7b08723
Rollup merge of #139908 - Zalathar:no-ascription, r=jieyouxu
matthiaskrgr Apr 16, 2025
a81584e
Rollup merge of #139917 - folkertdev:fn-align-multiple, r=jdonszelmann
matthiaskrgr Apr 16, 2025
c9b3d32
Rollup merge of #135340 - obeis:explicit-extern-abis, r=traviscross,n…
matthiaskrgr Apr 16, 2025
46105e7
Rollup merge of #139440 - a4lg:riscv-feature-addition-batch-2, r=Amanieu
matthiaskrgr Apr 16, 2025
821337e
Rollup merge of #139667 - 1c3t3a:remove-no-sanitize, r=m-ou-se
matthiaskrgr Apr 16, 2025
d6a17e0
Rollup merge of #139828 - compiler-errors:rigid-trait, r=lcnr
matthiaskrgr Apr 16, 2025
b2d0c0e
Rollup merge of #139854 - fmease:modern-diag-for-lt-in-ty, r=davidtwco
matthiaskrgr Apr 16, 2025
f513131
Rollup merge of #139889 - spencer3035:clean-ui-tests-3-of-n, r=jieyouxu
matthiaskrgr Apr 16, 2025
869b8ba
Rollup merge of #139894 - Kobzol:opt-dist-fixes, r=lqd
matthiaskrgr Apr 16, 2025
6dbcbae
Rollup merge of #139900 - lcnr:normalizes-to-where-bounds-unproductiv…
matthiaskrgr Apr 16, 2025
ca95fe7
Rollup merge of #139915 - RalfJung:intrinsic-imports, r=compiler-errors
matthiaskrgr Apr 16, 2025
f80260b
Auto merge of #139938 - matthiaskrgr:rollup-19ddpus, r=matthiaskrgr
bors Apr 17, 2025
dfb06b2
Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, r=davi…
matthiaskrgr Apr 17, 2025
0e567a5
Rollup merge of #139416 - mejrs:metavar, r=tgross35
matthiaskrgr Apr 17, 2025
633fa26
Rollup merge of #139782 - xizheyin:issue-139627, r=wesleywiser
matthiaskrgr Apr 17, 2025
e81bb22
Rollup merge of #139885 - jyn514:doc-rustc-bootstrap, r=Nadrieril
matthiaskrgr Apr 17, 2025
bb4772e
Rollup merge of #139904 - ferrocene:lw-wkumpwrytvtp, r=nnethercote,ji…
matthiaskrgr Apr 17, 2025
7bf31a2
Rollup merge of #139948 - jieyouxu:ignore-breakup-commit, r=onur-ozkan
matthiaskrgr Apr 17, 2025
1954586
Auto merge of #139940 - matthiaskrgr:rollup-rd4d3fn, r=matthiaskrgr
bors Apr 17, 2025
b0405d6
Auto merge of #139926 - weihanglo:update-cargo, r=weihanglo
bors Apr 17, 2025
bde086e
rustc-dev-guide: document `//@ ignore-auxiliary`
jieyouxu Apr 17, 2025
21cacd1
Auto merge of #139949 - matthiaskrgr:rollup-pxc5tsx, r=matthiaskrgr
bors Apr 17, 2025
f233b93
Rollup merge of #139351 - EnzymeAD:autodiff-batching2, r=oli-obk
matthiaskrgr Apr 17, 2025
0234dc1
Rollup merge of #139483 - RalfJung:nan, r=tgross35
matthiaskrgr Apr 17, 2025
579e1a4
Rollup merge of #139498 - alexcrichton:wasm-zst-safe, r=wesleywiser
matthiaskrgr Apr 17, 2025
1234dc2
Rollup merge of #139967 - jieyouxu:auxiliary, r=wesleywiser
matthiaskrgr Apr 17, 2025
2806093
Rollup merge of #139969 - psumbera:libc-rust-analyzer, r=lnicola
matthiaskrgr Apr 17, 2025
4b43451
Rollup merge of #139971 - LukasWoodtli:gardena/lw/fix-cstring-merging…
matthiaskrgr Apr 17, 2025
d144470
Rollup merge of #139974 - Patrick-6:change-visibility, r=RalfJung
matthiaskrgr Apr 17, 2025
30bd464
Rollup merge of #139977 - Amanieu:select_unpredictable_drop, r=RalfJung
matthiaskrgr Apr 17, 2025
33a7934
Auto merge of #139992 - matthiaskrgr:rollup-ak3uibu, r=matthiaskrgr
bors Apr 17, 2025
a63811d
Auto merge of #139114 - m-ou-se:super-let-pin, r=davidtwco
bors Apr 19, 2025
85a22b8
Preparing for merge from rustc
invalid-email-address Apr 19, 2025
87eb26f
Merge from rustc
invalid-email-address Apr 19, 2025
3a23ec2
fix broken link
tshepang Apr 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
25a615bf829b9f6d6f22da537e3851043f92e5f2
a7c39b68616668a45f0afd62849a1da7c8ad2516
1 change: 0 additions & 1 deletion src/appendix/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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="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-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="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`)
Expand Down
9 changes: 7 additions & 2 deletions src/building/optimized-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,16 @@ like Python or LLVM.

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
./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
./build/host/stage0-tools-bin/opt-dist local \
--target-triple <target> \ # select target, e.g. "x86_64-unknown-linux-gnu"
Expand Down
3 changes: 2 additions & 1 deletion src/compiler-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -
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.
`apt-get install graphviz`) and then run the following commands:
Expand Down
43 changes: 19 additions & 24 deletions src/hir.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[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
[`LocalDefId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.LocalDefId.html
Expand All @@ -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
[`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
[hir-map]: ./hir.md#the-hir-map
[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
the **HIR Map**, accessible in the tcx via [`tcx.hir()`] (and defined in
the [`hir::map`] module). The [HIR map] contains a [number of methods] to
convert between IDs of various kinds and to lookup data associated
with a HIR node.
`TyCtxt`. It contains a number of methods, defined in the `hir::map` module and
mostly prefixed with `hir_`, to convert between IDs of various kinds and to
lookup data associated with a HIR node.

[`tcx.hir()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir
[`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
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html

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.

[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
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
Expand All @@ -142,26 +136,27 @@ that `n` must be some HIR expression, you can do
[`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.

[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
[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

Finally, you can use the HIR map to find the parents of nodes, via
calls like [`tcx.hir().get_parent(n)`][get_parent].
Finally, you can find the parents of nodes, via
calls like [`tcx.parent_hir_node(n)`][parent_hir_node].

[parent_hir_node]: 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

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
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. `|x, y| x + y`). You can use the HIR map to find the body
associated with a given def-id ([`maybe_body_owned_by`]) or to find
the owner of a body ([`body_owner_def_id`]).
(e.g. `|x, y| x + y`). You can use the `TyCtxt` to find the body
associated with a given def-id ([`hir_maybe_body_owned_by`]) or to find
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
[`maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.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_maybe_body_owned_by`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.hir_maybe_body_owned_by
[`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
2 changes: 1 addition & 1 deletion src/solve/opaque-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For opaque types in the defining scope and in the implicit-negative coherence mo
always done in two steps. Outside of the defining scope `normalizes-to` for opaques always
returns `Err(NoSolution)`.

We start by trying to to assign the expected type as a hidden type.
We start by trying to assign the expected type as a hidden type.

In the implicit-negative coherence mode, this currently always results in ambiguity without
interacting with the opaque types storage. We could instead add allow 'defining' all opaque types,
Expand Down
2 changes: 2 additions & 0 deletions src/tests/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ See [compiletest directives] for a listing of directives.
- For `ignore-*`/`needs-*`/`only-*` directives, unless extremely obvious,
provide a brief remark on why the directive is needed. E.g. `"//@ ignore-wasi
(wasi codegens the main symbol differently)"`.
- When using `//@ ignore-auxiliary`, specify the corresponding main test files,
e.g. ``//@ ignore-auxiliary (used by `./foo.rs`)``.

## FileCheck best practices

Expand Down
27 changes: 18 additions & 9 deletions src/tests/directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
| `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-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 |
| `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>` |
Expand All @@ -123,6 +124,9 @@ means the test won't be compiled or run.
* `ignore-X` where `X` is a target detail or other criteria on which to ignore the test (see below)
* `only-X` is like `ignore-X`, but will *only* run the test on that target or
stage
* `ignore-auxiliary` is intended for files that *participate* in one or more other
main test files but that `compiletest` should not try to build the file itself.
Please backlink to which main test is actually using the auxiliary file.
* `ignore-test` always ignores the test. This can be used to temporarily disable
a test if it is currently not working, but you want to keep it in tree to
re-enable it later.
Expand Down Expand Up @@ -191,8 +195,13 @@ settings:
specified atomic widths, e.g. the test with `//@ needs-target-has-atomic: 8,
16, ptr` will only run if it supports the comma-separated list of atomic
widths.
- `needs-dynamic-linking` - ignores if target does not support dynamic linking
- `needs-dynamic-linking` ignores if target does not support dynamic linking
(which is orthogonal to it being unable to create `dylib` and `cdylib` crate types)
- `needs-crate-type` — ignores if target platform does not support one or more
of the comma-delimited list of specified crate types. For example,
`//@ needs-crate-type: cdylib, proc-macro` will cause the test to be ignored
on `wasm32-unknown-unknown` target because the target does not support the
`proc-macro` crate type.

The following directives will check LLVM support:

Expand Down Expand Up @@ -229,14 +238,14 @@ ignoring debuggers.

### Affecting how tests are built

| Directive | Explanation | Supported test suites | Possible values |
|---------------------|----------------------------------------------------------------------------------------------|---------------------------|------------------------------------------------------------------------------|
| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental`. |
| `edition` | Alias for `compile-flags: --edition=xxx` | All except for `run-make` | Any valid `--edition` value |
| `rustc-env` | Env var to set when running `rustc` | All except for `run-make` | `<KEY>=<VALUE>` |
| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make` | Any env var name |
| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A |
| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |
| Directive | Explanation | Supported test suites | Possible values |
|---------------------|----------------------------------------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------------------|
| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` |
| `edition` | The edition used to build the test | All except for `run-make` | Any valid `--edition` value |
| `rustc-env` | Env var to set when running `rustc` | All except for `run-make` | `<KEY>=<VALUE>` |
| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make` | Any env var name |
| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A |
| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |

<div class="warning">
Tests (outside of `run-make`) that want to use incremental tests not in the
Expand Down
Loading