@@ -26,7 +26,7 @@ use syntax::codemap::{DUMMY_SP, Span};
26
26
use util:: ppaux:: Repr ;
27
27
28
28
#[ derive( Copy , Clone ) ]
29
- struct ParamIsLocal ( bool ) ;
29
+ struct InferIsLocal ( bool ) ;
30
30
31
31
/// True if there exist types that satisfy both of the two given impls.
32
32
pub fn overlapping_impls ( infcx : & InferCtxt ,
@@ -60,7 +60,7 @@ fn overlap(selcx: &mut SelectionContext,
60
60
61
61
let ( a_trait_ref, a_obligations) = impl_trait_ref_and_oblig ( selcx,
62
62
a_def_id,
63
- util:: free_substs_for_impl ) ;
63
+ util:: fresh_type_vars_for_impl ) ;
64
64
65
65
let ( b_trait_ref, b_obligations) = impl_trait_ref_and_oblig ( selcx,
66
66
b_def_id,
@@ -104,7 +104,7 @@ pub fn trait_ref_is_knowable<'tcx>(tcx: &ty::ctxt<'tcx>, trait_ref: &ty::TraitRe
104
104
105
105
// if the orphan rules pass, that means that no ancestor crate can
106
106
// impl this, so it's up to us.
107
- if orphan_check_trait_ref ( tcx, trait_ref, ParamIsLocal ( false ) ) . is_ok ( ) {
107
+ if orphan_check_trait_ref ( tcx, trait_ref, InferIsLocal ( false ) ) . is_ok ( ) {
108
108
debug ! ( "trait_ref_is_knowable: orphan check passed" ) ;
109
109
return true ;
110
110
}
@@ -126,7 +126,7 @@ pub fn trait_ref_is_knowable<'tcx>(tcx: &ty::ctxt<'tcx>, trait_ref: &ty::TraitRe
126
126
// implemented by an upstream crate, which means that the impl
127
127
// must be visible to us, and -- since the trait is fundamental
128
128
// -- we can test.
129
- orphan_check_trait_ref ( tcx, trait_ref, ParamIsLocal ( true ) ) . is_err ( )
129
+ orphan_check_trait_ref ( tcx, trait_ref, InferIsLocal ( true ) ) . is_err ( )
130
130
}
131
131
132
132
type SubstsFn = for <' a , ' tcx > fn ( infcx : & InferCtxt < ' a , ' tcx > ,
@@ -196,16 +196,16 @@ pub fn orphan_check<'tcx>(tcx: &ty::ctxt<'tcx>,
196
196
return Ok ( ( ) ) ;
197
197
}
198
198
199
- orphan_check_trait_ref ( tcx, & trait_ref, ParamIsLocal ( false ) )
199
+ orphan_check_trait_ref ( tcx, & trait_ref, InferIsLocal ( false ) )
200
200
}
201
201
202
202
fn orphan_check_trait_ref < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ,
203
203
trait_ref : & ty:: TraitRef < ' tcx > ,
204
- param_is_local : ParamIsLocal )
204
+ infer_is_local : InferIsLocal )
205
205
-> Result < ( ) , OrphanCheckErr < ' tcx > >
206
206
{
207
- debug ! ( "orphan_check_trait_ref(trait_ref={}, param_is_local ={})" ,
208
- trait_ref. repr( tcx) , param_is_local . 0 ) ;
207
+ debug ! ( "orphan_check_trait_ref(trait_ref={}, infer_is_local ={})" ,
208
+ trait_ref. repr( tcx) , infer_is_local . 0 ) ;
209
209
210
210
// First, create an ordered iterator over all the type parameters to the trait, with the self
211
211
// type appearing first.
@@ -215,12 +215,12 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
215
215
// Find the first input type that either references a type parameter OR
216
216
// some local type.
217
217
for input_ty in input_tys {
218
- if ty_is_local ( tcx, input_ty, param_is_local ) {
218
+ if ty_is_local ( tcx, input_ty, infer_is_local ) {
219
219
debug ! ( "orphan_check_trait_ref: ty_is_local `{}`" , input_ty. repr( tcx) ) ;
220
220
221
221
// First local input type. Check that there are no
222
222
// uncovered type parameters.
223
- let uncovered_tys = uncovered_tys ( tcx, input_ty, param_is_local ) ;
223
+ let uncovered_tys = uncovered_tys ( tcx, input_ty, infer_is_local ) ;
224
224
for uncovered_ty in uncovered_tys {
225
225
if let Some ( param) = uncovered_ty. walk ( ) . find ( |t| is_type_parameter ( t) ) {
226
226
debug ! ( "orphan_check_trait_ref: uncovered type `{}`" , param. repr( tcx) ) ;
@@ -234,7 +234,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
234
234
235
235
// Otherwise, enforce invariant that there are no type
236
236
// parameters reachable.
237
- if !param_is_local . 0 {
237
+ if !infer_is_local . 0 {
238
238
if let Some ( param) = input_ty. walk ( ) . find ( |t| is_type_parameter ( t) ) {
239
239
debug ! ( "orphan_check_trait_ref: uncovered type `{}`" , param. repr( tcx) ) ;
240
240
return Err ( OrphanCheckErr :: UncoveredTy ( param) ) ;
@@ -249,14 +249,14 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
249
249
250
250
fn uncovered_tys < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ,
251
251
ty : Ty < ' tcx > ,
252
- param_is_local : ParamIsLocal )
252
+ infer_is_local : InferIsLocal )
253
253
-> Vec < Ty < ' tcx > >
254
254
{
255
- if ty_is_local_constructor ( tcx, ty, param_is_local ) {
255
+ if ty_is_local_constructor ( tcx, ty, infer_is_local ) {
256
256
vec ! [ ]
257
257
} else if fundamental_ty ( tcx, ty) {
258
258
ty. walk_shallow ( )
259
- . flat_map ( |t| uncovered_tys ( tcx, t, param_is_local ) . into_iter ( ) )
259
+ . flat_map ( |t| uncovered_tys ( tcx, t, infer_is_local ) . into_iter ( ) )
260
260
. collect ( )
261
261
} else {
262
262
vec ! [ ty]
@@ -271,10 +271,10 @@ fn is_type_parameter<'tcx>(ty: Ty<'tcx>) -> bool {
271
271
}
272
272
}
273
273
274
- fn ty_is_local < ' tcx > ( tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > , param_is_local : ParamIsLocal ) -> bool
274
+ fn ty_is_local < ' tcx > ( tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > , infer_is_local : InferIsLocal ) -> bool
275
275
{
276
- ty_is_local_constructor ( tcx, ty, param_is_local ) ||
277
- fundamental_ty ( tcx, ty) && ty. walk_shallow ( ) . any ( |t| ty_is_local ( tcx, t, param_is_local ) )
276
+ ty_is_local_constructor ( tcx, ty, infer_is_local ) ||
277
+ fundamental_ty ( tcx, ty) && ty. walk_shallow ( ) . any ( |t| ty_is_local ( tcx, t, infer_is_local ) )
278
278
}
279
279
280
280
fn fundamental_ty < ' tcx > ( tcx : & ty:: ctxt < ' tcx > , ty : Ty < ' tcx > ) -> bool
@@ -293,7 +293,7 @@ fn fundamental_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool
293
293
294
294
fn ty_is_local_constructor < ' tcx > ( tcx : & ty:: ctxt < ' tcx > ,
295
295
ty : Ty < ' tcx > ,
296
- param_is_local : ParamIsLocal )
296
+ infer_is_local : InferIsLocal )
297
297
-> bool
298
298
{
299
299
debug ! ( "ty_is_local_constructor({})" , ty. repr( tcx) ) ;
@@ -310,13 +310,13 @@ fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
310
310
ty:: ty_ptr( ..) |
311
311
ty:: ty_rptr( ..) |
312
312
ty:: ty_tup( ..) |
313
- ty:: ty_infer ( ..) |
313
+ ty:: ty_param ( ..) |
314
314
ty:: ty_projection( ..) => {
315
315
false
316
316
}
317
317
318
- ty:: ty_param ( ..) => {
319
- param_is_local . 0
318
+ ty:: ty_infer ( ..) => {
319
+ infer_is_local . 0
320
320
}
321
321
322
322
ty:: ty_enum( def_id, _) |
0 commit comments