@@ -2245,27 +2245,32 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize,
2245
2245
"expected"
2246
2246
} ;
2247
2247
let arguments_plural = if required == 1 { "" } else { "s" } ;
2248
- struct_span_err ! ( tcx. sess, span, E0243 , "wrong number of type arguments" )
2249
- . span_label (
2250
- span,
2251
- & format ! ( "{} {} type argument{}, found {}" ,
2252
- expected, required, arguments_plural, supplied)
2253
- )
2248
+
2249
+ struct_span_err ! ( tcx. sess, span, E0243 ,
2250
+ "wrong number of type arguments: {} {}, found {}" ,
2251
+ expected, required, supplied)
2252
+ . span_label ( span,
2253
+ & format ! ( "{} {} type argument{}" ,
2254
+ expected,
2255
+ required,
2256
+ arguments_plural) )
2254
2257
. emit ( ) ;
2255
2258
} else if supplied > accepted {
2256
- let expected = if required == 0 {
2257
- "expected no" . to_string ( )
2258
- } else if required < accepted {
2259
+ let expected = if required < accepted {
2259
2260
format ! ( "expected at most {}" , accepted)
2260
2261
} else {
2261
2262
format ! ( "expected {}" , accepted)
2262
2263
} ;
2263
2264
let arguments_plural = if accepted == 1 { "" } else { "s" } ;
2264
2265
2265
- struct_span_err ! ( tcx. sess, span, E0244 , "wrong number of type arguments" )
2266
+ struct_span_err ! ( tcx. sess, span, E0244 ,
2267
+ "wrong number of type arguments: {}, found {}" ,
2268
+ expected, supplied)
2266
2269
. span_label (
2267
2270
span,
2268
- & format ! ( "{} type argument{}, found {}" , expected, arguments_plural, supplied)
2271
+ & format ! ( "{} type argument{}" ,
2272
+ if accepted == 0 { "expected no" } else { & expected } ,
2273
+ arguments_plural)
2269
2274
)
2270
2275
. emit ( ) ;
2271
2276
}
0 commit comments