ExprLit(lit) if ast_util::lit_is_str(lit) => {}
ExprBinary(..) | ExprUnary(..) => {
let method_call = typeck::MethodCall::expr(e.id);
- if v.method_map.borrow().get().contains_key(&method_call) {
+ if v.method_map.borrow().contains_key(&method_call) {
v.tcx.sess.span_err(e.span, "user-defined operators are not \
allowed in constant expressions");
}
ExprCast(_, _) => {
let ety = ty::expr_ty(v.tcx, e);
if !ty::type_is_numeric(ety) && !ty::type_is_unsafe_ptr(ety) {
- v.tcx.sess.span_err(e.span, ~"can not cast to `" +
+ v.tcx.sess.span_err(e.span, "can not cast to `".to_owned() +
ppaux::ty_to_str(v.tcx, ety) +
"` in a constant expression");
}
"paths in constants may only refer to \
items without type parameters");
}
- match v.def_map.borrow().get().find(&e.id) {
+ match v.def_map.borrow().find(&e.id) {
Some(&DefStatic(..)) |
Some(&DefFn(_, _)) |
Some(&DefVariant(_, _, _)) |
}
}
ExprCall(callee, _) => {
- match v.def_map.borrow().get().find(&callee.id) {
+ match v.def_map.borrow().find(&callee.id) {
Some(&DefStruct(..)) => {} // OK.
Some(&DefVariant(..)) => {} // OK.
_ => {
}
ExprVstore(_, ExprVstoreMutSlice) |
ExprVstore(_, ExprVstoreSlice) |
- ExprVec(_, MutImmutable) |
+ ExprVec(_) |
ExprAddrOf(MutImmutable, _) |
ExprParen(..) |
ExprField(..) |
fn visit_expr(&mut self, e: &Expr, _: ()) {
match e.node {
ExprPath(..) => {
- let def_map = self.def_map.borrow();
- match def_map.get().find(&e.id) {
+ match self.def_map.borrow().find(&e.id) {
Some(&DefStatic(def_id, _)) if
ast_util::is_local(def_id) => {
self.visit_item(self.ast_map.expect_item(def_id.node), ());