use middle::infer;
use middle::check_const;
use middle::def;
+use middle::ty::adjustment;
use middle::ty::{self, Ty};
use rustc_front::hir::{MutImmutable, MutMutable};
// a bind-by-ref means that the base_ty will be the type of the ident itself,
// but what we want here is the type of the underlying value being borrowed.
// So peel off one-level, turning the &T into T.
- match base_ty.builtin_deref(false) {
+ match base_ty.builtin_deref(false, ty::NoPreference) {
Some(t) => t.ty,
None => { return Err(()); }
}
Some(adjustment) => {
match *adjustment {
- ty::AdjustDerefRef(
- ty::AutoDerefRef {
+ adjustment::AdjustDerefRef(
+ adjustment::AutoDerefRef {
autoref: None, unsize: None, autoderefs, ..}) => {
// Equivalent to *expr or something similar.
self.cat_expr_autoderefd(expr, autoderefs)
}
- ty::AdjustReifyFnPointer |
- ty::AdjustUnsafeFnPointer |
- ty::AdjustDerefRef(_) => {
+ adjustment::AdjustReifyFnPointer |
+ adjustment::AdjustUnsafeFnPointer |
+ adjustment::AdjustDerefRef(_) => {
debug!("cat_expr({:?}): {:?}",
adjustment,
expr);
}))
}
- def::DefUpvar(var_id, fn_node_id) => {
+ def::DefUpvar(var_id, _, fn_node_id) => {
let ty = try!(self.node_ty(fn_node_id));
match ty.sty {
ty::TyClosure(closure_id, _) => {
None => base_cmt
};
let base_cmt_ty = base_cmt.ty;
- match base_cmt_ty.builtin_deref(true) {
+ match base_cmt_ty.builtin_deref(true, ty::NoPreference) {
Some(mt) => {
let ret = self.cat_deref_common(node, base_cmt, deref_cnt,
mt.ty,
span:elt.span(),
cat:cat_deref(base_cmt.clone(), 0, ptr),
mutbl:m,
- ty: match base_cmt.ty.builtin_deref(false) {
+ ty: match base_cmt.ty.builtin_deref(false, ty::NoPreference) {
Some(mt) => mt.ty,
None => self.tcx().sess.bug("Found non-derefable type")
},