Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 449c801

Browse files
committedJun 2, 2025·
Auto merge of #141906 - chenyukang:rollup-k6v59ty, r=chenyukang
Rollup of 6 pull requests Successful merges: - #141884 (allow macro_use as first segment) - #141885 ([RTE-484] Update SGX maintainers) - #141892 (Fix false positive lint error from no_implicit_prelude attr) - #141894 (rustc-dev-guide subtree update) - #141895 (tshepang has a new email) - #141897 (Fix citool tests when executed locally) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 2398bd6 + 8f240de commit 449c801

36 files changed

+369
-139
lines changed
 

‎.mailmap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ Torsten Weber <TorstenWeber12@gmail.com> <torstenweber12@gmail.com>
653653
Trevor Gross <tmgross@umich.edu> <t.gross35@gmail.com>
654654
Trevor Gross <tmgross@umich.edu> <tgross@intrepidcs.com>
655655
Trevor Spiteri <tspiteri@ieee.org> <trevor.spiteri@um.edu.mt>
656-
Tshepang Mbambo <tshepang@gmail.com>
656+
Tshepang Mbambo <hopsi@tuta.io> <tshepang@gmail.com>
657657
Ty Overby <ty@pre-alpha.com>
658658
Tyler Mandry <tmandry@gmail.com> <tmandry@google.com>
659659
Tyler Ruckinger <t.ruckinger@gmail.com>

‎compiler/rustc_passes/src/check_attr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2312,7 +2312,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
23122312
}
23132313

