fn dynify<T: TyVisitable>(x: T, new_self: Option<Ty>, for_method: bool) -> T
Expand description
Takes a T
valid in the context of a trait ref and transforms it into a T
valid in the
context of its vtable definition, i.e. no longer mentions the Self
type or Self
clause. If
new_self
is Some
, we replace any mention of the Self
type with it; otherwise we panic if
Self
is mentioned.
If for_method
is true, we’re handling a value coming from a AssocFn
, which takes the Self
clause as its first clause parameter. Otherwise we’re in trait scope, where the Self
clause
is represented with TraitRefKind::SelfId
.