let name = if self.name.is_some() {
self.name.unwrap().clean()
} else {
- ~""
+ "".to_owned()
};
let mut foreigns = Vec::new();
for subforeigns in self.foreigns.clean().move_iter() {
#[deriving(Clone, Encodable, Decodable)]
pub struct ClosureDecl {
- pub sigil: ast::Sigil,
- pub region: Option<Lifetime>,
pub lifetimes: Vec<Lifetime>,
pub decl: FnDecl,
pub onceness: ast::Onceness,
impl Clean<ClosureDecl> for ast::ClosureTy {
fn clean(&self) -> ClosureDecl {
ClosureDecl {
- sigil: self.sigil,
- region: self.region.clean(),
lifetimes: self.lifetimes.clean().move_iter().collect(),
decl: self.decl.clean(),
onceness: self.onceness,
Self(ast::NodeId),
/// Primitives are just the fixed-size numeric types (plus int/uint/float), and char.
Primitive(ast::PrimTy),
- Closure(~ClosureDecl),
+ Closure(~ClosureDecl, Option<Lifetime>),
+ Proc(~ClosureDecl),
/// extern "ABI" fn
BareFunction(~BareFunctionDecl),
Tuple(Vec<Type> ),
tpbs.clean().map(|x| x.move_iter().collect()),
id)
}
- TyClosure(ref c) => Closure(~c.clean()),
+ TyClosure(ref c, region) => Closure(~c.clean(), region.clean()),
+ TyProc(ref c) => Proc(~c.clean()),
TyBareFn(ref barefn) => BareFunction(~barefn.clean()),
TyBot => Bottom,
ref x => fail!("Unimplemented type {:?}", x),
ForeignStaticItem(Static {
type_: ty.clean(),
mutability: if mutbl {Mutable} else {Immutable},
- expr: ~"",
+ expr: "".to_owned(),
})
}
};
let cm = local_data::get(super::ctxtkey, |x| x.unwrap().clone()).sess().codemap().clone();
let sn = match cm.span_to_snippet(*self) {
Some(x) => x,
- None => ~""
+ None => "".to_owned()
};
debug!("got snippet {}", sn);
sn
match lit.node {
ast::LitStr(ref st, _) => st.get().to_owned(),
ast::LitBinary(ref data) => format!("{:?}", data.as_slice()),
- ast::LitChar(c) => ~"'" + std::char::from_u32(c).unwrap().to_str() + "'",
+ ast::LitChar(c) => "'".to_owned() + std::char::from_u32(c).unwrap().to_str() + "'",
ast::LitInt(i, _t) => i.to_str(),
ast::LitUint(u, _t) => u.to_str(),
ast::LitIntUnsuffixed(i) => i.to_str(),
ast::LitFloat(ref f, _t) => f.get().to_str(),
ast::LitFloatUnsuffixed(ref f) => f.get().to_str(),
ast::LitBool(b) => b.to_str(),
- ast::LitNil => ~"",
+ ast::LitNil => "".to_owned(),
}
}
debug!("Trying to get a name from pattern: {:?}", p);
match p.node {
- PatWild => ~"_",
- PatWildMulti => ~"..",
+ PatWild => "_".to_owned(),
+ PatWildMulti => "..".to_owned(),
PatIdent(_, ref p, _) => path_to_str(p),
PatEnum(ref p, _) => path_to_str(p),
PatStruct(..) => fail!("tried to get argument name from pat_struct, \
which is not allowed in function arguments"),
- PatTup(..) => ~"(tuple arg NYI)",
+ PatTup(..) => "(tuple arg NYI)".to_owned(),
PatUniq(p) => name_from_pat(p),
PatRegion(p) => name_from_pat(p),
PatLit(..) => {
warn!("tried to get argument name from PatLit, \
which is silly in function arguments");
- ~"()"
+ "()".to_owned()
},
PatRange(..) => fail!("tried to get argument name from PatRange, \
which is not allowed in function arguments"),