@@ -125,7 +125,8 @@ impl<'tcx> TraitDef<'tcx> {
125
125
fn record_impl ( & self ,
126
126
tcx : & TyCtxt < ' tcx > ,
127
127
impl_def_id : DefId ,
128
- impl_trait_ref : TraitRef < ' tcx > ) -> bool {
128
+ impl_trait_ref : TraitRef < ' tcx > )
129
+ -> bool {
129
130
debug ! ( "TraitDef::record_impl for {:?}, from {:?}" ,
130
131
self , impl_trait_ref) ;
131
132
@@ -161,7 +162,9 @@ impl<'tcx> TraitDef<'tcx> {
161
162
tcx : & TyCtxt < ' tcx > ,
162
163
impl_def_id : DefId ,
163
164
impl_trait_ref : TraitRef < ' tcx > ) {
164
- self . record_impl ( tcx, impl_def_id, impl_trait_ref) ;
165
+ assert ! ( impl_def_id. is_local( ) ) ;
166
+ let was_new = self . record_impl ( tcx, impl_def_id, impl_trait_ref) ;
167
+ assert ! ( was_new) ;
165
168
}
166
169
167
170
/// Records a trait-to-implementation mapping for a non-local impl.
@@ -174,6 +177,8 @@ impl<'tcx> TraitDef<'tcx> {
174
177
impl_def_id : DefId ,
175
178
impl_trait_ref : TraitRef < ' tcx > ,
176
179
parent_impl : DefId ) {
180
+ assert ! ( !impl_def_id. is_local( ) ) ;
181
+
177
182
// if the impl has not previously been recorded
178
183
if self . record_impl ( tcx, impl_def_id, impl_trait_ref) {
179
184
// if the impl is non-local, it's placed directly into the
@@ -186,15 +191,14 @@ impl<'tcx> TraitDef<'tcx> {
186
191
/// Adds a local impl into the specialization graph, returning an error with
187
192
/// overlap information if the impl overlaps but does not specialize an
188
193
/// existing impl.
189
- pub fn add_impl_for_specialization ( & self ,
190
- tcx : & ctxt < ' tcx > ,
191
- impl_def_id : DefId ,
192
- impl_trait_ref : TraitRef < ' tcx > )
193
- -> Result < ( ) , traits:: Overlap < ' tcx > > {
194
+ pub fn add_impl_for_specialization < ' a > ( & self ,
195
+ tcx : & ' a ctxt < ' tcx > ,
196
+ impl_def_id : DefId )
197
+ -> Result < ( ) , traits:: Overlap < ' a , ' tcx > > {
194
198
assert ! ( impl_def_id. is_local( ) ) ;
195
199
196
200
self . specialization_graph . borrow_mut ( )
197
- . insert ( tcx, impl_def_id, impl_trait_ref )
201
+ . insert ( tcx, impl_def_id)
198
202
}
199
203
200
204
/// Returns the immediately less specialized impl, if any.
0 commit comments