Review comments
This commit is contained in:
parent
dd5c9bf139
commit
11d62aa284
4 changed files with 36 additions and 13 deletions
|
@ -1056,9 +1056,21 @@ impl<'tcx> Predicate<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Converts this to a `Binder<PredicateAtom<'tcx>>`. If the value was an
|
||||
/// `Atom`, then it is not allowed to contain escaping bound vars.
|
||||
pub fn bound_atom(self, _tcx: TyCtxt<'tcx>) -> Binder<PredicateAtom<'tcx>> {
|
||||
match self.kind() {
|
||||
&PredicateKind::ForAll(binder) => binder,
|
||||
&PredicateKind::Atom(atom) => {
|
||||
assert!(!atom.has_escaping_bound_vars());
|
||||
Binder::dummy(atom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Allows using a `Binder<PredicateAtom<'tcx>>` even if the given predicate previously
|
||||
/// contained unbound variables by shifting these variables outwards.
|
||||
pub fn bound_atom(self, tcx: TyCtxt<'tcx>) -> Binder<PredicateAtom<'tcx>> {
|
||||
pub fn bound_atom_with_opt_escaping(self, tcx: TyCtxt<'tcx>) -> Binder<PredicateAtom<'tcx>> {
|
||||
match self.kind() {
|
||||
&PredicateKind::ForAll(binder) => binder,
|
||||
&PredicateKind::Atom(atom) => Binder::wrap_nonbinding(tcx, atom),
|
||||
|
|
|
@ -618,7 +618,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||
// may contain unbound variables. We therefore do this manually.
|
||||
//
|
||||
// FIXME(lcnr): Find out why exactly this is the case :)
|
||||
let bound_predicate = predicate.bound_atom(self.tcx());
|
||||
let bound_predicate = predicate.bound_atom_with_opt_escaping(self.tcx());
|
||||
if let ty::PredicateAtom::Trait(pred, _) = bound_predicate.skip_binder() {
|
||||
let trait_ref = bound_predicate.map_bound(|_| pred.trait_ref);
|
||||
// Don't print +Sized, but rather +?Sized if absent.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue