Skip to content

Commit 3b7057e

Browse files
committed
Auto merge of #151395 - Zalathar:rollup-8gANGZS, r=Zalathar
Rollup of 8 pull requests Successful merges: - rust-lang/rust#149587 (coverage: Sort the expansion tree to help choose a single BCB for child expansions) - rust-lang/rust#150071 (Add dist step for Enzyme) - rust-lang/rust#150288 (Add scalar support for offload) - rust-lang/rust#151091 (Add new "hide deprecated items" setting in rustdoc) - rust-lang/rust#151255 (rustdoc: Fix ICE when deprecated note is not resolved on the correct `DefId`) - rust-lang/rust#151375 (Fix terminal width dependent tests) - rust-lang/rust#151384 (add basic `TokenStream` api tests) - rust-lang/rust#151391 (rustc-dev-guide subtree update) r? @ghost
2 parents d7c3d63 + a62aab8 commit 3b7057e

12 files changed

Lines changed: 114 additions & 43 deletions

File tree

src/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@
140140

141141
- [Command-line arguments](./cli.md)
142142
- [rustc_driver and rustc_interface](./rustc-driver/intro.md)
143-
- [Remarks on perma-unstable features](./rustc-driver/remarks-on-perma-unstable-features.md)
143+
- [External rustc_drivers](./rustc-driver/external-rustc-drivers.md)
144144
- [Example: Type checking](./rustc-driver/interacting-with-the-ast.md)
145145
- [Example: Getting diagnostics](./rustc-driver/getting-diagnostics.md)
146146
- [Errors and lints](diagnostics.md)

src/about-this-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ You might also find the following sites useful:
103103
[tlgba]: https://tomlee.co/2014/04/a-more-detailed-tour-of-the-rust-compiler/
104104
[ro]: https://www.rustaceans.org/
105105
[rctd]: tests/intro.md
106-
[cheatsheet]: https://bors.rust-lang.org/
106+
[cheatsheet]: https://bors.rust-lang.org/help
107107
[Miri]: https://github.com/rust-lang/miri
108-
[@bors]: https://github.com/bors
108+
[@bors]: https://github.com/rust-lang/bors
109109
[a GitHub repository]: https://github.com/rust-lang/rustc-dev-guide/
110110
[rustc API docs]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle
111111
[Forge]: https://forge.rust-lang.org/

src/building/suggested.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ for two reasons:
9797
additional rebuilds in some cases.
9898

9999
To avoid these problems:
100-
- Add `--build-dir=build/rust-analyzer` to all of the custom `x` commands in
100+
- Add `--build-dir=build-rust-analyzer` to all of the custom `x` commands in
101101
your editor's rust-analyzer configuration.
102102
(Feel free to choose a different directory name if desired.)
103103
- Modify the `rust-analyzer.rustfmt.overrideCommand` setting so that it points

src/compiler-team.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ Once you have made a number of individual PRs to rustc, we will often
9696
offer r+ privileges. This means that you have the right to instruct
9797
"bors" (the robot that manages which PRs get landed into rustc) to
9898
merge a PR
99-
([here are some instructions for how to talk to bors][homu-guide]).
99+
([here are some instructions for how to talk to bors][bors-guide]).
100100

101-
[homu-guide]: https://bors.rust-lang.org/
101+
[bors-guide]: https://bors.rust-lang.org/
102102

103103
The guidelines for reviewers are as follows:
104104

src/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ this can take a while and the queue can sometimes be long.
283283
Also, note that PRs are never merged by hand.
284284

285285
[@rustbot]: https://github.com/rustbot
286-
[@bors]: https://github.com/bors
286+
[@bors]: https://github.com/rust-lang/bors
287287

288288
### Opening a PR
289289

src/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ For example:
9696
Not all important or beginner work has issue labels.
9797
See below for how to find work that isn't labelled.
9898

99-
[help-wanted-search]: https://github.com/issues?q=is%3Aopen%20is%3Aissue%20org%3Arust-lang%20no%3Aassignee%20label%3AE-easy%2CE-medium%2CE-help-wanted%2CE-mentor%20-label%3AS-blocked%20-linked%3Apr
99+
[help-wanted-search]: https://github.com/rust-lang/rust/issues?q=is%3Aopen%20is%3Aissue%20org%3Arust-lang%20no%3Aassignee%20label%3AE-easy%2CE-medium%2CE-help-wanted%2CE-mentor%20-label%3AS-blocked%20-linked%3Apr
100100
[Triage]: ./contributing.md#issue-triage
101101

102102
### Recurring work

src/git.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,14 @@ command to check it out locally. See <https://cli.github.com/> for more info.
495495

496496
![`gh` suggestion](./img/github-cli.png)
497497

