Move binder for dyn to each list item
This commit is contained in:
parent
58d2bad9f7
commit
ed80815bf2
25 changed files with 307 additions and 261 deletions
|
@ -222,7 +222,7 @@ impl Printer<'tcx> for SymbolPrinter<'tcx> {
|
|||
|
||||
fn print_dyn_existential(
|
||||
mut self,
|
||||
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
|
||||
predicates: &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
|
||||
) -> Result<Self::DynExistential, Self::Error> {
|
||||
let mut first = true;
|
||||
for p in predicates {
|
||||
|
|
|
@ -465,9 +465,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
|||
|
||||
ty::Dynamic(predicates, r) => {
|
||||
self.push("D");
|
||||
self = self.in_binder(&predicates, |cx, predicates| {
|
||||
cx.print_dyn_existential(predicates)
|
||||
})?;
|
||||
self = self.print_dyn_existential(predicates)?;
|
||||
self = r.print(self)?;
|
||||
}
|
||||
|
||||
|
@ -486,26 +484,29 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
|||
|
||||
fn print_dyn_existential(
|
||||
mut self,
|
||||
predicates: &'tcx ty::List<ty::ExistentialPredicate<'tcx>>,
|
||||
predicates: &'tcx ty::List<ty::Binder<ty::ExistentialPredicate<'tcx>>>,
|
||||
) -> Result<Self::DynExistential, Self::Error> {
|
||||
for predicate in predicates {
|
||||
match predicate {
|
||||
ty::ExistentialPredicate::Trait(trait_ref) => {
|
||||
// Use a type that can't appear in defaults of type parameters.
|
||||
let dummy_self = self.tcx.mk_ty_infer(ty::FreshTy(0));
|
||||
let trait_ref = trait_ref.with_self_ty(self.tcx, dummy_self);
|
||||
self = self.print_def_path(trait_ref.def_id, trait_ref.substs)?;
|
||||
self = self.in_binder(&predicate, |mut cx, predicate| {
|
||||
match predicate {
|
||||
ty::ExistentialPredicate::Trait(trait_ref) => {
|
||||
// Use a type that can't appear in defaults of type parameters.
|
||||
let dummy_self = cx.tcx.mk_ty_infer(ty::FreshTy(0));
|
||||
let trait_ref = trait_ref.with_self_ty(cx.tcx, dummy_self);
|
||||
cx = cx.print_def_path(trait_ref.def_id, trait_ref.substs)?;
|
||||
}
|
||||
ty::ExistentialPredicate::Projection(projection) => {
|
||||
let name = cx.tcx.associated_item(projection.item_def_id).ident;
|
||||
cx.push("p");
|
||||
cx.push_ident(&name.as_str());
|
||||
cx = projection.ty.print(cx)?;
|
||||
}
|
||||
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
||||
cx = cx.print_def_path(*def_id, &[])?;
|
||||
}
|
||||
}
|
||||
ty::ExistentialPredicate::Projection(projection) => {
|
||||
let name = self.tcx.associated_item(projection.item_def_id).ident;
|
||||
self.push("p");
|
||||
self.push_ident(&name.as_str());
|
||||
self = projection.ty.print(self)?;
|
||||
}
|
||||
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
||||
self = self.print_def_path(def_id, &[])?;
|
||||
}
|
||||
}
|
||||
Ok(cx)
|
||||
})?;
|
||||
}
|
||||
self.push("E");
|
||||
Ok(self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue