/// A path, e.g. `::std::option::Option::<int>` (global). Has support
/// for type parameters and a lifetime.
pub struct Path<'a> {
- path: ~[&'a str],
+ path: Vec<&'a str> ,
lifetime: Option<&'a str>,
- params: ~[~Ty<'a>],
+ params: Vec<~Ty<'a>> ,
global: bool
}
impl<'a> Path<'a> {
- pub fn new<'r>(path: ~[&'r str]) -> Path<'r> {
- Path::new_(path, None, ~[], true)
+ pub fn new<'r>(path: Vec<&'r str> ) -> Path<'r> {
+ Path::new_(path, None, Vec::new(), true)
}
pub fn new_local<'r>(path: &'r str) -> Path<'r> {
- Path::new_(~[ path ], None, ~[], false)
+ Path::new_(vec!( path ), None, Vec::new(), false)
}
- pub fn new_<'r>(path: ~[&'r str],
+ pub fn new_<'r>(path: Vec<&'r str> ,
lifetime: Option<&'r str>,
- params: ~[~Ty<'r>],
+ params: Vec<~Ty<'r>> ,
global: bool)
-> Path<'r> {
Path {
// parameter, and things like `int`
Literal(Path<'a>),
// includes nil
- Tuple(~[Ty<'a>])
+ Tuple(Vec<Ty<'a>> )
}
pub fn borrowed_ptrty<'r>() -> PtrTy<'r> {
}
pub fn nil_ty() -> Ty<'static> {
- Tuple(~[])
+ Tuple(Vec::new())
}
fn mk_lifetime(cx: &ExtCtxt, span: Span, lt: &Option<&str>) -> Option<ast::Lifetime> {
});
let lifetimes = self_generics.lifetimes.clone();
- cx.path_all(span, false, ~[self_ty], lifetimes,
+ cx.path_all(span, false, vec!(self_ty), lifetimes,
opt_vec::take_vec(self_params))
}
Literal(ref p) => {
cx.typaram(cx.ident_of(name), bounds, None)
}
-fn mk_generics(lifetimes: ~[ast::Lifetime], ty_params: ~[ast::TyParam]) -> Generics {
+fn mk_generics(lifetimes: Vec<ast::Lifetime> , ty_params: Vec<ast::TyParam> ) -> Generics {
Generics {
lifetimes: opt_vec::from(lifetimes),
ty_params: opt_vec::from(ty_params)
/// Lifetimes and bounds on type parameters
pub struct LifetimeBounds<'a> {
- lifetimes: ~[&'a str],
- bounds: ~[(&'a str, ~[Path<'a>])]
+ lifetimes: Vec<&'a str> ,
+ bounds: vec!((&'a str, Vec<Path<'a>> ))
}
impl<'a> LifetimeBounds<'a> {
pub fn empty() -> LifetimeBounds<'static> {
LifetimeBounds {
- lifetimes: ~[], bounds: ~[]
+ lifetimes: Vec::new(), bounds: Vec::new()
}
}
pub fn to_generics(&self,