about summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty/generics.rs
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-12-09 17:42:33 +0000
committerMichael Goulet <michael@errs.io>2023-12-09 17:42:33 +0000
commitf1bf874fb13703d706fc8184407c6df12555d8e9 (patch)
tree57bc622bc48bd9c8ac5a5d344b33e839045b1abd /compiler/rustc_middle/src/ty/generics.rs
parent08587a56f13a45b4752f1408cadf203ae44c6cf0 (diff)
downloadrust-f1bf874fb13703d706fc8184407c6df12555d8e9.tar.gz
rust-f1bf874fb13703d706fc8184407c6df12555d8e9.zip
Don't print host effect param in pretty path_generic_args
Diffstat (limited to 'compiler/rustc_middle/src/ty/generics.rs')
-rw-r--r--compiler/rustc_middle/src/ty/generics.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/generics.rs b/compiler/rustc_middle/src/ty/generics.rs
index 8316f9c3058..12294b0a602 100644
--- a/compiler/rustc_middle/src/ty/generics.rs
+++ b/compiler/rustc_middle/src/ty/generics.rs
@@ -320,9 +320,11 @@ impl<'tcx> Generics {
         &'tcx self,
         tcx: TyCtxt<'tcx>,
         args: &'tcx [ty::GenericArg<'tcx>],
-    ) -> &'tcx [ty::GenericArg<'tcx>] {
-        let mut own_params = self.parent_count..self.count();
+    ) -> (&'tcx [ty::GenericArg<'tcx>], &'tcx [ty::GenericParamDef]) {
+        let mut own_args = self.parent_count..self.count();
+        let mut own_params = 0..self.params.len();
         if self.has_self && self.parent.is_none() {
+            own_args.start = 1;
             own_params.start = 1;
         }
 
@@ -332,7 +334,7 @@ impl<'tcx> Generics {
         // of semantic equivalence. While not ideal, that's
         // good enough for now as this should only be used
         // for diagnostics anyways.
-        own_params.end -= self
+        let num_default_params = self
             .params
             .iter()
             .rev()
@@ -342,8 +344,10 @@ impl<'tcx> Generics {
                 })
             })
             .count();
+        own_params.end -= num_default_params;
+        own_args.end -= num_default_params;
 
-        &args[own_params]
+        (&args[own_args], &self.params[own_params])
     }
 
     /// Returns the args corresponding to the generic parameters of this item, excluding `Self`.