498+
### Using GitHub dev
499+
500+
As an alternative to the GitHub web UI, GitHub Dev provides a web-based editor for browsing
501+
repository and PRs. It can be opened by replacing `github.com` with `github.dev` in the URL
502+
or by pressing `.` on a GitHub page.
503+
See [the docs for github.dev editor](https://docs.github.com/en/codespaces/the-githubdev-web-based-editor)
504+
for more details.
505+
498506
### Moving large sections of code
499507

500508
Git and Github's default diff view for large moves *within* a file is quite poor; it will show each

src/rustc-driver/remarks-on-perma-unstable-features.md renamed to src/rustc-driver/external-rustc-drivers.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Remarks on perma unstable features
1+
# External `rustc_driver`s
22

33
## `rustc_private`
44

@@ -49,6 +49,29 @@ For custom-built toolchains or environments not using rustup, additional configu
4949
```
5050
3. **Check version compatibility**: Ensure your LLVM version is compatible with your Rust toolchain
5151

52+
### Configuring `rust-analyzer` for Out-of-Tree Projects
53+
54+
When developing out-of-tree projects that use `rustc_private` crates, you can configure `rust-analyzer` to recognize these crates.
55+
56+
#### Configuration Steps
57+
58+
1. **Set rust-analyzer configuration**
59+
Configure `rust-analyzer.rustc.source` to `"discover"` in your editor settings.
60+
For VS Code, add to `rust_analyzer_settings.json`:
61+
```json
62+
{
63+
"rust-analyzer.rustc.source": "discover"
64+
}
65+
```
66+
2. **Add metadata to Cargo.toml**
67+
Add the following to the `Cargo.toml` of every crate that uses `rustc_private`:
68+
```toml
69+
[package.metadata.rust-analyzer]
70+
rustc_private = true
71+
```
72+
73+
This configuration allows `rust-analyzer` to properly recognize and provide IDE support for `rustc_private` crates in out-of-tree projects.
74+
5275
### Additional Resources
5376

5477
- [GitHub Issue #137421](https://github.com/rust-lang/rust/issues/137421): Explains that `rustc_private` linker failures often occur because `llvm-tools` is not installed

src/solve/candidate-preference.md

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -260,31 +260,6 @@ We prefer builtin trait object impls over user-written impls. This is **unsound*
260260

261261
The candidate preference behavior during normalization is implemented in [`fn assemble_and_merge_candidates`].
262262

263-
### Where-bounds shadow impls
264-
265-
Normalization of associated items does not consider impls if the corresponding trait goal has been proven via a `ParamEnv` or `AliasBound` candidate.
266-
This means that for where-bounds which do not constrain associated types, the associated types remain *rigid*.
267-
268-
This is necessary to avoid unnecessary region constraints from applying impls.
269-
```rust
270-
trait Trait<'a> {
271-
type Assoc;
272-
}
273-
impl Trait<'static> for u32 {
274-
type Assoc = u32;
275-
}
276-
277-
fn bar<'b, T: Trait<'b>>() -> T::Assoc { todo!() }
278-
fn foo<'a>()
279-
where
280-
u32: Trait<'a>,
281-
{
282-
// Normalizing the return type would use the impl, proving
283-
// the `T: Trait` where-bound would use the where-bound, resulting
284-
// in different region constraints.
285-
bar::<'_, u32>();
286-
}
287-
```
288263

289264
### We always consider `AliasBound` candidates
290265

@@ -418,10 +393,73 @@ where
418393
}
419394
```
420395

