about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFabian Zaiser <fabian.zaiser@gmail.com>2018-04-15 23:49:41 +0200
committerFabian Zaiser <fabian.zaiser@gmail.com>2018-04-15 23:49:41 +0200
commitb7c4a57465b8d5599c7e799e1aafe12a458156f8 (patch)
tree3a36e8856bbb24d0720dfbdd7c140ac30d76edb3
parentde475582c4dc1c8f532eed578d574979283f1c42 (diff)
downloadrust-b7c4a57465b8d5599c7e799e1aafe12a458156f8.tar.gz
rust-b7c4a57465b8d5599c7e799e1aafe12a458156f8.zip
Rebase and fix conflicts.
-rw-r--r--src/librustc_traits/lowering.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc_traits/lowering.rs b/src/librustc_traits/lowering.rs
index 9da2c49ee5d..36e60cee788 100644
--- a/src/librustc_traits/lowering.rs
+++ b/src/librustc_traits/lowering.rs
@@ -124,13 +124,13 @@ crate fn program_clauses_for<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefI
         hir::map::Node::NodeItem(item) => match item.node {
             hir::ItemTrait(..) => program_clauses_for_trait(tcx, def_id),
             hir::ItemImpl(..) => program_clauses_for_impl(tcx, def_id),
-            _ => Lrc::new(vec![]),
+            _ => Lrc::new(tcx.mk_clauses(iter::empty::<Clause>())),
         }
         hir::map::Node::NodeImplItem(item) => {
             if let hir::ImplItemKind::Type(..) = item.node {
                 program_clauses_for_associated_type_value(tcx, def_id)
             } else {
-                Lrc::new(vec![])
+                Lrc::new(tcx.mk_clauses(iter::empty::<Clause>()))
             }
         },
 
@@ -247,7 +247,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
 pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
     item_id: DefId,
-) -> Lrc<Vec<Clause<'tcx>>> {
+) -> Lrc<&'tcx Slice<Clause<'tcx>>> {
     // Rule Normalize-From-Impl (see rustc guide)
     //
     // ```impl<P0..Pn> Trait<A1..An> for A0
@@ -289,9 +289,11 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
     // `Normalize(... -> T) :- ...`
     let clause = ProgramClause {
         goal: normalize_goal,
-        hypotheses: where_clauses.into_iter().map(|wc| wc.into()).collect(),
+        hypotheses: tcx.mk_goals(
+            where_clauses.into_iter().map(|wc| Goal::from_poly_domain_goal(wc, tcx))
+        ),
     };
-    Lrc::new(vec![Clause::ForAll(ty::Binder::dummy(clause))])
+    Lrc::new(tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::dummy(clause)))))
 }
 
 pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {