]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/wfcheck.rs
Merge branch 'refactor-select' of https://github.com/aravind-pg/rust into update...
[rust.git] / src / librustc_typeck / check / wfcheck.rs
index 4eb3e29ec6946de2b7cc51099c309e29ab133c91..d10ee358e072846e77be1591c47c141b1f55d4b1 100644 (file)
@@ -370,6 +370,9 @@ fn check_where_clauses<'fcx, 'tcx>(&mut self,
         // Here the default `Vec<[u32]>` is not WF because `[u32]: Sized` does not hold.
         for d in generics.types.iter().cloned().filter(is_our_default).map(|p| p.def_id) {
             let ty = fcx.tcx.type_of(d);
+            // ignore dependent defaults -- that is, where the default of one type
+            // parameter includes another (e.g., <T, U = T>). In those cases, we can't
+            // be sure if it will error or not as user might always specify the other.
             if !ty.needs_subst() {
                 fcx.register_wf_obligation(ty, fcx.tcx.def_span(d), self.code.clone());
             }
@@ -533,7 +536,7 @@ fn check_method_receiver<'fcx, 'tcx>(&mut self,
         let is_self_ty = |ty| fcx.infcx.can_eq(fcx.param_env, self_ty, ty).is_ok();
         let self_kind = ExplicitSelf::determine(self_arg_ty, is_self_ty);
 
-        if !fcx.tcx.sess.features.borrow().arbitrary_self_types {
+        if !fcx.tcx.features().arbitrary_self_types {
             match self_kind {
                 ExplicitSelf::ByValue |
                 ExplicitSelf::ByReference(_, _) |