@@ -147,7 +147,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
147
147
bound_region : ty:: BrNamed ( id, name)
148
148
} ) )
149
149
150
- // (*) -- not late-bound, won't change
150
+ // (*) -- not late-bound, won't change
151
151
}
152
152
153
153
None => {
@@ -167,8 +167,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
167
167
} ;
168
168
169
169
debug ! ( "ast_region_to_region(lifetime={:?}) yields {:?}" ,
170
- lifetime,
171
- r) ;
170
+ lifetime,
171
+ r) ;
172
172
173
173
r
174
174
}
@@ -218,7 +218,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
218
218
span,
219
219
E0632 ,
220
220
"cannot provide explicit type parameters when `impl Trait` is \
221
- used in argument position."
221
+ used in argument position."
222
222
} ;
223
223
224
224
err. emit ( ) ;
@@ -538,7 +538,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
538
538
// region with the current anon region binding (in other words,
539
539
// whatever & would get replaced with).
540
540
debug ! ( "create_substs_for_ast_path(def_id={:?}, self_ty={:?}, \
541
- generic_args={:?})",
541
+ generic_args={:?})",
542
542
def_id, self_ty, generic_args) ;
543
543
544
544
let tcx = self . tcx ( ) ;
@@ -609,7 +609,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
609
609
if default_needs_object_self ( param) {
610
610
struct_span_err ! ( tcx. sess, span, E0393 ,
611
611
"the type parameter `{}` must be explicitly \
612
- specified",
612
+ specified",
613
613
param. name)
614
614
. span_label ( span,
615
615
format ! ( "missing reference to `{}`" , param. name) )
@@ -623,7 +623,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
623
623
self . normalize_ty (
624
624
span,
625
625
tcx. at ( span) . type_of ( param. def_id )
626
- . subst_spanned ( tcx, substs. unwrap ( ) , Some ( span) )
626
+ . subst_spanned ( tcx, substs. unwrap ( ) , Some ( span) )
627
627
) . into ( )
628
628
}
629
629
} else if infer_types {
@@ -851,7 +851,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
851
851
binding. span,
852
852
E0582 ,
853
853
"binding for associated type `{}` references lifetime `{}`, \
854
- which does not appear in the trait input types",
854
+ which does not appear in the trait input types",
855
855
binding. item_name, br_name)
856
856
. emit ( ) ;
857
857
}
@@ -891,7 +891,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
891
891
ref_id,
892
892
binding. span ,
893
893
& format ! ( "associated type binding `{}` specified more than once" ,
894
- binding. item_name)
894
+ binding. item_name)
895
895
) ;
896
896
err. span_label ( binding. span , "used more than once" ) ;
897
897
err. span_label ( * prev_span, format ! ( "first use of `{}`" , binding. item_name) ) ;
@@ -994,7 +994,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
994
994
if !object_safety_violations. is_empty ( ) {
995
995
tcx. report_object_safety_error (
996
996
span, principal. def_id ( ) , object_safety_violations)
997
- . emit ( ) ;
997
+ . emit ( ) ;
998
998
return tcx. types . err ;
999
999
}
1000
1000
@@ -1014,13 +1014,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1014
1014
for item_def_id in associated_types {
1015
1015
let assoc_item = tcx. associated_item ( item_def_id) ;
1016
1016
let trait_def_id = assoc_item. container . id ( ) ;
1017
- struct_span_err ! ( tcx. sess, span, E0191 ,
1018
- "the value of the associated type `{}` (from the trait `{}`) must be specified",
1019
- assoc_item. ident,
1020
- tcx. item_path_str( trait_def_id) )
1021
- . span_label ( span, format ! (
1022
- "missing associated type `{}` value" , assoc_item. ident) )
1023
- . emit ( ) ;
1017
+ struct_span_err ! ( tcx. sess, span, E0191 , "the value of the associated type `{}` \
1018
+ (from the trait `{}`) must be specified",
1019
+ assoc_item. ident,
1020
+ tcx. item_path_str( trait_def_id) )
1021
+ . span_label ( span, format ! ( "missing associated type `{}` value" ,
1022
+ assoc_item. ident) )
1023
+ . emit ( ) ;
1024
1024
}
1025
1025
1026
1026
// Dedup auto traits so that `dyn Trait + Send + Send` is the same as `dyn Trait + Send`.
@@ -1032,12 +1032,11 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1032
1032
iter:: once ( ty:: ExistentialPredicate :: Trait ( * existential_principal. skip_binder ( ) ) )
1033
1033
. chain ( auto_traits. into_iter ( ) . map ( ty:: ExistentialPredicate :: AutoTrait ) )
1034
1034
. chain ( existential_projections
1035
- . map ( |x| ty:: ExistentialPredicate :: Projection ( * x. skip_binder ( ) ) ) )
1035
+ . map ( |x| ty:: ExistentialPredicate :: Projection ( * x. skip_binder ( ) ) ) )
1036
1036
. collect :: < SmallVec < [ _ ; 8 ] > > ( ) ;
1037
1037
v. sort_by ( |a, b| a. stable_cmp ( tcx, b) ) ;
1038
1038
let existential_predicates = ty:: Binder :: bind ( tcx. mk_existential_predicates ( v. into_iter ( ) ) ) ;
1039
1039
1040
-
1041
1040
// Explicitly specified region bound. Use that.
1042
1041
let region_bound = if !lifetime. is_elided ( ) {
1043
1042
self . ast_region_to_region ( lifetime, None )
@@ -1072,7 +1071,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1072
1071
struct_span_err ! ( self . tcx( ) . sess, span, E0223 , "ambiguous associated type" )
1073
1072
. span_label ( span, "ambiguous associated type" )
1074
1073
. note ( & format ! ( "specify the type using the syntax `<{} as {}>::{}`" ,
1075
- type_str, trait_str, name) )
1074
+ type_str, trait_str, name) )
1076
1075
. emit ( ) ;
1077
1076
1078
1077
}
@@ -1094,8 +1093,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1094
1093
1095
1094
// Check that there is exactly one way to find an associated type with the
1096
1095
// correct name.
1097
- let suitable_bounds =
1098
- traits:: transitive_bounds ( tcx, & bounds)
1096
+ let suitable_bounds = traits:: transitive_bounds ( tcx, & bounds)
1099
1097
. filter ( |b| self . trait_defines_associated_type_named ( b. def_id ( ) , assoc_name) ) ;
1100
1098
1101
1099
let param_node_id = tcx. hir . as_local_node_id ( ty_param_def_id) . unwrap ( ) ;
@@ -1110,20 +1108,20 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1110
1108
// Checks that bounds contains exactly one element and reports appropriate
1111
1109
// errors otherwise.
1112
1110
fn one_bound_for_assoc_type < I > ( & self ,
1113
- mut bounds : I ,
1114
- ty_param_name : & str ,
1115
- assoc_name : ast:: Ident ,
1116
- span : Span )
1111
+ mut bounds : I ,
1112
+ ty_param_name : & str ,
1113
+ assoc_name : ast:: Ident ,
1114
+ span : Span )
1117
1115
-> Result < ty:: PolyTraitRef < ' tcx > , ErrorReported >
1118
1116
where I : Iterator < Item =ty:: PolyTraitRef < ' tcx > >
1119
1117
{
1120
1118
let bound = match bounds. next ( ) {
1121
1119
Some ( bound) => bound,
1122
1120
None => {
1123
1121
struct_span_err ! ( self . tcx( ) . sess, span, E0220 ,
1124
- "associated type `{}` not found for `{}`" ,
1125
- assoc_name,
1126
- ty_param_name)
1122
+ "associated type `{}` not found for `{}`" ,
1123
+ assoc_name,
1124
+ ty_param_name)
1127
1125
. span_label ( span, format ! ( "associated type `{}` not found" , assoc_name) )
1128
1126
. emit ( ) ;
1129
1127
return Err ( ErrorReported ) ;
@@ -1142,14 +1140,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1142
1140
for bound in bounds {
1143
1141
let bound_span = self . tcx ( ) . associated_items ( bound. def_id ( ) ) . find ( |item| {
1144
1142
item. kind == ty:: AssociatedKind :: Type &&
1145
- self . tcx ( ) . hygienic_eq ( assoc_name, item. ident , bound. def_id ( ) )
1143
+ self . tcx ( ) . hygienic_eq ( assoc_name, item. ident , bound. def_id ( ) )
1146
1144
} )
1147
1145
. and_then ( |item| self . tcx ( ) . hir . span_if_local ( item. def_id ) ) ;
1148
1146
1149
1147
if let Some ( span) = bound_span {
1150
1148
err. span_label ( span, format ! ( "ambiguous `{}` from `{}`" ,
1151
- assoc_name,
1152
- bound) ) ;
1149
+ assoc_name,
1150
+ bound) ) ;
1153
1151
} else {
1154
1152
span_note ! ( & mut err, span,
1155
1153
"associated type `{}` could derive from `{}`" ,
@@ -1198,8 +1196,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1198
1196
}
1199
1197
} ;
1200
1198
1201
- let candidates =
1202
- traits:: supertraits ( tcx, ty:: Binder :: bind ( trait_ref) )
1199
+ let candidates = traits:: supertraits ( tcx, ty:: Binder :: bind ( trait_ref) )
1203
1200
. filter ( |r| self . trait_defines_associated_type_named ( r. def_id ( ) , assoc_name) ) ;
1204
1201
1205
1202
match self . one_bound_for_assoc_type ( candidates, "Self" , assoc_name, span) {
@@ -1230,7 +1227,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1230
1227
let ( assoc_ident, def_scope) = tcx. adjust_ident ( assoc_name, trait_did, ref_id) ;
1231
1228
let item = tcx. associated_items ( trait_did) . find ( |i| {
1232
1229
Namespace :: from ( i. kind ) == Namespace :: Type &&
1233
- i. ident . modern ( ) == assoc_ident
1230
+ i. ident . modern ( ) == assoc_ident
1234
1231
} )
1235
1232
. expect ( "missing associated type" ) ;
1236
1233
@@ -1293,16 +1290,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1293
1290
if err_for_lt { continue }
1294
1291
err_for_lt = true ;
1295
1292
( struct_span_err ! ( self . tcx( ) . sess, lt. span, E0110 ,
1296
- "lifetime parameters are not allowed on \
1297
- this type") ,
1293
+ "lifetime parameters are not allowed on this type" ) ,
1298
1294
lt. span ,
1299
1295
"lifetime" )
1300
1296
}
1301
1297
hir:: GenericArg :: Type ( ty) => {
1302
1298
if err_for_ty { continue }
1303
1299
err_for_ty = true ;
1304
1300
( struct_span_err ! ( self . tcx( ) . sess, ty. span, E0109 ,
1305
- "type parameters are not allowed on this type" ) ,
1301
+ "type parameters are not allowed on this type" ) ,
1306
1302
ty. span ,
1307
1303
"type" )
1308
1304
}
@@ -1590,7 +1586,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
1590
1586
) ) ;
1591
1587
1592
1588
// Find any late-bound regions declared in return type that do
1593
- // not appear in the arguments. These are not wellformed .
1589
+ // not appear in the arguments. These are not well-formed .
1594
1590
//
1595
1591
// Example:
1596
1592
// for<'a> fn() -> &'a str <-- 'a is bad
0 commit comments