@@ -2230,17 +2230,17 @@ impl<'a> LoweringContext<'a> {
2230
2230
. collect ( ) ;
2231
2231
if expected_lifetimes > 0 && param_mode == ParamMode :: Explicit {
2232
2232
let anon_lt_suggestion = vec ! [ "'_" ; expected_lifetimes] . join ( ", " ) ;
2233
- let no_ty_args = generic_args. args . len ( ) == expected_lifetimes;
2233
+ let no_non_lt_args = generic_args. args . len ( ) == expected_lifetimes;
2234
2234
let no_bindings = generic_args. bindings . is_empty ( ) ;
2235
- let ( incl_angl_brckt, insertion_span , suggestion) = if no_ty_args && no_bindings {
2235
+ let ( incl_angl_brckt, insertion_sp , suggestion) = if no_non_lt_args && no_bindings {
2236
2236
// If there are no (non-implicit) generic args or associated type
2237
2237
// bindings, our suggestion includes the angle brackets.
2238
2238
( true , path_span. shrink_to_hi ( ) , format ! ( "<{}>" , anon_lt_suggestion) )
2239
2239
} else {
2240
2240
// Otherwise (sorry, this is kind of gross) we need to infer the
2241
2241
// place to splice in the `'_, ` from the generics that do exist.
2242
2242
let first_generic_span = first_generic_span
2243
- . expect ( "already checked that type args or bindings exist" ) ;
2243
+ . expect ( "already checked that non-lifetime args or bindings exist" ) ;
2244
2244
( false , first_generic_span. shrink_to_lo ( ) , format ! ( "{}, " , anon_lt_suggestion) )
2245
2245
} ;
2246
2246
match self . anonymous_lifetime_mode {
@@ -2263,7 +2263,7 @@ impl<'a> LoweringContext<'a> {
2263
2263
expected_lifetimes,
2264
2264
path_span,
2265
2265
incl_angl_brckt,
2266
- insertion_span ,
2266
+ insertion_sp ,
2267
2267
suggestion,
2268
2268
) ;
2269
2269
err. emit ( ) ;
@@ -2280,7 +2280,7 @@ impl<'a> LoweringContext<'a> {
2280
2280
expected_lifetimes,
2281
2281
path_span,
2282
2282
incl_angl_brckt,
2283
- insertion_span ,
2283
+ insertion_sp ,
2284
2284
suggestion,
2285
2285
)
2286
2286
) ;
@@ -2316,9 +2316,10 @@ impl<'a> LoweringContext<'a> {
2316
2316
mut itctx : ImplTraitContext < ' _ > ,
2317
2317
) -> ( hir:: GenericArgs , bool ) {
2318
2318
let & AngleBracketedArgs { ref args, ref constraints, .. } = data;
2319
- let has_types = args. iter ( ) . any ( |arg| match arg {
2319
+ let has_non_lt_args = args. iter ( ) . any ( |arg| match arg {
2320
+ ast:: GenericArg :: Lifetime ( _) => false ,
2320
2321
ast:: GenericArg :: Type ( _) => true ,
2321
- _ => false ,
2322
+ ast :: GenericArg :: Const ( _ ) => true ,
2322
2323
} ) ;
2323
2324
(
2324
2325
hir:: GenericArgs {
@@ -2328,7 +2329,7 @@ impl<'a> LoweringContext<'a> {
2328
2329
. collect ( ) ,
2329
2330
parenthesized : false ,
2330
2331
} ,
2331
- !has_types && param_mode == ParamMode :: Optional
2332
+ !has_non_lt_args && param_mode == ParamMode :: Optional
2332
2333
)
2333
2334
}
2334
2335
0 commit comments