use rustc::hir::{self, GenericArg, HirVec};
use rustc::hir::def::{self, Def, CtorKind};
use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE};
-use rustc::ty::subst::Substs;
+use rustc::ty::subst::{InternalSubsts, SubstsRef};
use rustc::ty::{self, TyCtxt, Region, RegionVid, Ty, AdtKind};
use rustc::ty::fold::TypeFolder;
use rustc::ty::layout::VariantIdx;
}
fn external_generic_args(cx: &DocContext<'_, '_, '_>, trait_did: Option<DefId>, has_self: bool,
- bindings: Vec<TypeBinding>, substs: &Substs<'_>) -> GenericArgs {
+ bindings: Vec<TypeBinding>, substs: SubstsRef<'_>) -> GenericArgs {
let lifetimes = substs.regions().filter_map(|v| v.clean(cx)).collect();
let types = substs.types().skip(has_self as usize).collect::<Vec<_>>();
// trait_did should be set to a trait's DefId if called on a TraitRef, in order to sugar
// from Fn<(A, B,), C> to Fn(A, B) -> C
fn external_path(cx: &DocContext<'_, '_, '_>, name: &str, trait_did: Option<DefId>, has_self: bool,
- bindings: Vec<TypeBinding>, substs: &Substs<'_>) -> Path {
+ bindings: Vec<TypeBinding>, substs: SubstsRef<'_>) -> Path {
Path {
global: false,
def: Def::Err,
}
}
-impl<'tcx> Clean<Option<Vec<GenericBound>>> for Substs<'tcx> {
+impl<'tcx> Clean<Option<Vec<GenericBound>>> for InternalSubsts<'tcx> {
fn clean(&self, cx: &DocContext<'_, '_, '_>) -> Option<Vec<GenericBound>> {
let mut v = Vec::new();
v.extend(self.regions().filter_map(|r| r.clean(cx)).map(GenericBound::Outlives));
pub struct FnDecl {
pub inputs: Arguments,
pub output: FunctionRetTy,
- pub variadic: bool,
pub attrs: Attributes,
}
FnDecl {
inputs: (&self.0.inputs[..], self.1).clean(cx),
output: self.0.output.clean(cx),
- variadic: self.0.variadic,
attrs: Attributes::default()
}
}
FnDecl {
output: Return(sig.skip_binder().output().clean(cx)),
attrs: Attributes::default(),
- variadic: sig.skip_binder().variadic,
inputs: Arguments {
values: sig.skip_binder().inputs().iter().map(|t| {
Argument {
Slice(Box<Type>),
Array(Box<Type>, String),
Never,
+ CVarArgs,
Unique(Box<Type>),
RawPointer(Mutability, Box<Type>),
BorrowedRef {
Reference,
Fn,
Never,
+ CVarArgs,
}
#[derive(Clone, RustcEncodable, RustcDecodable, Copy, Debug)]
Reference => "reference",
Fn => "fn",
Never => "never",
+ CVarArgs => "...",
}
}
match self.node {
TyKind::Never => Never,
+ TyKind::CVarArgs(_) => CVarArgs,
TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
TyKind::Rptr(ref l, ref m) => {
let lifetime = if l.is_elided() {
TyKind::Array(ref ty, ref length) => {
let def_id = cx.tcx.hir().local_def_id(length.id);
let param_env = cx.tcx.param_env(def_id);
- let substs = Substs::identity_for_item(cx.tcx, def_id);
+ let substs = InternalSubsts::identity_for_item(cx.tcx, def_id);
let cid = GlobalId {
instance: ty::Instance::new(def_id, substs),
promoted: None
ty::Foreign(did) => {
inline::record_extern_fqn(cx, did, TypeKind::Foreign);
let path = external_path(cx, &cx.tcx.item_name(did).as_str(),
- None, false, vec![], Substs::empty());
+ None, false, vec![], InternalSubsts::empty());
ResolvedPath {
path: path,
typarams: None,
Reference => None,
Fn => None,
Never => None,
+ CVarArgs => tcx.lang_items().va_list(),
};
if let Some(did) = did {
if !did.is_local() {