23142314
fn check_macro_use(&self, hir_id: HirId, attr: &Attribute, target: Target) {
2315-
let name = attr.name().unwrap();
2315+
let Some(name) = attr.name() else {
2316+
return;
2317+
};
23162318
match target {
23172319
Target::ExternCrate | Target::Mod => {}
23182320
_ => {

‎compiler/rustc_resolve/src/check_unused.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ impl<'a, 'ra, 'tcx> UnusedImportCheckVisitor<'a, 'ra, 'tcx> {
193193
continue;
194194
}
195195

196+
let module = self
197+
.r
198+
.get_nearest_non_block_module(self.r.local_def_id(extern_crate.id).to_def_id());
199+
if module.no_implicit_prelude {
200+
// If the module has `no_implicit_prelude`, then we don't suggest
201+
// replacing the extern crate with a use, as it would not be
202+
// inserted into the prelude. User writes `extern` style deliberately.
203+
continue;
204+
}
205+
196206
let vis_span = extern_crate
197207
.vis_span
198208
.find_ancestor_inside(extern_crate.span)

‎src/ci/citool/tests/jobs.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ fn get_matrix(event_name: &str, commit_msg: &str, branch_ref: &str) -> String {
5151
.env("GITHUB_EVENT_NAME", event_name)
5252
.env("COMMIT_MESSAGE", commit_msg)
5353
.env("GITHUB_REF", branch_ref)
54+
.env("GITHUB_RUN_ID", "123")
55+
.env("GITHUB_RUN_ATTEMPT", "1")
5456
.stdout(Stdio::piped())
5557
.output()
5658
.expect("Failed to execute command");

‎src/doc/rustc-dev-guide/.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Jynn Nelson <github@jyn.dev> <joshua@yottadb.com>
33
Jynn Nelson <github@jyn.dev> <jyn.nelson@redjack.com>
44
Jynn Nelson <github@jyn.dev> <jnelson@cloudflare.com>
55
Jynn Nelson <github@jyn.dev>
6+
Tshepang Mbambo <hopsi@tuta.io> <tshepang@gmail.com>

‎src/doc/rustc-dev-guide/rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e42bbfe1f7c26f8760a99c4b1f27d33aba1040bb
1+
99e7c15e81385b38a8186b51edc4577d5d7b5bdd

‎src/doc/rustc-dev-guide/src/appendix/compiler-lecture.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,4 @@ These are videos where various experts explain different parts of the compiler:
4646

4747
## Code Generation
4848
- [January 2019: Cranelift](https://www.youtube.com/watch?v=9OIA7DTFQWU)
49+
- [December 2024: LLVM Developers' Meeting - Rust ❤️ LLVM](https://www.youtube.com/watch?v=Kqz-umsAnk8)

‎src/doc/rustc-dev-guide/src/borrow_check/two_phase_borrows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ borrow.
7676
[`AutoBorrow`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/adjustment/enum.AutoBorrow.html
7777
[converted]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/cx/expr/trait.ToBorrowKind.html#method.to_borrow_kind
7878
[`BorrowKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.BorrowKind.html
79-
[`GatherBorrows`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/visit/trait.Visitor.html#method.visit_local
79+
[`GatherBorrows`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/borrow_set/struct.GatherBorrows.html
8080
[`BorrowData`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_borrowck/borrow_set/struct.BorrowData.html
8181

8282
## Checking two-phase borrows

‎src/doc/rustc-dev-guide/src/building/suggested.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ for two reasons:
9191
additional rebuilds in some cases.
9292

9393
To avoid these problems:
94-
- Add `--build-dir=build-rust-analyzer` to all of the custom `x` commands in
94+
- Add `--build-dir=build/rust-analyzer` to all of the custom `x` commands in
9595
your editor's rust-analyzer configuration.
9696
(Feel free to choose a different directory name if desired.)
9797
- Modify the `rust-analyzer.rustfmt.overrideCommand` setting so that it points
@@ -100,10 +100,7 @@ To avoid these problems:
100100
copy of `rust-analyzer-proc-macro-srv` in that other build directory.
101101

102102
Using separate build directories for command-line builds and rust-analyzer
103-
requires extra disk space, and also means that running `./x clean` on the
104-
command-line will not clean out the separate build directory. To clean the
105-
separate build directory, run `./x clean --build-dir=build-rust-analyzer`
106-
instead.
103+
requires extra disk space.
107104

108105
### Visual Studio Code
109106

@@ -137,7 +134,7 @@ Task] instead:
137134

138135
### Neovim
139136

140-
For Neovim users there are several options for configuring for rustc. The
137+
For Neovim users, there are a few options. The
141138
easiest way is by using [neoconf.nvim](https://github.com/folke/neoconf.nvim/),
142139
which allows for project-local configuration files with the native LSP. The
143140
steps for how to use it are below. Note that they require rust-analyzer to

‎src/doc/rustc-dev-guide/src/diagnostics.md

Lines changed: 101 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -866,19 +866,17 @@ struct](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/json/struct
866866
(and sub-structs) for the JSON serialization. Don't confuse this with
867867
[`errors::Diag`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_errors/struct.Diag.html)!
868868

869-
## `#[rustc_on_unimplemented(...)]`
869+
## `#[rustc_on_unimplemented]`
870870

871-
The `#[rustc_on_unimplemented]` attribute allows trait definitions to add specialized
872-
notes to error messages when an implementation was expected but not found.
873-
You can refer to the trait's generic arguments by name and to the resolved type using `Self`.
874-
875-
For example:
871+
This attribute allows trait definitions to modify error messages when an implementation was
872+
expected but not found. The string literals in the attribute are format strings and can be
873+
formatted with named parameters. See the Formatting
874+
section below for what parameters are permitted.
876875

877876
```rust,ignore
878-
#![feature(rustc_attrs)]
879-
880-
#[rustc_on_unimplemented="an iterator over elements of type `{A}` \
881-
cannot be built from a collection of type `{Self}`"]
877+
#[rustc_on_unimplemented(message = "an iterator over \
878+
elements of type `{A}` cannot be built from a \
879+
collection of type `{Self}`")]
882880
trait MyIterator<A> {
883881
fn next(&mut self) -> A;
884882
}
@@ -895,32 +893,26 @@ fn main() {
895893
When the user compiles this, they will see the following;
896894

897895
```txt
898-
error[E0277]: the trait bound `&[{integer}]: MyIterator<char>` is not satisfied
899-
--> <anon>:14:5
896+
error[E0277]: an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
897+
--> src/main.rs:13:19
900898
|
901-
14 | iterate_chars(&[1, 2, 3][..]);
902-
| ^^^^^^^^^^^^^ an iterator over elements of type `char` cannot be built from a collection of type `&[{integer}]`
899+
13 | iterate_chars(&[1, 2, 3][..]);
900+
| ------------- ^^^^^^^^^^^^^^ the trait `MyIterator<char>` is not implemented for `&[{integer}]`
901+
| |
902+
| required by a bound introduced by this call
903903
|
904-
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
905-
= note: required by `iterate_chars`
904+
note: required by a bound in `iterate_chars`
906905
```
907906

908-
`rustc_on_unimplemented` also supports advanced filtering for better targeting
909-
of messages, as well as modifying specific parts of the error message. You
910-
target the text of:
911-
907+
You can modify the contents of:
912908
- the main error message (`message`)
913909
- the label (`label`)
914-
- an extra note (`note`)
910+
- the note(s) (`note`)
915911

916912
For example, the following attribute
917913

918914
```rust,ignore
919-
#[rustc_on_unimplemented(
920-
message="message",
921-
label="label",
922-
note="note"
923-
)]
915+
#[rustc_on_unimplemented(message = "message", label = "label", note = "note")]
924916
trait MyIterator<A> {
925917
fn next(&mut self) -> A;
926918
}
@@ -930,45 +922,61 @@ Would generate the following output:
930922

931923
```text
932924
error[E0277]: message
933-
--> <anon>:14:5
925+
--> <file>:10:19
934926
|
935-
14 | iterate_chars(&[1, 2, 3][..]);
936-
| ^^^^^^^^^^^^^ label
927+
10 | iterate_chars(&[1, 2, 3][..]);
928+
| ------------- ^^^^^^^^^^^^^^ label
929+
| |
930+
| required by a bound introduced by this call
937931
|
938-
= note: note
939932
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
940-
= note: required by `iterate_chars`
933+
= note: note
934+
note: required by a bound in `iterate_chars`
941935
```
942936

937+
The functionality discussed so far is also available with
938+
[`#[diagnostic::on_unimplemented]`](https://doc.rust-lang.org/nightly/reference/attributes/diagnostics.html#the-diagnosticon_unimplemented-attribute).
939+
If you can, you should use that instead.
940+
941+
### Filtering
942+
943943
To allow more targeted error messages, it is possible to filter the
944-
application of these fields based on a variety of attributes when using
945-
`on`:
944+
application of these fields with `on`.
946945

946+
You can filter on the following boolean flags:
947947
- `crate_local`: whether the code causing the trait bound to not be
948948
fulfilled is part of the user's crate. This is used to avoid suggesting
949949
code changes that would require modifying a dependency.
950-
- Any of the generic arguments that can be substituted in the text can be
951-
referred by name as well for filtering, like `Rhs="i32"`, except for
952-
`Self`.
953-
- `_Self`: to filter only on a particular calculated trait resolution, like
954-
`Self="std::iter::Iterator<char>"`. This is needed because `Self` is a
955-
keyword which cannot appear in attributes.
956-
- `direct`: user-specified rather than derived obligation.
957-
- `from_desugaring`: usable both as boolean (whether the flag is present)
958-
or matching against a particular desugaring. The desugaring is identified
959-
with its variant name in the `DesugaringKind` enum.
960-
961-
For example, the `Iterator` trait can be annotated in the following way:
950+
- `direct`: whether this is an user-specified rather than derived obligation.
951+
- `from_desugaring`: whether we are in some kind of desugaring, like `?`
952+
or a `try` block for example. This flag can also be matched on, see below.
953+
954+
You can match on the following names and values, using `name = "value"`:
955+
- `cause`: Match against one variant of the `ObligationCauseCode`
956+
enum. Only `"MainFunctionType"` is supported.
957+
- `from_desugaring`: Match against a particular variant of the `DesugaringKind`
958+
enum. The desugaring is identified by its variant name, for example
959+
`"QuestionMark"` for `?` desugaring or `"TryBlock"` for `try` blocks.
960+
- `Self` and any generic arguments of the trait, like `Self = "alloc::string::String"`
961+
or `Rhs="i32"`.
962+
963+
The compiler can provide several values to match on, for example:
964+
- the self_ty, pretty printed with and without type arguments resolved.
965+
- `"{integral}"`, if self_ty is an integral of which the type is known.
966+
- `"[]"`, `"[{ty}]"`, `"[{ty}; _]"`, `"[{ty}; $N]"` when applicable.
967+
- references to said slices and arrays.
968+
- `"fn"`, `"unsafe fn"` or `"#[target_feature] fn"` when self is a function.
969+
- `"{integer}"` and `"{float}"` if the type is a number but we haven't inferred it yet.
970+
- combinations of the above, like `"[{integral}; _]"`.
971+
972+
For example, the `Iterator` trait can be filtered in the following way:
962973

963974
```rust,ignore
964975
#[rustc_on_unimplemented(
965-
on(
966-
_Self="&str",
967-
note="call `.chars()` or `.as_bytes()` on `{Self}`"
968-
),
969-
message="`{Self}` is not an iterator",
970-
label="`{Self}` is not an iterator",
971-
note="maybe try calling `.iter()` or a similar method"
976+
on(Self = "&str", note = "call `.chars()` or `.as_bytes()` on `{Self}`"),
977+
message = "`{Self}` is not an iterator",
978+
label = "`{Self}` is not an iterator",
979+
note = "maybe try calling `.iter()` or a similar method"
972980
)]
973981
pub trait Iterator {}
974982
```
@@ -997,15 +1005,47 @@ error[E0277]: `&str` is not an iterator
9971005
= note: required by `std::iter::IntoIterator::into_iter`
9981006
```
9991007

1000-
If you need to filter on multiple attributes, you can use `all`, `any` or
1001-
`not` in the following way:
1008+
The `on` filter accepts `all`, `any` and `not` predicates similar to the `cfg` attribute:
10021009

10031010
```rust,ignore
1004-
#[rustc_on_unimplemented(
1005-
on(
1006-
all(_Self="&str", T="std::string::String"),
1007-
note="you can coerce a `{T}` into a `{Self}` by writing `&*variable`"
1008-
)
1009-
)]
1010-
pub trait From<T>: Sized { /* ... */ }
1011+
#[rustc_on_unimplemented(on(
1012+
all(Self = "&str", T = "alloc::string::String"),
1013+
note = "you can coerce a `{T}` into a `{Self}` by writing `&*variable`"
1014+
))]
1015+
pub trait From<T>: Sized {
1016+
/* ... */
1017+
}
1018+
```
1019+
1020+
### Formatting
1021+
1022+
The string literals are format strings that accept parameters wrapped in braces
1023+
but positional and listed parameters and format specifiers are not accepted.
1024+
The following parameter names are valid:
1025+
- `Self` and all generic parameters of the trait.
1026+
- `This`: the name of the trait the attribute is on, without generics.
1027+
- `Trait`: the name of the "sugared" trait. See `TraitRefPrintSugared`.
1028+
- `ItemContext`: the kind of `hir::Node` we're in, things like `"an async block"`,
1029+
`"a function"`, `"an async function"`, etc.
1030+
1031+
Something like:
1032+
1033+
```rust,ignore
1034+
#![feature(rustc_attrs)]
1035+
1036+
#[rustc_on_unimplemented(message = "Self = `{Self}`, \
1037+
T = `{T}`, this = `{This}`, trait = `{Trait}`, \
1038+
context = `{ItemContext}`")]
1039+
pub trait From<T>: Sized {
1040+
fn from(x: T) -> Self;
1041+
}
1042+
1043+
fn main() {
1044+
let x: i8 = From::from(42_i32);
1045+
}
1046+
```
1047+
1048+
Will format the message into
1049+
```text
1050+
"Self = `i8`, T = `i32`, this = `From`, trait = `From<i32>`, context = `a function`"
10111051
```

‎src/doc/rustc-dev-guide/src/early_late_parameters.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ As mentioned previously, the distinction between early and late bound parameters
174174
- When naming a function (early)
175175
- When calling a function (late)
176176

177-
There currently is no syntax for explicitly specifying generic arguments for late bound parameters as part of the call step, only specifying generic arguments when naming a function. The syntax `foo::<'static>();`, despite being part of a function call, behaves as `(foo::<'static>)();` and instantiates the early bound generic parameters on the function item type.
177+
There is currently no syntax for explicitly specifying generic arguments for late bound parameters during the call step; generic arguments can only be specified for early bound parameters when naming a function.
178+
The syntax `foo::<'static>();`, despite being part of a function call, behaves as `(foo::<'static>)();` and instantiates the early bound generic parameters on the function item type.
178179

179180
See the following example:
180181
```rust

