]> git.lizzy.rs Git - rust.git/commitdiff
remove the "don't add `_ WF` obligation" hack
authorAriel Ben-Yehuda <arielb1@mail.tau.ac.il>
Fri, 2 Oct 2015 20:36:07 +0000 (23:36 +0300)
committerAriel Ben-Yehuda <arielb1@mail.tau.ac.il>
Fri, 2 Oct 2015 20:36:07 +0000 (23:36 +0300)
it doesn't seem to be necessary and is potentially harmful.

src/librustc_typeck/check/mod.rs

index 08a0f1c7e871d032551de4d4718c5eda6a5fd525..278aa9450eeeb82290bf1aa72283319ec7691707 100644 (file)
@@ -1557,21 +1557,7 @@ pub fn register_predicate(&self,
 
     pub fn to_ty(&self, ast_t: &hir::Ty) -> Ty<'tcx> {
         let t = ast_ty_to_ty(self, self, ast_t);
-
-        // Generally speaking, we must check that types entered by the
-        // user are well-formed. This is not true for `_`, since those
-        // types are generated by inference. Now, you might think that
-        // we could as well generate a WF obligation -- but
-        // unfortunately that breaks code like `foo as *const _`,
-        // because those type variables wind up being unconstrained
-        // until very late. Nasty. Probably it'd be best to refactor
-        // that code path, but that's tricky because of
-        // defaults. Argh!
-        match ast_t.node {
-            hir::TyInfer => { }
-            _ => { self.register_wf_obligation(t, ast_t.span, traits::MiscObligation); }
-        }
-
+        self.register_wf_obligation(t, ast_t.span, traits::MiscObligation);
         t
     }