use middle::expr_use_visitor as euv;
use middle::infer;
use middle::mem_categorization as mc;
+use middle::mem_categorization::Categorization;
use middle::traits;
use middle::ty::{self, Ty};
use util::nodemap::NodeMap;
if mode == Mode::ConstFn {
for arg in &fd.inputs {
match arg.pat.node {
- hir::PatWild(_) => {}
+ hir::PatWild => {}
hir::PatIdent(hir::BindByValue(hir::MutImmutable), _, None) => {}
_ => {
span_err!(self.tcx.sess, arg.pat.span, E0022,
ty::TyUint(_) | ty::TyInt(_) if div_or_rem => {
if !self.qualif.intersects(ConstQualif::NOT_CONST) {
match const_eval::eval_const_expr_partial(
- self.tcx, ex, ExprTypeChecked) {
+ self.tcx, ex, ExprTypeChecked, None) {
Ok(_) => {}
Err(msg) => {
self.tcx.sess.add_lint(::lint::builtin::CONST_ERR, ex.id,
let mut cur = &cmt;
loop {
match cur.cat {
- mc::cat_static_item => {
+ Categorization::StaticItem => {
if self.mode != Mode::Var {
// statics cannot be consumed by value at any time, that would imply
// that they're an initializer (what a const is for) or kept in sync
}
break;
}
- mc::cat_deref(ref cmt, _, _) |
- mc::cat_downcast(ref cmt, _) |
- mc::cat_interior(ref cmt, _) => cur = cmt,
+ Categorization::Deref(ref cmt, _, _) |
+ Categorization::Downcast(ref cmt, _) |
+ Categorization::Interior(ref cmt, _) => cur = cmt,
- mc::cat_rvalue(..) |
- mc::cat_upvar(..) |
- mc::cat_local(..) => break
+ Categorization::Rvalue(..) |
+ Categorization::Upvar(..) |
+ Categorization::Local(..) => break
}
}
}
let mut is_interior = false;
loop {
match cur.cat {
- mc::cat_rvalue(..) => {
+ Categorization::Rvalue(..) => {
if loan_cause == euv::MatchDiscriminant {
// Ignore the dummy immutable borrow created by EUV.
break;
self.record_borrow(borrow_id, mutbl);
break;
}
- mc::cat_static_item => {
+ Categorization::StaticItem => {
if is_interior && self.mode != Mode::Var {
// Borrowed statics can specifically *only* have their address taken,
// not any number of other borrows such as borrowing fields, reading
}
break;
}
- mc::cat_deref(ref cmt, _, _) |
- mc::cat_downcast(ref cmt, _) |
- mc::cat_interior(ref cmt, _) => {
+ Categorization::Deref(ref cmt, _, _) |
+ Categorization::Downcast(ref cmt, _) |
+ Categorization::Interior(ref cmt, _) => {
is_interior = true;
cur = cmt;
}
- mc::cat_upvar(..) |
- mc::cat_local(..) => break
+ Categorization::Upvar(..) |
+ Categorization::Local(..) => break
}
}
}