@@ -360,8 +360,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
360
360
self . convert_angle_bracketed_parameters ( rscope, span, decl_generics, data)
361
361
}
362
362
hir:: ParenthesizedParameters ( ..) => {
363
- span_err ! ( tcx. sess, span, E0214 ,
364
- "parenthesized parameters may only be used with a trait" ) ;
363
+ struct_span_err ! ( tcx. sess, span, E0214 ,
364
+ "parenthesized parameters may only be used with a trait" )
365
+ . span_label ( span, & format ! ( "only traits may use parentheses" ) )
366
+ . emit ( ) ;
367
+
365
368
let ty_param_defs = decl_generics. types . get_slice ( TypeSpace ) ;
366
369
( Substs :: empty ( ) ,
367
370
ty_param_defs. iter ( ) . map ( |_| tcx. types . err ) . collect ( ) ,
@@ -1201,10 +1204,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
1201
1204
}
1202
1205
1203
1206
for ( trait_def_id, name) in associated_types {
1204
- span_err ! ( tcx. sess, span, E0191 ,
1207
+ struct_span_err ! ( tcx. sess, span, E0191 ,
1205
1208
"the value of the associated type `{}` (from the trait `{}`) must be specified" ,
1206
1209
name,
1207
- tcx. item_path_str( trait_def_id) ) ;
1210
+ tcx. item_path_str( trait_def_id) )
1211
+ . span_label ( span, & format ! (
1212
+ "missing associated type `{}` value" , name) )
1213
+ . emit ( ) ;
1208
1214
}
1209
1215
1210
1216
tcx. mk_trait ( object. principal , object. bounds )
@@ -1281,10 +1287,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
1281
1287
}
1282
1288
1283
1289
if bounds. len ( ) > 1 {
1284
- let mut err = struct_span_err ! ( self . tcx( ) . sess, span, E0221 ,
1285
- "ambiguous associated type `{}` in bounds of `{}`" ,
1286
- assoc_name,
1287
- ty_param_name) ;
1290
+ let mut err = struct_span_err ! (
1291
+ self . tcx( ) . sess, span, E0221 ,
1292
+ "ambiguous associated type `{}` in bounds of `{}`" ,
1293
+ assoc_name,
1294
+ ty_param_name) ;
1295
+ err. span_label ( span, & format ! ( "ambiguous associated type `{}`" , assoc_name) ) ;
1288
1296
1289
1297
for bound in & bounds {
1290
1298
span_note ! ( & mut err, span,
@@ -1584,9 +1592,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
1584
1592
return self . tcx ( ) . types . err ;
1585
1593
}
1586
1594
_ => {
1587
- span_err ! ( tcx. sess, span, E0248 ,
1588
- "found value `{}` used as a type" ,
1589
- tcx. item_path_str( def. def_id( ) ) ) ;
1595
+ struct_span_err ! ( tcx. sess, span, E0248 ,
1596
+ "found value `{}` used as a type" ,
1597
+ tcx. item_path_str( def. def_id( ) ) )
1598
+ . span_label ( span, & format ! ( "value used as a type" ) )
1599
+ . emit ( ) ;
1590
1600
return self . tcx ( ) . types . err ;
1591
1601
}
1592
1602
}
0 commit comments