Centralize on using Binder to introduce new binding levels, rather than having FnSig carry an implicit binding level. This means that we be more typesafe in general, since things that instantiate bound regions can drop the Binder to reflect that.

This commit is contained in:
Niko Matsakis 2014-12-12 11:28:35 -05:00
parent ed4952ef39
commit 1205fd88df
48 changed files with 462 additions and 545 deletions

View file

@ -577,7 +577,7 @@ impl Clean<TyParamBound> for ty::BuiltinBound {
impl<'tcx> Clean<TyParamBound> for ty::PolyTraitRef<'tcx> {
fn clean(&self, cx: &DocContext) -> TyParamBound {
self.value.clean(cx)
self.0.clean(cx)
}
}
@ -919,7 +919,7 @@ impl<'tcx> Clean<Type> for ty::FnOutput<'tcx> {
}
}
impl<'a, 'tcx> Clean<FnDecl> for (ast::DefId, &'a ty::FnSig<'tcx>) {
impl<'a, 'tcx> Clean<FnDecl> for (ast::DefId, &'a ty::PolyFnSig<'tcx>) {
fn clean(&self, cx: &DocContext) -> FnDecl {
let (did, sig) = *self;
let mut names = if did.node != 0 {
@ -931,10 +931,10 @@ impl<'a, 'tcx> Clean<FnDecl> for (ast::DefId, &'a ty::FnSig<'tcx>) {
let _ = names.next();
}
FnDecl {
output: Return(sig.output.clean(cx)),
output: Return(sig.0.output.clean(cx)),
attrs: Vec::new(),
inputs: Arguments {
values: sig.inputs.iter().map(|t| {
values: sig.0.inputs.iter().map(|t| {
Argument {
type_: t.clean(cx),
id: 0,
@ -1088,14 +1088,14 @@ impl<'tcx> Clean<Item> for ty::Method<'tcx> {
ty::StaticExplicitSelfCategory => (ast::SelfStatic.clean(cx),
self.fty.sig.clone()),
s => {
let sig = ty::FnSig {
inputs: self.fty.sig.inputs[1..].to_vec(),
..self.fty.sig.clone()
};
let sig = ty::Binder(ty::FnSig {
inputs: self.fty.sig.0.inputs[1..].to_vec(),
..self.fty.sig.0.clone()
});
let s = match s {
ty::ByValueExplicitSelfCategory => SelfValue,
ty::ByReferenceExplicitSelfCategory(..) => {
match self.fty.sig.inputs[0].sty {
match self.fty.sig.0.inputs[0].sty {
ty::ty_rptr(r, mt) => {
SelfBorrowed(r.clean(cx), mt.mutbl.clean(cx))
}
@ -1103,7 +1103,7 @@ impl<'tcx> Clean<Item> for ty::Method<'tcx> {
}
}
ty::ByBoxExplicitSelfCategory => {
SelfExplicit(self.fty.sig.inputs[0].clean(cx))
SelfExplicit(self.fty.sig.0.inputs[0].clean(cx))
}
ty::StaticExplicitSelfCategory => unreachable!(),
};
@ -1398,7 +1398,7 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
ty::ty_struct(did, ref substs) |
ty::ty_enum(did, ref substs) |
ty::ty_trait(box ty::TyTrait {
principal: ty::Binder { value: ty::TraitRef { def_id: did, ref substs } },
principal: ty::Binder(ty::TraitRef { def_id: did, ref substs }),
.. }) =>
{
let fqn = csearch::get_item_path(cx.tcx(), did);