mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Fix v0 symbol mangling bug
This commit is contained in:
parent
2bafe96272
commit
c34e7c60f5
@ -485,27 +485,37 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
|||||||
mut self,
|
mut self,
|
||||||
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
|
predicates: &'tcx ty::List<ty::Binder<'tcx, ty::ExistentialPredicate<'tcx>>>,
|
||||||
) -> Result<Self::DynExistential, Self::Error> {
|
) -> Result<Self::DynExistential, Self::Error> {
|
||||||
for predicate in predicates {
|
let mut predicate_iter = predicates.iter().peekable();
|
||||||
self = self.in_binder(&predicate, |mut cx, predicate| {
|
while let Some(predicate) = predicate_iter.next() {
|
||||||
match predicate {
|
match predicate.as_ref().skip_binder() {
|
||||||
ty::ExistentialPredicate::Trait(trait_ref) => {
|
ty::ExistentialPredicate::Trait(trait_ref) => {
|
||||||
|
self = self.in_binder(&predicate, |mut cx, _predicate| {
|
||||||
// Use a type that can't appear in defaults of type parameters.
|
// Use a type that can't appear in defaults of type parameters.
|
||||||
let dummy_self = cx.tcx.mk_ty_infer(ty::FreshTy(0));
|
let dummy_self = cx.tcx.mk_ty_infer(ty::FreshTy(0));
|
||||||
let trait_ref = trait_ref.with_self_ty(cx.tcx, dummy_self);
|
let trait_ref = trait_ref.with_self_ty(cx.tcx, dummy_self);
|
||||||
cx = cx.print_def_path(trait_ref.def_id, trait_ref.substs)?;
|
cx = cx.print_def_path(trait_ref.def_id, trait_ref.substs)?;
|
||||||
}
|
while let Some(projection_pred) = predicate_iter.next_if(|p| {
|
||||||
ty::ExistentialPredicate::Projection(projection) => {
|
matches!(p.skip_binder(), ty::ExistentialPredicate::Projection(_))
|
||||||
let name = cx.tcx.associated_item(projection.item_def_id).ident;
|
}) {
|
||||||
cx.push("p");
|
let projection = match projection_pred.skip_binder() {
|
||||||
cx.push_ident(&name.as_str());
|
ty::ExistentialPredicate::Projection(projection) => projection,
|
||||||
cx = projection.ty.print(cx)?;
|
_ => unreachable!(),
|
||||||
}
|
};
|
||||||
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
let name = cx.tcx.associated_item(projection.item_def_id).ident;
|
||||||
cx = cx.print_def_path(*def_id, &[])?;
|
cx.push("p");
|
||||||
}
|
cx.push_ident(&name.as_str());
|
||||||
|
cx = projection.ty.print(cx)?;
|
||||||
|
}
|
||||||
|
Ok(cx)
|
||||||
|
})?;
|
||||||
}
|
}
|
||||||
Ok(cx)
|
ty::ExistentialPredicate::Projection(_) => {
|
||||||
})?;
|
unreachable!("handled in trait predicate arm")
|
||||||
|
}
|
||||||
|
ty::ExistentialPredicate::AutoTrait(def_id) => {
|
||||||
|
self = self.print_def_path(*def_id, &[])?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.push("E");
|
self.push("E");
|
||||||
Ok(self)
|
Ok(self)
|
||||||
|
Loading…
Reference in New Issue
Block a user