Closed
Conversation
PR rust-lang#154634 recently renamed many type parameters that impl `HashStableContext` as `Hcx`. It missed a few that are named `HirCtx`. This commit renames them.
They're in multiple sections with no rhyme or reason.
`derive(HashStable_Generic)` generates impls like this:
```
impl<__CTX> HashStable<__CTX> for ExpnKind
where
__CTX: crate::HashStableContext
{
fn hash_stable(&self, hcx : &mut __CTX, __hasher: &mut StableHasher) {
...
}
}
```
This is used for crates that are upstream of `rustc_middle`.
The `crate::HashStableContext` bound means every crate that uses
`derive(HashStable_Generic)` must provide (or import) a trait
`HashStableContext` which `rustc_middle` then impls. In `rustc_span`
this trait is sensible, with three methods. In other crates, this trait
is empty, and there is the following trait hierarchy:
```
rustc_session::HashStableContext
| |
| rustc_hir::HashStableContext
| / \
rustc_ast::HashStableContext rustc_abi::HashStableContext
|
rustc_span::HashStableContext
```
All very strange and unnecessary. This commit changes
`derive(HashStable_Generic)` to use `rustc_span::HashStableContext`
instead of `crate::HashStableContext`. This eliminates the need for all
the empty `HashStableContext` traits and impls. Much better.
This annotates the `Arc` type with the diagnostic attribute `#[diagnostic::on_move]`. Now when a moved `Arc` is borrowed, a suggestion to clone it is made, with a label explaining why.
…_attrs` function
…y_macro_source` function
…_macro` function
…middle_region` function
…region_outlives_predicate` function
…proc_macro` function
…f_id_and_parts` function
…field_with_def_id` function
…bound_vars` function
…_arc_type, r=tgross35 Introduce #[diagnostic::on_move] on `Arc` This is related to the tracking issue rust-lang#154181 and to the original issue rust-lang#149862 .
…leLapkin tidy-alphabetical: fix line number in error message
Export `derive` at the crate root: `core::derive` and `std::derive` This PR makes the `derive` macro available at the crate root: ```rust #[std::derive(Clone)] #[core::derive(Copy)] struct X; ``` ACP: rust-lang/libs-team#766 Tracking issue: rust-lang#154645
…-items, r=GuillaumeGomez rustdoc: seperate methods and associated functions in sidebar fixes rust-lang#154602 r? @fmease before: <img width="340" height="591" alt="image" src="https://github.com/user-attachments/assets/79268155-5260-4bb9-a826-46f459fc81eb" /> after: <img width="514" height="588" alt="image" src="https://github.com/user-attachments/assets/b56b5ca6-28d7-45a7-86a9-ad6bf37f608a" /> example of type with both (`Box`): <img width="410" height="760" alt="image" src="https://github.com/user-attachments/assets/a74dd536-e931-4d8f-af95-275bfcf48285" />
…ooeo Avoid creating async return opaques for foreign async fns Fixes rust-lang#146754 Previously, def collection created the desugared async return opaque for foreign `async fn` items, but AST lowering won't lower that opaque for foreign items. That left a `DefId` without a corresponding HIR owner, which later caused an ICE during analysis.
Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args The ICE is fixed, but there needs to be a regression test for it. Closes rust-lang#127423.
… r=Urgau [rustdoc] Replace `DocContext` with `TyCtxt` wherever possible In a lot of places, we pass down `DocContext` but actually only use its `tcx` field (`TyCtxt`). To make it more obvious what's actually being done, I replaced `DocContext` with `TyCtxt` (which implements `Copy`) in the function arguments. It created quite the cascade effect so I ended up with a lot more changes I expected. Because it's a lot of changes, I made small commits which are easy to go through, so I strongly recommend reviewing this PR one commit at a time. r? @Urgau
Member
Author
|
@bors r+ rollup=never p=5 |
Contributor
Contributor
|
⌛ Testing commit 79cba78 with merge 92a904d... Workflow: https://github.com/rust-lang/rust/actions/runs/23896754101 |
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 2, 2026
Rollup of 11 pull requests Successful merges: - #153105 (Compute the result of a projection type with region errors) - #153960 (Make `layout_of` cycles fatal errors) - #154527 (Emit pre-expansion feature gate warnings for negative impls and specialization) - #154666 (Remove `StableHashContext` impls) - #154669 (Introduce #[diagnostic::on_move] on `Arc`) - #154213 (tidy-alphabetical: fix line number in error message) - #154442 (Export `derive` at the crate root: `core::derive` and `std::derive`) - #154644 (rustdoc: seperate methods and associated functions in sidebar) - #154660 (Avoid creating async return opaques for foreign async fns) - #154671 (Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args) - #154680 ([rustdoc] Replace `DocContext` with `TyCtxt` wherever possible)
Contributor
|
Stuck. Will make a bigger rollup that includes this one. |
Contributor
|
This pull request was unapproved due to being closed. Auto build was cancelled due to the PR being closed. Cancelled workflows: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
layout_ofcycles fatal errors #153960 (Makelayout_ofcycles fatal errors)StableHashContextimpls #154666 (RemoveStableHashContextimpls)Arc#154669 (Introduce #[diagnostic::on_move] onArc)deriveat the crate root:core::deriveandstd::derive#154442 (Exportderiveat the crate root:core::deriveandstd::derive)DocContextwithTyCtxtwherever possible #154680 ([rustdoc] ReplaceDocContextwithTyCtxtwherever possible)r? @ghost
Create a similar rollup