‎src/doc/rustc-dev-guide/src/fuzzing.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,32 @@ To build a corpus, you may want to use:
7373

7474
- The rustc/rust-analyzer/clippy test suites (or even source code) --- though avoid
7575
tests that are already known to cause failures, which often begin with comments
76-
like `// failure-status: 101` or `// known-bug: #NNN`.
77-
- The already-fixed ICEs in [Glacier][glacier] --- though avoid the unfixed
78-
ones in `ices/`!
76+
like `//@ failure-status: 101` or `//@ known-bug: #NNN`.
77+
- The already-fixed ICEs in the archived [Glacier][glacier] repository --- though
78+
avoid the unfixed ones in `ices/`!
79+
80+
[glacier]: https://github.com/rust-lang/glacier
7981

8082
## Extra credit
8183

8284
Here are a few things you can do to help the Rust project after filing an ICE.
8385

84-
- [Bisect][bisect] the bug to figure out when it was introduced
86+
- [Bisect][bisect] the bug to figure out when it was introduced.
87+
If you find the regressing PR / commit, you can mark the issue with the label
88+
`S-has-bisection`. If not, consider applying `E-needs-bisection` instead.
8589
- Fix "distractions": problems with the test case that don't contribute to
8690
triggering the ICE, such as syntax errors or borrow-checking errors
87-
- Minimize the test case (see below)
88-
- Add the minimal test case to [Glacier][glacier]
91+
- Minimize the test case (see below). If successful, you can label the
92+
issue with `S-has-mcve`. Otherwise, you can apply `E-needs-mcve`.
93+
- Add the minimal test case to the rust-lang/rust repo as a [crashes test].
94+
While you're at it, consider including other "untracked" crashes in your PR.
95+
Please don't forget to mark your issue with `S-bug-has-test` afterwards.
96+
97+
See also [applying and removing labels][labeling].
8998

9099
[bisect]: https://rust-lang.github.io/cargo-bisect-rustc/
100+
[crashes test]: tests/compiletest.html#crashes-tests
101+
[labeling]: https://forge.rust-lang.org/release/issue-triaging.html#applying-and-removing-labels
91102

92103
## Minimization
93104

@@ -143,7 +154,6 @@ ICEs that require debug assertions to reproduce should be tagged
143154
- [tree-splicer][tree-splicer] generates new source files by combining existing
144155
ones while maintaining correct syntax
145156

146-
[glacier]: https://github.com/rust-lang/glacier
147157
[fuzz-rustc]: https://github.com/dwrensha/fuzz-rustc
148158
[icemaker]: https://github.com/matthiaskrgr/icemaker/
149159
[tree-splicer]: https://github.com/langston-barrett/tree-splicer/

‎src/doc/rustc-dev-guide/src/getting-started.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ filtering the search to areas you're interested in. For example:
8989
Not all important or beginner work has issue labels.
9090
See below for how to find work that isn't labelled.
9191

92-
[help-wanted-search]: https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Arust-lang+no%3Aassignee+label%3AE-easy%2C%22good+first+issue%22%2Cgood-first-issue%2CE-medium%2CEasy%2CE-help-wanted%2CE-mentor+-label%3AS-blocked+-linked:pr+
92+
[help-wanted-search]: https://github.com/issues?q=is%3Aopen+is%3Aissue+org%3Arust-lang+no%3Aassignee+label%3AE-easy%2C%22good+first+issue%22%2Cgood-first-issue%2CE-medium%2CEasy%2CE-help-wanted%2CE-mentor+-label%3AS-blocked+-linked%3Apr+
9393
[Triage]: ./contributing.md#issue-triage
9494

9595
### Recurring work
@@ -98,8 +98,6 @@ Some work is too large to be done by a single person. In this case, it's common
9898
issues" to co-ordinate the work between contributors. Here are some example tracking issues where
9999
it's easy to pick up work without a large time commitment:
100100

