}
pub fn validate_crate_name(sess: Option<&Session>, s: &str, sp: Option<Span>) {
- let err = |s: &str| {
+ let err = |&: s: &str| {
match (sp, sess) {
(_, None) => panic!("{}", s),
(Some(sp), Some(sess)) => sess.span_err(sp, s),
encode_parent_sort(rbml_w, 't');
let trait_item = &ms[i];
- let encode_trait_item = |rbml_w: &mut Encoder| {
+ let encode_trait_item = |&: rbml_w: &mut Encoder| {
// If this is a static method, we've already
// encoded this.
if is_nonstatic_method {
ast::ExprBlock(ref block) => {
// Check all statements in the block
for stmt in block.stmts.iter() {
- let block_span_err = |span|
+ let block_span_err = |&: span|
span_err!(v.tcx.sess, span, E0016,
"blocks in constants are limited to items and \
tail expressions");
})
}
- let check_move: |&Pat, Option<&Pat>| = |p, sub| {
+ let check_move = |&: p: &Pat, sub: Option<&Pat>| {
// check legality of moving out of the enum
// x @ Foo(..) is legal, but x @ Foo(y) isn't.
let mut i = 0;
let mut node_ids = FnvHashMap::new();
{
- let add_node = |node| {
+ let mut add_node = |&mut : node| {
if let Vacant(e) = node_ids.entry(node) {
e.set(i);
i += 1;
fn check_path(&mut self, span: Span, path_id: ast::NodeId, path: &ast::Path) {
debug!("privacy - path {}", self.nodestr(path_id));
let orig_def = self.tcx.def_map.borrow()[path_id].clone();
- let ck = |tyname: &str| {
+ let ck = |&: tyname: &str| {
let ck_public = |def: ast::DefId| {
let name = token::get_ident(path.segments.last().unwrap().identifier);
let origdid = orig_def.def_id();
}
}
ast::ExprPath(..) => {
- let guard = |did: ast::DefId| {
+ let guard = |&: did: ast::DefId| {
let fields = ty::lookup_struct_fields(self.tcx, did);
let any_priv = fields.iter().any(|f| {
f.vis != ast::Public && (
/// later on down the road...
fn check_sane_privacy(&self, item: &ast::Item) {
let tcx = self.tcx;
- let check_inherited = |sp: Span, vis: ast::Visibility, note: &str| {
+ let check_inherited = |&: sp: Span, vis: ast::Visibility, note: &str| {
if vis != ast::Inherited {
tcx.sess.span_err(sp, "unnecessary visibility qualifier");
if note.len() > 0 {
tcx.sess.span_err(sp, "visibility has no effect inside functions");
}
}
- let check_struct = |def: &ast::StructDef| {
+ let check_struct = |&: def: &ast::StructDef| {
for f in def.fields.iter() {
match f.node.kind {
ast::NamedField(_, p) => check_inherited(tcx, f.span, p),
{
let region_maps = &mut visitor.region_maps;
- let terminating = |id| {
+ let terminating = |&: id| {
let scope = CodeExtent::from_node_id(id);
region_maps.mark_as_terminating_scope(scope)
};
macro_rules! byte( ($b:expr) => { ($b as u8).hash(state) } );
macro_rules! hash( ($e:expr) => { $e.hash(state) } );
- let region = |state: &mut sip::SipState, r: Region| {
+ let region = |&: state: &mut sip::SipState, r: Region| {
match r {
ReStatic => {}
ReLateBound(db, BrAnon(i)) => {
}
}
};
- let did = |state: &mut sip::SipState, did: DefId| {
+ let did = |&: state: &mut sip::SipState, did: DefId| {
let h = if ast_util::is_local(did) {
svh.clone()
} else {
h.as_str().hash(state);
did.node.hash(state);
};
- let mt = |state: &mut sip::SipState, mt: mt| {
+ let mt = |&: state: &mut sip::SipState, mt: mt| {
mt.mutbl.hash(state);
};
- let fn_sig = |state: &mut sip::SipState, sig: &Binder<FnSig<'tcx>>| {
+ let fn_sig = |&: state: &mut sip::SipState, sig: &Binder<FnSig<'tcx>>| {
let sig = anonymize_late_bound_regions(tcx, sig);
for a in sig.inputs.iter() { helper(tcx, *a, svh, state); }
if let ty::FnConverging(output) = sig.output {