Skip to content

Commit 3569a42

Browse files
authored
Rollup merge of #97288 - compiler-errors:tcxify-rustdoc, r=Dylan-DPC
Lifetime variance fixes for rustdoc #97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime. This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`. Split out from #97287 so the rustdoc team can review independently.
2 parents b2eba05 + b2a95cb commit 3569a42

File tree

4 files changed

+166
-154
lines changed

4 files changed

+166
-154
lines changed

compiler/rustc_hir/src/hir.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,12 @@ pub struct GenericArgs<'hir> {
343343
pub span_ext: Span,
344344
}
345345

346-
impl GenericArgs<'_> {
346+
impl<'hir> GenericArgs<'hir> {
347347
pub const fn none() -> Self {
348348
Self { args: &[], bindings: &[], parenthesized: false, span_ext: DUMMY_SP }
349349
}
350350

351-
pub fn inputs(&self) -> &[Ty<'_>] {
351+
pub fn inputs(&self) -> &[Ty<'hir>] {
352352
if self.parenthesized {
353353
for arg in self.args {
354354
match arg {
@@ -549,7 +549,7 @@ impl<'hir> Generics<'hir> {
549549
&NOPE
550550
}
551551

552-
pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'_>> {
552+
pub fn get_named(&self, name: Symbol) -> Option<&GenericParam<'hir>> {
553553
for param in self.params {
554554
if name == param.name.ident().name {
555555
return Some(param);
@@ -608,7 +608,7 @@ impl<'hir> Generics<'hir> {
608608
pub fn bounds_for_param(
609609
&self,
610610
param_def_id: LocalDefId,
611-
) -> impl Iterator<Item = &WhereBoundPredicate<'_>> {
611+
) -> impl Iterator<Item = &WhereBoundPredicate<'hir>> {
612612
self.predicates.iter().filter_map(move |pred| match pred {
613613
WherePredicate::BoundPredicate(bp) if bp.is_param_bound(param_def_id.to_def_id()) => {
614614
Some(bp)

src/librustdoc/clean/inline.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub(crate) fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean
218218
}
219219
}
220220

221-
fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Function {
221+
fn build_external_function<'tcx>(cx: &mut DocContext<'tcx>, did: DefId) -> clean::Function {
222222
let sig = cx.tcx.fn_sig(did);
223223

224224
let predicates = cx.tcx.predicates_of(did);

0 commit comments

Comments
 (0)