Skip to content

Commit de9e665

Browse files
committed
Improve comments for Rule Implemented-From-Impl
1 parent 75af15e commit de9e665

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/librustc_traits/lowering.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,24 @@ fn program_clauses_for_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId
118118
return Lrc::new(vec![]);
119119
}
120120

121-
// Rule Implemented-From-Impl
121+
// Rule Implemented-From-Impl (see rustc guide)
122122
//
123-
// (see rustc guide)
123+
// `impl<P0..Pn> Trait<A1..An> for A0 where WC { .. }`
124+
//
125+
// ```
126+
// forall<P0..Pn> {
127+
// Implemented(A0: Trait<A1..An>) :- WC
128+
// }
129+
// ```
124130

125131
let trait_ref = tcx.impl_trait_ref(def_id).unwrap();
126-
let trait_ref = ty::TraitPredicate { trait_ref }.lower();
132+
// `Implemented(A0: Trait<A1..An>)`
133+
let trait_pred = ty::TraitPredicate { trait_ref }.lower();
134+
// `WC`
127135
let where_clauses = tcx.predicates_of(def_id).predicates.lower();
128136

129-
let clause = Clause::Implies(where_clauses, trait_ref);
137+
// `Implemented(A0: Trait<A1..An>) :- WC`
138+
let clause = Clause::Implies(where_clauses, trait_pred);
130139
Lrc::new(vec![clause])
131140
}
132141

0 commit comments

Comments
 (0)