Skip to content

Commit b7c4a57

Browse files
committed
Rebase and fix conflicts.
1 parent de47558 commit b7c4a57

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc_traits/lowering.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ crate fn program_clauses_for<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefI
124124
hir::map::Node::NodeItem(item) => match item.node {
125125
hir::ItemTrait(..) => program_clauses_for_trait(tcx, def_id),
126126
hir::ItemImpl(..) => program_clauses_for_impl(tcx, def_id),
127-
_ => Lrc::new(vec![]),
127+
_ => Lrc::new(tcx.mk_clauses(iter::empty::<Clause>())),
128128
}
129129
hir::map::Node::NodeImplItem(item) => {
130130
if let hir::ImplItemKind::Type(..) = item.node {
131131
program_clauses_for_associated_type_value(tcx, def_id)
132132
} else {
133-
Lrc::new(vec![])
133+
Lrc::new(tcx.mk_clauses(iter::empty::<Clause>()))
134134
}
135135
},
136136

@@ -247,7 +247,7 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
247247
pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
248248
tcx: TyCtxt<'a, 'tcx, 'tcx>,
249249
item_id: DefId,
250-
) -> Lrc<Vec<Clause<'tcx>>> {
250+
) -> Lrc<&'tcx Slice<Clause<'tcx>>> {
251251
// Rule Normalize-From-Impl (see rustc guide)
252252
//
253253
// ```impl<P0..Pn> Trait<A1..An> for A0
@@ -289,9 +289,11 @@ pub fn program_clauses_for_associated_type_value<'a, 'tcx>(
289289
// `Normalize(... -> T) :- ...`
290290
let clause = ProgramClause {
291291
goal: normalize_goal,
292-
hypotheses: where_clauses.into_iter().map(|wc| wc.into()).collect(),
292+
hypotheses: tcx.mk_goals(
293+
where_clauses.into_iter().map(|wc| Goal::from_poly_domain_goal(wc, tcx))
294+
),
293295
};
294-
Lrc::new(vec![Clause::ForAll(ty::Binder::dummy(clause))])
296+
Lrc::new(tcx.mk_clauses(iter::once(Clause::ForAll(ty::Binder::dummy(clause)))))
295297
}
296298

297299
pub fn dump_program_clauses<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {

0 commit comments

Comments
 (0)