101-
- [Rustdoc Askama Migration](https://github.com/rust-lang/rust/issues/108868)
102-
- [Diagnostic Translation](https://github.com/rust-lang/rust/issues/100717)
103101
- [Move UI tests to subdirectories](https://github.com/rust-lang/rust/issues/73494)
104102

105103
If you find more recurring work, please feel free to add it here!

‎src/doc/rustc-dev-guide/src/normalization.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,10 @@ In this example:
166166

167167
When interfacing with the type system it will often be the case that it's necessary to request a type be normalized. There are a number of different entry points to the underlying normalization logic and each entry point should only be used in specific parts of the compiler.
168168

169-
An additional complication is that the compiler is currently undergoing a transition from the old trait solver to the new trait solver. As part of this transition our approach to normalization in the compiler has changed somewhat significantly, resulting in some normalization entry points being "old solver only" slated for removal in the long-term once the new solver has stabilized.
169+
<!-- date-check: May 2025 -->
170+
An additional complication is that the compiler is currently undergoing a transition from the old trait solver to the new trait solver.
171+
As part of this transition our approach to normalization in the compiler has changed somewhat significantly, resulting in some normalization entry points being "old solver only" slated for removal in the long-term once the new solver has stabilized.
172+
The transition can be tracked via the [WG-trait-system-refactor](https://github.com/rust-lang/rust/labels/WG-trait-system-refactor) label in Github.
170173

171174
Here is a rough overview of the different entry points to normalization in the compiler:
172175
- `infcx.at.structurally_normalize`
@@ -306,4 +309,4 @@ Const aliases differ from type aliases a bit here; well formedness of const alia
306309

307310
[^5]: Const aliases certainly wouldn't be *less* sound than type aliases if we stopped doing this
308311

309-
[const_evaluatable]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.ClauseKind.html#variant.ConstEvaluatable
312+
[const_evaluatable]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.ClauseKind.html#variant.ConstEvaluatable

‎src/doc/rustc-dev-guide/src/opaque-types-impl-trait-inference.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ it can work across functions and function bodies.
1313
To help explain how it works, let's consider an example.
1414

1515
```rust
16+
#![feature(type_alias_impl_trait)]
1617
mod m {
1718
pub type Seq<T> = impl IntoIterator<Item = T>;
1819

20+
#[define_opaque(Seq)]
1921
pub fn produce_singleton<T>(t: T) -> Seq<T> {
2022
vec![t]
2123
}
2224

25+
#[define_opaque(Seq)]
2326
pub fn produce_doubleton<T>(t: T, u: T) -> Seq<T> {
2427
vec![t, u]
2528
}

‎src/doc/rustc-dev-guide/src/return-position-impl-trait-in-trait.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ trait Foo {
356356

357357
Failing because a down-stream impl could theoretically provide an
358358
implementation for `RPITIT` without providing an implementation of
359-
`foo`:
359+
`bar`:
360360

361361
```text
362362
error[E0308]: mismatched types

‎src/doc/rustc-dev-guide/src/rustdoc-internals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ using `XPath` notation to get a precise look at the output. The full
281281
description of all the commands available to `rustdoc` tests (e.g. [`@has`] and
282282
[`@matches`]) is in [`htmldocck.py`].
283283

284-
To use multiple crates in a `rustdoc` test, add `// aux-build:filename.rs`
284+
To use multiple crates in a `rustdoc` test, add `//@ aux-build:filename.rs`
285285
to the top of the test file. `filename.rs` should be placed in an `auxiliary`
286286
directory relative to the test file with the comment. If you need to build
287-
docs for the auxiliary file, use `// build-aux-docs`.
287+
docs for the auxiliary file, use `//@ build-aux-docs`.
288288

289289
In addition, there are separate tests for the search index and `rustdoc`'s
290290
ability to query it. The files in `tests/rustdoc-js` each contain a

‎src/doc/rustc-dev-guide/src/rustdoc.md

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ does is call the `main()` that's in this crate's `lib.rs`, though.)
9393
interactivity. For information on how to write this form of test,
9494
see [`tests/rustdoc-gui/README.md`][rustdoc-gui-readme]
9595
as well as [the description of the `.goml` format][goml-script]
96-
* Additionally, JavaScript type annotations are written using [TypeScript-flavored JSDoc]
97-
comments and an external d.ts file. The code itself is plain, valid JavaScript; we only
98-
use tsc as a linter.
99-
* The tests on the structure of rustdoc HTML output are located in `tests/rustdoc`,
96+
* Tests on the structure of rustdoc HTML output are located in `tests/rustdoc`,
10097
where they're handled by the test runner of bootstrap and
10198
the supplementary script `src/etc/htmldocck.py`.
10299
[These tests have several extra directives available to them](./rustdoc-internals/rustdoc-test-suite.md).
100+
* Additionally, JavaScript type annotations are written using [TypeScript-flavored JSDoc]
101+
comments and an external d.ts file. The code itself is plain, valid JavaScript; we only
102+
use tsc as a linter.
103103

104104
[TypeScript-flavored JSDoc]: https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html
105105
[rustdoc-gui-readme]: https://github.com/rust-lang/rust/blob/master/tests/rustdoc-gui/README.md
@@ -116,6 +116,28 @@ Certain browser features that require secure origins, like `localStorage` and
116116
Service Workers, don't work reliably. We can still use such features but we
117117
should make sure pages are still usable without them.
118118

119+
Rustdoc [does not type-check function bodies][platform-specific docs].
120+
This works by [overriding the built-in queries for typeck][override queries],
121+
by [silencing name resolution errors], and by [not resolving opaque types].
122+
This comes with several caveats: in particular, rustdoc *cannot* run any parts of the compiler that
123+
require type-checking bodies; for example it cannot generate `.rlib` files or run most lints.
124+
We want to move away from this model eventually, but we need some alternative for
125+
[the people using it][async-std]; see [various][zulip stop accepting broken code]
126+
[previous][rustdoc meeting 2024-07-08] [zulip][compiler meeting 2023-01-26] [discussion][notriddle rfc].
127+
For examples of code that breaks if this hack is removed, see
128+
[`tests/rustdoc-ui/error-in-impl-trait`].
129+
130+
[platform-specific docs]: https://doc.rust-lang.org/rustdoc/advanced-features.html#interactions-between-platform-specific-docs
131+
[override queries]: https://github.com/rust-lang/rust/blob/52bf0cf795dfecc8b929ebb1c1e2545c3f41d4c9/src/librustdoc/core.rs#L299-L323
132+
[silencing name resolution errors]: https://github.com/rust-lang/rust/blob/52bf0cf795dfecc8b929ebb1c1e2545c3f41d4c9/compiler/rustc_resolve/src/late.rs#L4517
133+
[not resolving opaque types]: https://github.com/rust-lang/rust/blob/52bf0cf795dfecc8b929ebb1c1e2545c3f41d4c9/compiler/rustc_hir_analysis/src/check/check.rs#L188-L194
134+
[async-std]: https://github.com/rust-lang/rust/issues/75100
135+
[rustdoc meeting 2024-07-08]: https://rust-lang.zulipchat.com/#narrow/channel/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449969836
136+
[compiler meeting 2023-01-26]: https://rust-lang.zulipchat.com/#narrow/channel/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202023-01-26/near/323755789
137+
[zulip stop accepting broken code]: https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/stop.20accepting.20broken.20code
138+
[notriddle rfc]: https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Pre-RFC.3A.20stop.20accepting.20broken.20code
139+
[`tests/rustdoc-ui/error-in-impl-trait`]: https://github.com/rust-lang/rust/tree/163cb4ea3f0ae3bc7921cc259a08a7bf92e73ee6/tests/rustdoc-ui/error-in-impl-trait
140+
119141
## Multiple runs, same output directory
120142

121143
Rustdoc can be run multiple times for varying inputs, with its output set to the

‎src/doc/rustc-dev-guide/src/solve/coinduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,14 @@ Alternatively, we could simply always treat the equate branch of `normalizes_to`
237237
Any cycles should result in infinite types, which aren't supported anyways and would only
238238
result in overflow when deeply normalizing for codegen.
239239

240-
experimentation and examples: https://hackmd.io/-8p0AHnzSq2VAE6HE_wX-w?view
240+
experimentation and examples: <https://hackmd.io/-8p0AHnzSq2VAE6HE_wX-w?view>
241241

242242
Another attempt at a summary.
243243
- in projection eq, we must make progress with constraining the rhs
244244
- a cycle is only ok if while equating we have a rigid ty on the lhs after norm at least once
245245
- cycles outside of the recursive `eq` call of `normalizes_to` are always fine
246246

247-
[^1]: related: https://coq.inria.fr/refman/language/core/coinductive.html#top-level-definitions-of-corecursive-functions
247+
[^1]: related: <https://coq.inria.fr/refman/language/core/coinductive.html#top-level-definitions-of-corecursive-functions>
248248

249249
[perfect derive]: https://smallcultfollowing.com/babysteps/blog/2022/04/12/implied-bounds-and-perfect-derive
250250
[ex1]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0a9c3830b93a2380e6978d6328df8f72

‎src/doc/rustc-dev-guide/src/solve/opaque-types.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Opaque types in the new solver
22

3-
The way opaque types are handled in the new solver differs from the old implementation.
3+
The way [opaque types] are handled in the new solver differs from the old implementation.
44
This should be a self-contained explanation of the behavior in the new solver.
55

6+
[opaque types]: ../opaque-types-type-alias-impl-trait.md
7+
68
## opaques are alias types
79

810
Opaque types are treated the same as other aliases, most notabily associated types,

‎src/doc/rustc-dev-guide/src/tests/ci.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ Most platforms only run the build steps, some run a restricted set of tests,
100100
only a subset run the full suite of tests (see Rust's [platform tiers]).
101101

102102
Auto jobs are defined in the `auto` section of [`jobs.yml`]. They are executed
103-
on the `auto` branch under the `rust-lang-ci/rust` repository[^rust-lang-ci] and
104-
their results can be seen [here](https://github.com/rust-lang-ci/rust/actions),
103+
on the `auto` branch under the `rust-lang/rust` repository and
104+
their results can be seen [here](https://github.com/rust-lang/rust/actions),
105105
although usually you will be notified of the result by a comment made by bors on
106106
the corresponding PR.
107107

@@ -110,9 +110,6 @@ more [here](#merging-prs-serially-with-bors).
110110

111111
[platform tiers]: https://forge.rust-lang.org/release/platform-support.html#rust-platform-support
112112

113-
[^rust-lang-ci]: The `auto` and `try` jobs run under the `rust-lang-ci` fork for
114-
historical reasons. This may change in the future.
115-
116113
### Try builds
117114

118115
Sometimes we want to run a subset of the test suite on CI for a given PR, or
@@ -179,8 +176,8 @@ the pattern as Markdown.
179176
> that are exercised this way.
180177
181178
Try jobs are defined in the `try` section of [`jobs.yml`]. They are executed on
182-
the `try` branch under the `rust-lang-ci/rust` repository[^rust-lang-ci] and
183-
their results can be seen [here](https://github.com/rust-lang-ci/rust/actions),
179+
the `try` branch under the `rust-lang/rust` repository and
180+
their results can be seen [here](https://github.com/rust-lang/rust/actions),
184181
although usually you will be notified of the result by a comment made by bors on
185182
the corresponding PR.
186183
@@ -355,7 +352,7 @@ invalidated if one of the following changes:
355352
- Files copied into the Docker image in the Dockerfile
356353
- The architecture of the GitHub runner (x86 or ARM)
357354

358-
[ghcr.io]: https://github.com/rust-lang-ci/rust/pkgs/container/rust-ci
355+
[ghcr.io]: https://github.com/rust-lang/rust/pkgs/container/rust-ci
359356
[Docker registry caching]: https://docs.docker.com/build/cache/backends/registry/
360357

361358
### LLVM caching with sccache
@@ -446,7 +443,7 @@ particular job, it is probably easiest to just look at the build log. To do
446443
this:
447444

448445
1. Go to
449-
<https://github.com/rust-lang-ci/rust/actions?query=branch%3Aauto+is%3Asuccess>
446+
<https://github.com/rust-lang/rust/actions?query=branch%3Aauto+is%3Asuccess>
450447
to find the most recently successful build, and click on it.
451448
2. Choose the job you are interested in on the left-hand side.
452449
3. Click on the gear icon and choose "View raw logs"
@@ -458,7 +455,6 @@ this:
458455
[`jobs.yml`]: https://github.com/rust-lang/rust/blob/master/src/ci/github-actions/jobs.yml
459456
[`.github/workflows/ci.yml`]: https://github.com/rust-lang/rust/blob/master/.github/workflows/ci.yml
460457
[`src/ci/citool`]: https://github.com/rust-lang/rust/blob/master/src/ci/citool
461-
[rust-lang-ci]: https://github.com/rust-lang-ci/rust/actions
462458
[bors]: https://github.com/bors
463459
[homu]: https://github.com/rust-lang/homu
464460
[merge queue]: https://bors.rust-lang.org/queue/rust

‎src/doc/rustc-dev-guide/src/tests/compiletest.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,10 @@ only running the main `coverage` suite.
546546

547547
[`tests/crashes`] serve as a collection of tests that are expected to cause the
548548
compiler to ICE, panic or crash in some other way, so that accidental fixes are
549-
tracked. This was formally done at <https://github.com/rust-lang/glacier> but
549+
tracked. Formerly, this was done at <https://github.com/rust-lang/glacier> but
550550
doing it inside the rust-lang/rust testsuite is more convenient.
551551

552-
It is imperative that a test in the suite causes rustc to ICE, panic or crash
552+
It is imperative that a test in the suite causes rustc to ICE, panic, or
553553
crash in some other way. A test will "pass" if rustc exits with an exit status
554554
other than 1 or 0.
555555

@@ -560,9 +560,12 @@ If you want to see verbose stdout/stderr, you need to set
560560
$ COMPILETEST_VERBOSE_CRASHES=1 ./x test tests/crashes/999999.rs --stage 1
561561
```
562562

563-
When adding crashes from <https://github.com/rust-lang/rust/issues>, the issue
564-
number should be noted in the file name (`12345.rs` should suffice) and also
565-
inside the file include a `//@ known-bug: #4321` directive.
563+
Anyone can add ["untracked" crashes] from the issue tracker. It's strongly
564+
recommended to include test cases from several issues in a single PR.
565+
When you do so, each issue number should be noted in the file name (`12345.rs`
566+
should suffice) and also inside the file by means of a `//@ known-bug: #12345`
567+
directive. Please [label][labeling] the relevant issues with `S-bug-has-test`
568+
afterwards.
566569

567570
If you happen to fix one of the crashes, please move it to a fitting
568571
subdirectory in `tests/ui` and give it a meaningful name. Please add a doc
@@ -585,6 +588,8 @@ a subset first. The issue numbers can be found in the file name or the `//@
585588
known-bug` directive inside the test file.
586589

587590
[`tests/crashes`]: https://github.com/rust-lang/rust/tree/master/tests/crashes
591+
["untracked" crashes]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+state%3Aopen+label%3AI-ICE%2CI-crash+label%3AT-compiler+label%3AS-has-mcve+-label%3AS-bug-has-test
592+
[labeling]: https://forge.rust-lang.org/release/issue-triaging.html#applying-and-removing-labels
588593

589594
## Building auxiliary crates
590595

@@ -614,7 +619,7 @@ file). The `-L` flag is used to find the extern crates.
614619
`aux-crate` is very similar to `aux-build`. However, it uses the `--extern` flag
615620
to link to the extern crate to make the crate be available as an extern prelude.
616621
That allows you to specify the additional syntax of the `--extern` flag, such as
617-
renaming a dependency. For example, `// aux-crate:foo=bar.rs` will compile
622+
renaming a dependency. For example, `//@ aux-crate:foo=bar.rs` will compile
618623
`auxiliary/bar.rs` and make it available under then name `foo` within the test.
619624
This is similar to how Cargo does dependency renaming.
620625

‎src/doc/rustc-dev-guide/src/tests/directives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ not be exhaustive. Directives can generally be found by browsing the
5959
| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make` | `<extern_prelude_name>=<path/to/aux/file.rs>` |
6060
| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file |
6161
| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make` | Path to auxiliary proc-macro `.rs` file |
62-
| `build_aux_docs` | Build docs for auxiliaries as well | All except `run-make` | N/A |
62+
| `build-aux-docs` | Build docs for auxiliaries as well | All except `run-make` | N/A |
6363

6464
[^pm]: please see the Auxiliary proc-macro section in the
6565
[compiletest](./compiletest.md) chapter for specifics.

‎src/doc/rustc-dev-guide/src/tests/ui.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ They have several forms, but generally are a comment with the diagnostic level
192192
to write out the entire message, just make sure to include the important part of
193193
the message to make it self-documenting.
194194

195-
The error annotation needs to match with the line of the diagnostic. There are
195+
Most error annotations need to match with the line of the diagnostic. There are
196196
several ways to match the message with the line (see the examples below):
197197

198198
* `~`: Associates the error level and message with the *current* line
@@ -205,9 +205,6 @@ several ways to match the message with the line (see the examples below):
205205
* `~v`: Associates the error level and message with the *next* error
206206
annotation line. Each symbol (`v`) that you add adds a line to this, so `~vvv`
207207
is three lines below the error annotation line.
208-
* `~?`: Used to match error levels and messages with errors not having line
209-
information. These can be placed on any line in the test file, but are
210-
conventionally placed at the end.
211208

212209
Example:
213210

@@ -222,6 +219,10 @@ The space character between `//~` (or other variants) and the subsequent text is
222219
negligible (i.e. there is no semantic difference between `//~ ERROR` and
223220
`//~ERROR` although the former is more common in the codebase).
224221

222+
`~? <diagnostic kind>` (example being `~? ERROR`)
223+
is used to match diagnostics without line information.
224+
These can be placed on any line in the test file, but are conventionally placed at the end.
225+
225226
### Error annotation examples
226227

227228
Here are examples of error annotations on different lines of UI test source.

‎src/doc/rustc-dev-guide/src/ty_module/binders.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `Binder` and Higher ranked regions
22

3-
Sometimes we define generic parameters not on an item but as part of a type or a where clauses. As an example the type `for<'a> fn(&'a u32)` or the where clause `for<'a> T: Trait<'a>` both introduce a generic lifetime named `'a`. Currently there is no stable syntax for `for<T>` or `for<const N: usize>` but on nightly `feature(non_lifetime_binders)` feature can be used to write where clauses (but not types) using `for<T>`/`for<const N: usize>`.
3+
Sometimes we define generic parameters not on an item but as part of a type or a where clause. As an example the type `for<'a> fn(&'a u32)` or the where clause `for<'a> T: Trait<'a>` both introduce a generic lifetime named `'a`. Currently there is no stable syntax for `for<T>` or `for<const N: usize>` but on nightly `feature(non_lifetime_binders)` can be used to write where clauses (but not types) using `for<T>`/`for<const N: usize>`.
44

55
The `for` is referred to as a "binder" because it brings new names into scope. In rustc we use the `Binder` type to track where these parameters are introduced and what the parameters are (i.e. how many and whether the parameter is a type/const/region). A type such as `for<'a> fn(&'a u32)` would be
66
represented in rustc as:
@@ -13,8 +13,9 @@ Binder(
1313

1414
Usages of these parameters is represented by the `RegionKind::Bound` (or `TyKind::Bound`/`ConstKind::Bound` variants). These bound regions/types/consts are composed of two main pieces of data:
1515
- A [DebruijnIndex](../appendix/background.md#what-is-a-de-bruijn-index) to specify which binder we are referring to.
16-
- A [`BoundVar`] which specifies which of the parameters the `Binder` introduces we are referring to.
17-
- We also sometimes store some extra information for diagnostics reasons via the [`BoundTyKind`]/[`BoundRegionKind`] but this is not important for type equality or more generally the semantics of `Ty`. (omitted from the above example)
16+
- A [`BoundVar`] which specifies which of the parameters that the `Binder` introduces we are referring to.
17+
18+
We also sometimes store some extra information for diagnostics reasons via the [`BoundTyKind`]/[`BoundRegionKind`] but this is not important for type equality or more generally the semantics of `Ty`. (omitted from the above example)
1819

1920
In debug output (and also informally when talking to each other) we tend to write these bound variables in the format of `^DebruijnIndex_BoundVar`. The above example would instead be written as `Binder(fn(&'^0_0), &[BoundVariableKind::Region])`. Sometimes when the `DebruijnIndex` is `0` we just omit it and would write `^0`.
2021

@@ -43,7 +44,7 @@ Binder(
4344
&[BoundVariableKind::Region(...)],
4445
)
4546
```
46-
This would cause all kinds of issues as the region `'^1_0` refers to a binder at a higher level than the outermost binder i.e. it is an escaping bound var. The `'^1` region (also writeable as `'^0_1`) is also ill formed as the binder it refers to does not introduce a second parameter. Modern day rustc will ICE when constructing this binder due to both of those regions, in the past we would have simply allowed this to work and then ran into issues in other parts of the codebase.
47+
This would cause all kinds of issues as the region `'^1_0` refers to a binder at a higher level than the outermost binder i.e. it is an escaping bound var. The `'^1` region (also writeable as `'^0_1`) is also ill formed as the binder it refers to does not introduce a second parameter. Modern day rustc will ICE when constructing this binder due to both of those reasons, in the past we would have simply allowed this to work and then ran into issues in other parts of the codebase.
4748

4849
[`Binder`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.Binder.html
4950
[`BoundVar`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.BoundVar.html

‎src/doc/rustc-dev-guide/src/ty_module/instantiating_binders.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ the `RePlaceholder` for the `'b` parameter is in a higher universe to track the
105105

106106
## Instantiating with `ReLateParam`
107107

108-
As discussed in a previous chapter, `RegionKind` has two variants for representing generic parameters, `ReLateParam` and `ReEarlyParam`. `ReLateParam` is conceptually a `Placeholder` that is always in the root universe (`U0`). It is used when instantiating late bound parameters of functions/closures while inside of them. Its actual representation is relatively different from both `ReEarlyParam` and `RePlaceholder`:
108+
As discussed in [the chapter about representing types][representing-types], `RegionKind` has two variants for representing generic parameters, `ReLateParam` and `ReEarlyParam`.
109+
`ReLateParam` is conceptually a `Placeholder` that is always in the root universe (`U0`). It is used when instantiating late bound parameters of functions/closures while inside of them. Its actual representation is relatively different from both `ReEarlyParam` and `RePlaceholder`:
109110
- A `DefId` for the item that introduced the late bound generic parameter
110111
- A [`BoundRegionKind`] which either specifies the `DefId` of the generic parameter and its name (via a `Symbol`), or that this placeholder is representing the anonymous lifetime of a `Fn`/`FnMut` closure's self borrow. There is also a variant for `BrAnon` but this is not used for `ReLateParam`.
111112

@@ -133,6 +134,7 @@ Generally whenever we have a `Binder` for late bound parameters on a function/cl
133134
As a concrete example, accessing the signature of a function we are type checking will be represented as `EarlyBinder<Binder<FnSig>>`. As we are already "inside" of these binders, we would call `instantiate_identity` followed by `liberate_late_bound_regions`.
134135

135136
[`liberate_late_bound_regions`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.liberate_late_bound_regions
137+
[representing-types]: param_ty_const_regions.md
136138
[`BoundRegionKind`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/enum.BoundRegionKind.html
137139
[`enter_forall`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_trait_selection/infer/struct.InferCtxt.html#method.enter_forall
138140
[ch_placeholders_universes]: ../borrow_check/region_inference/placeholders_and_universes.md

‎src/doc/rustc-dev-guide/src/ty_module/param_ty_const_regions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ TyKind::Ref(
1111

1212
There are three separate ways we represent usages of generic parameters:
1313
- [`TyKind::Param`]/[`ConstKind::Param`]/[`RegionKind::EarlyParam`] for early bound generic parameters (note: all type and const parameters are considered early bound, see the [chapter on early vs late bound parameters][ch_early_late_bound] for more information)
14-
- [`TyKind::Bound`]/[`ConstKind::Bound`]/[`RegionKind::Bound`] for references to parameters introduced via higher ranked bounds or higher ranked types i.e. `for<'a> fn(&'a u32)` or `for<'a> T: Trait<'a>`. This will be discussed in the [chapter on `Binder`s][ch_binders].
15-
- [`RegionKind::LateParam`] for late bound lifetime parameters, `LateParam` will be discussed in the [chapter on instantiating `Binder`s][ch_instantiating_binders].
14+
- [`TyKind::Bound`]/[`ConstKind::Bound`]/[`RegionKind::Bound`] for references to parameters introduced via higher ranked bounds or higher ranked types i.e. `for<'a> fn(&'a u32)` or `for<'a> T: Trait<'a>`. This is discussed in the [chapter on `Binder`s][ch_binders].
15+
- [`RegionKind::LateParam`] for late bound lifetime parameters, `LateParam` is discussed in the [chapter on instantiating `Binder`s][ch_instantiating_binders].
1616

17-
This chapter will only cover `TyKind::Param` `ConstKind::Param` and `RegionKind::EarlyParam`.
17+
This chapter only covers `TyKind::Param` `ConstKind::Param` and `RegionKind::EarlyParam`.
1818

1919
## Ty/Const Parameters
2020

21-
As `TyKind::Param` and `ConstKind::Param` are implemented identically this section will only refer to `TyKind::Param` for simplicity. However
22-
you should keep in mind that everything here also is true of `ConstKind::Param`
21+
As `TyKind::Param` and `ConstKind::Param` are implemented identically this section only refers to `TyKind::Param` for simplicity.
22+
However you should keep in mind that everything here also is true of `ConstKind::Param`
2323

2424
Each `TyKind::Param` contains two things: the name of the parameter and an index.
2525

@@ -83,7 +83,7 @@ fn foo<'a, 'b, T: 'a>(one: T, two: &'a &'b u32) -> &'b u32 {
8383
}
8484
```
8585

86-
`RegionKind::LateParam` will be discussed more in the chapter on [instantiating binders][ch_instantiating_binders].
86+
`RegionKind::LateParam` is discussed more in the chapter on [instantiating binders][ch_instantiating_binders].
8787

8888
[ch_early_late_bound]: ../early_late_parameters.md
8989
[ch_binders]: ./binders.md

‎src/doc/rustc-dev-guide/src/typing_parameter_envs.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ where
3232
<T as Trait>::Assoc: Clone,
3333
{}
3434
```
35-
If we were conceptually inside of `foo` (for example, type-checking or linting it) we would use this `ParamEnv` everywhere that we interact with the type system. This would allow things such as normalization (TODO: write a chapter about normalization and link it), evaluating generic constants, and proving where clauses/goals, to rely on `T` being sized, implementing `Trait`, etc.
35+
If we were conceptually inside of `foo` (for example, type-checking or linting it) we would use this `ParamEnv` everywhere that we interact with the type system. This would allow things such as [normalization], evaluating generic constants, and proving where clauses/goals, to rely on `T` being sized, implementing `Trait`, etc.
3636

3737
A more concrete example:
3838
```rust
@@ -70,6 +70,7 @@ fn foo2<T>(a: T) {
7070
[predicates_of]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/collect/predicates_of/fn.predicates_of.html
7171
[method_pred_entailment]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir_analysis/check/compare_impl_item/fn.compare_method_predicate_entailment.html
7272
[query]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env
73+
[normalization]: normalization.md
7374

7475
### Acquiring a `ParamEnv`
7576

@@ -199,8 +200,8 @@ In the next-gen trait solver the requirement for all where clauses in the `Param
199200

200201
Depending on what context we are performing type system operations in, different behaviour may be required. For example during coherence there are stronger requirements about when we can consider goals to not hold or when we can consider types to be unequal.
201202

202-
Tracking which "phase" of the compiler type system operations are being performed in is done by the [`TypingMode`][tenv] enum. The documentation on the `TypingMode` enum is quite good so instead of repeating it here verbatim we would recommend reading the API documentation directly.
203+
Tracking which "phase" of the compiler type system operations are being performed in is done by the [`TypingMode`][tmode] enum. The documentation on the `TypingMode` enum is quite good so instead of repeating it here verbatim we would recommend reading the API documentation directly.
203204

204205
[penv]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.ParamEnv.html
205-
[tenv]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_type_ir/infer_ctxt/enum.TypingMode.html
206+
[tenv]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TypingEnv.html
206207
[tmode]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/type.TypingMode.html
Lines changed: 70 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,82 @@
1-
[assign]
1+
# This file's format is documented at
2+
# https://forge.rust-lang.org/triagebot/pr-assignment.html#configuration
3+
4+
[autolabel."needs-triage"]
5+
new_issue = true
6+
exclude_labels = [
7+
"A-diagnostics",
8+
"C-tracking-issue",
9+
]
10+
11+
[review-submitted]
12+
# This label is added when a "request changes" review is submitted.
13+
reviewed_label = "S-waiting-on-author"
14+
# These labels are removed when a "request changes" review is submitted.
15+
review_labels = ["S-waiting-on-review"]
16+
17+
[review-requested]
18+
# Those labels are removed when PR author requests a review from an assignee
19+
remove_labels = ["S-waiting-on-author"]
20+
# Those labels are added when PR author requests a review from an assignee
21+
add_labels = ["S-waiting-on-review"]
22+
23+
# Enable shortcuts like `@rustbot ready`
24+
# Documentation at: https://forge.rust-lang.org/triagebot/shortcuts.html
25+
[shortcut]
26+
27+
[autolabel."S-waiting-on-review"]
28+
new_pr = true
29+
30+
# Enable issue transfers within the org
31+
# Documentation at: https://forge.rust-lang.org/triagebot/transfer.html
32+
[transfer]
233

334
[relabel]
435
allow-unauthenticated = [
5-
"waiting-on-review",
6-
"waiting-on-author",
7-
"blocked",
36+
"-Z*",
37+
"A-*",
38+
"C-*",
39+
"D-*",
40+
"E-*",
41+
"F-*",
42+
"I-*",
43+
"L-*",
44+
"O-*",
45+
"PG-*",
46+
"S-*",
47+
"T-*",
48+
"WG-*",
49+
"needs-triage",
850
]
951

52+
# Enable `@rustbot note` functionality
53+
# Documentation at: https://forge.rust-lang.org/triagebot/note.html
54+
[note]
55+
56+
# Prevents mentions in commits to avoid users being spammed
57+
# Documentation at: https://forge.rust-lang.org/triagebot/no-mentions.html
1058
[no-mentions]
1159

12-
[canonicalize-issue-links]
60+
# Canonicalize issue numbers to avoid closing the wrong issue
61+
# when commits are included in subtrees, as well as warning links in commits.
62+
# Documentation at: https://forge.rust-lang.org/triagebot/issue-links.html
63+
[issue-links]
1364

1465
# Automatically close and reopen PRs made by bots to run CI on them
1566
[bot-pull-requests]
1667

1768
[behind-upstream]
18-
days-threshold = 7
69+
days-threshold = 7
70+
71+
# Enable triagebot (PR) assignment.
72+
# Documentation at: https://forge.rust-lang.org/triagebot/pr-assignment.html
73+
[assign]
74+
75+
# Keep members alphanumerically sorted.
76+
[assign.adhoc_groups]
77+
rustc-dev-guide = [
78+
"@BoxyUwU",
79+
"@jieyouxu",
80+
"@jyn514",
81+
"@tshepang",
82+
]

‎src/doc/rustc/src/platform-support/x86_64-fortanix-unknown-sgx.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ based on the ABI defined by Fortanix for the [Enclave Development Platform
1111

1212
[@jethrogb](https://github.com/jethrogb)
1313
[@raoulstrackx](https://github.com/raoulstrackx)
14-
[@mzohreva](https://github.com/mzohreva)
14+
[@aditijannu](https://github.com/aditijannu)
1515

1616
Further contacts:
1717

‎tests/crashes/140255.rs

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern crate proc_macro;
2+
use proc_macro::*;
3+
4+
#[proc_macro_attribute]
5+
pub fn a(_: TokenStream, input: TokenStream) -> TokenStream {
6+
input
7+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// issue#140255
2+
3+
#[macro_use::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use`
4+
fn f0() {}
5+
6+
#[macro_use::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_use`
7+
fn f1() {}
8+
9+
#[macro_escape::a] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape`
10+
fn f2() {}
11+
12+
#[macro_escape::a::b] //~ ERROR failed to resolve: use of unresolved module or unlinked crate `macro_escape`
13+
fn f3() {}
14+
15+
fn main() {}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape`
2+
--> $DIR/illegal-macro-use.rs:12:3
3+
|
4+
LL | #[macro_escape::a::b]
5+
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape`
6+
7+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_escape`
8+
--> $DIR/illegal-macro-use.rs:9:3
9+
|
10+
LL | #[macro_escape::a]
11+
| ^^^^^^^^^^^^ use of unresolved module or unlinked crate `macro_escape`
12+
13+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use`
14+
--> $DIR/illegal-macro-use.rs:6:3
15+
|
16+
LL | #[macro_use::a::b]
17+
| ^^^^^^^^^ use of unresolved module or unlinked crate `macro_use`
18+
19+
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `macro_use`
20+
--> $DIR/illegal-macro-use.rs:3:3
21+
|
22+
LL | #[macro_use::a]
23+
| ^^^^^^^^^ use of unresolved module or unlinked crate `macro_use`
24+
25+
error: aborting due to 4 previous errors
26+
27+
For more information about this error, try `rustc --explain E0433`.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ check-pass
2+
//@ proc-macro: external-macro-use.rs
3+
4+
// issue#140255
5+
6+
extern crate external_macro_use as macro_use;
7+
8+
#[macro_use::a]
9+
fn f() {}
10+
11+
fn main() {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//@ check-pass
2+
//@ edition:2018
3+
4+
#![no_implicit_prelude]
5+
#![warn(unused_extern_crates)]
6+
7+
extern crate std;
8+
fn main() {
9+
let r = 1u16..10;
10+
std::println!("{:?}", r.is_empty());
11+
}

0 commit comments

Comments
 (0)
Please sign in to comment.