about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2023-01-31 23:38:52 +0100
committerGitHub <noreply@github.com>2023-01-31 23:38:52 +0100
commitd36bdf2d307328d471289e782e1878e21d9a3e91 (patch)
tree2f503ba044e6f9cf20aa4c9db05b5d8a223e7968 /compiler/rustc_trait_selection/src
parent53bb6322dbc80d8a7da69e1ea4dbff98c4a70abb (diff)
parent0e98a162c86cbc4a1bad86d63a0eb72739bb99f3 (diff)
downloadrust-d36bdf2d307328d471289e782e1878e21d9a3e91.tar.gz
rust-d36bdf2d307328d471289e782e1878e21d9a3e91.zip
Rollup merge of #107486 - compiler-errors:bound-ty-keep-name, r=oli-obk
Track bound types like bound regions

When we instantiate bound types into placeholder types, we throw away the names for some reason. These names are particularly useful for error reporting once we have `for<T>` binders.

r? types
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/project.rs2
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/confirmation.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index a11c5e81969..53cae3e720c 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -783,7 +783,7 @@ impl<'tcx> TypeFolder<'tcx> for BoundVarReplacer<'_, 'tcx> {
             }
             ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
                 let universe = self.universe_for(debruijn);
-                let p = ty::PlaceholderType { universe, name: bound_ty.var };
+                let p = ty::PlaceholderType { universe, name: bound_ty.kind };
                 self.mapped_types.insert(p, bound_ty);
                 self.infcx.tcx.mk_ty(ty::Placeholder(p))
             }
diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
index 89a8fdbac1c..0a4136dc1cf 100644
--- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
+++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs
@@ -524,7 +524,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                             .kind
                         {
                             GenericParamDefKind::Type { .. } => {
-                                let kind = ty::BoundTyKind::Param(param.name);
+                                let kind = ty::BoundTyKind::Param(param.def_id, param.name);
                                 let bound_var = ty::BoundVariableKind::Ty(kind);
                                 bound_vars.push(bound_var);
                                 tcx.mk_ty(ty::Bound(