396+
### Trait where-bounds shadow impls
397+
398+
Normalization of associated items does not consider impls if the corresponding trait goal has been proven via a `ParamEnv` or `AliasBound` candidate.
399+
This means that for where-bounds which do not constrain associated types, the associated types remain *rigid*.
400+
401+
#### Using impls results in different region constraints
402+
403+
This is necessary to avoid unnecessary region constraints from applying impls.
404+
```rust
405+
trait Trait<'a> {
406+
type Assoc;
407+
}
408+
impl Trait<'static> for u32 {
409+
type Assoc = u32;
410+
}
411+
412+
fn bar<'b, T: Trait<'b>>() -> T::Assoc { todo!() }
413+
fn foo<'a>()
414+
where
415+
u32: Trait<'a>,
416+
{
417+
// Normalizing the return type would use the impl, proving
418+
// the `T: Trait` where-bound would use the where-bound, resulting
419+
// in different region constraints.
420+
bar::<'_, u32>();
421+
}
422+
```
423+
424+
#### RPITIT `type_of` cycles
425+
426+
We currently have to avoid impl candidates if there are where-bounds to avoid query cycles for RPITIT, see [#139762]. It feels desirable to me to stop relying on auto-trait leakage of during RPITIT computation to remove this issue, see [#139788].
427+
428+
```rust
429+
use std::future::Future;
430+
pub trait ReactiveFunction: Send {
431+
type Output;
432+
433+
fn invoke(self) -> Self::Output;
434+
}
435+
436+
trait AttributeValue {
437+
fn resolve(self) -> impl Future<Output = ()> + Send;
438+
}
439+
440+
impl<F, V> AttributeValue for F
441+
where
442+
F: ReactiveFunction<Output = V>,
443+
V: AttributeValue,
444+
{
445+
async fn resolve(self) {
446+
// We're awaiting `<V as AttributeValue>::{synthetic#0}` here.
447+
// Normalizing that one via the the impl we're currently in
448+
// relies on `collect_return_position_impl_trait_in_trait_tys` which
449+
// ends up relying on auto-trait leakage when checking that the
450+
// opaque return type of this function implements the `Send` item
451+
// bound of the trait definition.
452+
self.invoke().resolve().await
453+
}
454+
}
455+
```
456+
421457
[`Candidate`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/assembly/struct.Candidate.html
422458
[`CandidateSource`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_next_trait_solver/solve/enum.CandidateSource.html
423459
[`fn merge_trait_candidates`]: https://github.com/rust-lang/rust/blob/e3ee7f7aea5b45af3b42b5e4713da43876a65ac9/compiler/rustc_next_trait_solver/src/solve/trait_goals.rs#L1342-L1424
424460
[`fn assemble_and_merge_candidates`]: https://github.com/rust-lang/rust/blob/e3ee7f7aea5b45af3b42b5e4713da43876a65ac9/compiler/rustc_next_trait_solver/src/solve/assembly/mod.rs#L920-L1003
425461
[trait-system-refactor-initiative#76]: https://github.com/rust-lang/trait-system-refactor-initiative/issues/76
426462
[#24066]: https://github.com/rust-lang/rust/issues/24066
427-
[#133044]: https://github.com/rust-lang/rust/issues/133044
463+
[#133044]: https://github.com/rust-lang/rust/issues/133044
464+
[#139762]: https://github.com/rust-lang/rust/pull/139762
465+
[#139788]: https://github.com/rust-lang/rust/issues/139788

src/tests/ci.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ to help make the perf comparison as fair as possible.
198198
>
199199
> 3. Run the prescribed try jobs with `@bors try`. As aforementioned, this
200200
> requires the user to either (1) have `try` permissions or (2) be delegated
201-
> with `try` permissions by `@bors delegate` by someone who has `try`
201+
> with `try` permissions by `@bors delegate=try` by someone who has `try`
202202
> permissions.
203203
>
204204
> Note that this is usually easier to do than manually edit [`jobs.yml`].
@@ -213,10 +213,7 @@ the corresponding PR.
213213
Multiple try builds can execute concurrently across different PRs, but there can be at most
214214
a single try build running on a single PR at any given time.
215215
216-
Note that try builds are handled using the [new bors] implementation.
217-
218216
[rustc-perf]: https://github.com/rust-lang/rustc-perf
219-
[new bors]: https://github.com/rust-lang/bors
220217
221218
### Modifying CI jobs
222219
@@ -281,8 +278,7 @@ Breakages like these usually happen when another, incompatible PR is merged
281278
after the build happened.
282279

283280
To ensure a `main` branch that works all the time, we forbid manual merges.
284-
Instead, all PRs have to be approved through our bot, [bors] (the software
285-
behind it is called [homu]).
281+
Instead, all PRs have to be approved through our bot, [bors].
286282
All the approved PRs are put in a [merge queue]
287283
(sorted by priority and creation date) and are automatically tested one at the time.
288284
If all the builders are green, the PR is merged, otherwise the failure is
@@ -465,8 +461,7 @@ To do this:
465461
[`jobs.yml`]: https://github.com/rust-lang/rust/blob/HEAD/src/ci/github-actions/jobs.yml
466462
[`.github/workflows/ci.yml`]: https://github.com/rust-lang/rust/blob/HEAD/.github/workflows/ci.yml
467463
[`src/ci/citool`]: https://github.com/rust-lang/rust/blob/HEAD/src/ci/citool
468-
[bors]: https://github.com/bors
469-
[homu]: https://github.com/rust-lang/homu
464+
[bors]: https://github.com/rust-lang/bors
470465
[merge queue]: https://bors.rust-lang.org/queue/rust
471466
[dist-x86_64-linux]: https://github.com/rust-lang/rust/blob/HEAD/src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
472467
[the GitHub Actions workflows page]: https://github.com/rust-lang/rust/actions

0 commit comments

Comments
 (0)