@@ -117,15 +117,10 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
117
117
118
118
self . check_variances_for_type_defn ( item, ast_generics) ;
119
119
}
120
- ast:: ItemTrait ( _, ref ast_generics , _, ref items) => {
120
+ ast:: ItemTrait ( _, _ , _, ref items) => {
121
121
let trait_predicates =
122
122
ty:: lookup_predicates ( ccx. tcx , local_def ( item. id ) ) ;
123
- reject_non_type_param_bounds (
124
- ccx. tcx ,
125
- item. span ,
126
- & trait_predicates) ;
127
- self . check_variances ( item, ast_generics, & trait_predicates,
128
- self . tcx ( ) . lang_items . phantom_fn ( ) ) ;
123
+ reject_non_type_param_bounds ( ccx. tcx , item. span , & trait_predicates) ;
129
124
if ty:: trait_has_default_impl ( ccx. tcx , local_def ( item. id ) ) {
130
125
if !items. is_empty ( ) {
131
126
ccx. tcx . sess . span_err (
@@ -287,30 +282,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
287
282
ast_generics : & ast:: Generics )
288
283
{
289
284
let item_def_id = local_def ( item. id ) ;
290
- let predicates = ty:: lookup_predicates ( self . tcx ( ) , item_def_id) ;
291
- self . check_variances ( item,
292
- ast_generics,
293
- & predicates,
294
- self . tcx ( ) . lang_items . phantom_data ( ) ) ;
295
- }
296
-
297
- fn check_variances ( & self ,
298
- item : & ast:: Item ,
299
- ast_generics : & ast:: Generics ,
300
- ty_predicates : & ty:: GenericPredicates < ' tcx > ,
301
- suggested_marker_id : Option < ast:: DefId > )
302
- {
303
- let variance_lang_items = & [
304
- self . tcx ( ) . lang_items . phantom_fn ( ) ,
305
- self . tcx ( ) . lang_items . phantom_data ( ) ,
306
- ] ;
307
-
308
- let item_def_id = local_def ( item. id ) ;
309
- let is_lang_item = variance_lang_items. iter ( ) . any ( |n| * n == Some ( item_def_id) ) ;
310
- if is_lang_item {
311
- return ;
312
- }
313
-
285
+ let ty_predicates = ty:: lookup_predicates ( self . tcx ( ) , item_def_id) ;
314
286
let variances = ty:: item_variances ( self . tcx ( ) , item_def_id) ;
315
287
316
288
let mut constrained_parameters: HashSet < _ > =
@@ -331,7 +303,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
331
303
continue ;
332
304
}
333
305
let span = self . ty_param_span ( ast_generics, item, space, index) ;
334
- self . report_bivariance ( span, param_ty. name , suggested_marker_id ) ;
306
+ self . report_bivariance ( span, param_ty. name ) ;
335
307
}
336
308
337
309
for ( space, index, & variance) in variances. regions . iter_enumerated ( ) {
@@ -342,7 +314,7 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
342
314
assert_eq ! ( space, TypeSpace ) ;
343
315
let span = ast_generics. lifetimes [ index] . lifetime . span ;
344
316
let name = ast_generics. lifetimes [ index] . lifetime . name ;
345
- self . report_bivariance ( span, name, suggested_marker_id ) ;
317
+ self . report_bivariance ( span, name) ;
346
318
}
347
319
}
348
320
@@ -377,14 +349,14 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
377
349
378
350
fn report_bivariance ( & self ,
379
351
span : Span ,
380
- param_name : ast:: Name ,
381
- suggested_marker_id : Option < ast:: DefId > )
352
+ param_name : ast:: Name )
382
353
{
383
354
self . tcx ( ) . sess . span_err (
384
355
span,
385
356
& format ! ( "parameter `{}` is never used" ,
386
357
param_name. user_string( self . tcx( ) ) ) ) ;
387
358
359
+ let suggested_marker_id = self . tcx ( ) . lang_items . phantom_data ( ) ;
388
360
match suggested_marker_id {
389
361
Some ( def_id) => {
390
362
self . tcx ( ) . sess . fileline_help (
0 commit comments