Rollup merge of #138109 - Kohei316:feat/rust-doc-precise-capturing-arg, r=aDotInTheVoid,compiler-errors

make precise capturing args in rustdoc Json typed

close #137616

This PR includes below changes.

- Add `rustc_hir::PreciseCapturingArgKind` which allows the query system to return a arg's data.
- Add `rustdoc::clean::types::PreciseCapturingArg` and change to use it.
- Add `rustdoc-json-types::PreciseCapturingArg` and change to use it.
- Update `tests/rustdoc-json/impl-trait-precise-capturing.rs`.
- Bump `rustdoc_json_types::FORMAT_VERSION`.
This commit is contained in:
Matthias Krüger
2025-03-13 11:28:26 +01:00
committed by GitHub
11 changed files with 96 additions and 20 deletions

View File

@@ -3373,13 +3373,16 @@ pub struct OpaqueTy<'hir> {
pub span: Span,
}
#[derive(Debug, Clone, Copy, HashStable_Generic)]
pub enum PreciseCapturingArg<'hir> {
Lifetime(&'hir Lifetime),
#[derive(Debug, Clone, Copy, HashStable_Generic, Encodable, Decodable)]
pub enum PreciseCapturingArgKind<T, U> {
Lifetime(T),
/// Non-lifetime argument (type or const)
Param(PreciseCapturingNonLifetimeArg),
Param(U),
}
pub type PreciseCapturingArg<'hir> =
PreciseCapturingArgKind<&'hir Lifetime, PreciseCapturingNonLifetimeArg>;
impl PreciseCapturingArg<'_> {
pub fn hir_id(self) -> HirId {
match self {