summary refs log tree commit diff
path: root/src/librustdoc/clean/utils.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-09-13 22:21:27 +0000
committerbors <bors@rust-lang.org>2023-09-13 22:21:27 +0000
commitd5c2e9c342b358556da91d61ed4133f6f50fc0c3 (patch)
treedeb699298bf1099d5cd455e3b03c70fe5db546cd /src/librustdoc/clean/utils.rs
parent5680fa18feaa87f3ff04063800aec256c3d4b4be (diff)
parent7900923b259380461d21071e2fbd0c604338fb9c (diff)
downloadrust-1.72.1.tar.gz
rust-1.72.1.zip
Auto merge of #115787 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum 1.72.1
[stable] 1.72.1 release

This backports:

*  Remove assert that checks type equality #115215
*  implied bounds: do not ICE on unconstrained region vars #115559
*  rustdoc: correctly deal with self ty params when eliding default object lifetimes #115276
*  Stop emitting non-power-of-two vectors in (non-portable-SIMD) codegen #115236
*  Normalize before checking if local is freeze in deduced_param_attrs #114948

Some cherry-picks required merge conflict resolution, we'll see if I got it right based on CI (rustdoc fix and LLVM codegen test).

r? `@Mark-Simulacrum`
Diffstat (limited to 'src/librustdoc/clean/utils.rs')
-rw-r--r--src/librustdoc/clean/utils.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index f375f0efbd1..b786ecbe38f 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -54,8 +54,7 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
     let primitives = local_crate.primitives(cx.tcx);
     let keywords = local_crate.keywords(cx.tcx);
     {
-        let ItemKind::ModuleItem(ref mut m) = *module.kind
-        else { unreachable!() };
+        let ItemKind::ModuleItem(ref mut m) = *module.kind else { unreachable!() };
         m.items.extend(primitives.iter().map(|&(def_id, prim)| {
             Item::from_def_id_and_parts(
                 def_id,
@@ -74,18 +73,15 @@ pub(crate) fn krate(cx: &mut DocContext<'_>) -> Crate {
 
 pub(crate) fn substs_to_args<'tcx>(
     cx: &mut DocContext<'tcx>,
-    substs: ty::Binder<'tcx, &'tcx [ty::subst::GenericArg<'tcx>]>,
-    mut skip_first: bool,
+    args: ty::Binder<'tcx, &'tcx [ty::GenericArg<'tcx>]>,
+    has_self: bool,
     container: Option<DefId>,
 ) -> Vec<GenericArg> {
+    let mut skip_first = has_self;
     let mut ret_val =
-        Vec::with_capacity(substs.skip_binder().len().saturating_sub(if skip_first {
-            1
-        } else {
-            0
-        }));
+        Vec::with_capacity(args.skip_binder().len().saturating_sub(if skip_first { 1 } else { 0 }));
 
-    ret_val.extend(substs.iter().enumerate().filter_map(|(index, kind)| {
+    ret_val.extend(args.iter().enumerate().filter_map(|(index, kind)| {
         match kind.skip_binder().unpack() {
             GenericArgKind::Lifetime(lt) => {
                 Some(GenericArg::Lifetime(clean_middle_region(lt).unwrap_or(Lifetime::elided())))
@@ -100,7 +96,8 @@ pub(crate) fn substs_to_args<'tcx>(
                 None,
                 container.map(|container| crate::clean::ContainerTy::Regular {
                     ty: container,
-                    substs,
+                    args,
+                    has_self,
                     arg: index,
                 }),
             ))),