@@ -288,6 +288,52 @@ fn check_variable_kinds() {
288
288
"incorrect parameter kind for trait `IntoTime`: expected lifetime, found type"
289
289
}
290
290
}
291
+
292
+ lowering_error ! {
293
+ program {
294
+ trait Length <const N > { }
295
+ struct Foo { }
296
+ impl <T > Length <T > for Foo { }
297
+ }
298
+ error_msg {
299
+ "incorrect parameter kind for trait `Length`: expected const, found type"
300
+ }
301
+ }
302
+
303
+ lowering_error ! {
304
+ program {
305
+ trait Length <const N > { }
306
+ struct Foo { }
307
+ impl <' a> Length <' a> for Foo { }
308
+ }
309
+ error_msg {
310
+ "incorrect parameter kind for trait `Length`: expected const, found lifetime"
311
+ }
312
+ }
313
+
314
+ lowering_error ! {
315
+ program {
316
+ trait Into <T > { }
317
+ struct Foo { }
318
+ impl <const N > Into <N > for Foo { }
319
+ }
320
+
321
+ error_msg {
322
+ "incorrect parameter kind for trait `Into`: expected type, found const"
323
+ }
324
+ }
325
+
326
+ lowering_error ! {
327
+ program {
328
+ trait IntoTime <' a> { }
329
+ struct Foo { }
330
+ impl <const N > IntoTime <N > for Foo { }
331
+ }
332
+
333
+ error_msg {
334
+ "incorrect parameter kind for trait `IntoTime`: expected lifetime, found const"
335
+ }
336
+ }
291
337
}
292
338
293
339
#[ test]
@@ -584,7 +630,6 @@ fn fn_defs() {
584
630
}
585
631
}
586
632
}
587
-
588
633
#[ test]
589
634
fn arrays ( ) {
590
635
lowering_success ! {
@@ -595,4 +640,40 @@ fn arrays() {
595
640
fn bar<const N >( baz: [ Baz ; N ] ) ;
596
641
}
597
642
}
643
+
644
+ lowering_error ! {
645
+ program {
646
+ struct Baz { }
647
+
648
+ fn foo<T >( baz: [ Baz ; u32 ] ) ;
649
+ }
650
+
651
+ error_msg {
652
+ "parse error: UnrecognizedToken"
653
+ }
654
+ }
655
+
656
+ lowering_error ! {
657
+ program {
658
+ struct Baz { }
659
+
660
+ fn foo<T >( baz: [ Baz ; T ] ) ;
661
+ }
662
+
663
+ error_msg {
664
+ "incorrect parameter kind for `T`: expected const, found type"
665
+ }
666
+ }
667
+
668
+ lowering_error ! {
669
+ program {
670
+ struct Baz { }
671
+
672
+ fn foo<' a>( baz: [ Baz ; ' a] ) ;
673
+ }
674
+
675
+ error_msg {
676
+ "parse error: UnrecognizedToken"
677
+ }
678
+ }
598
679
}
0 commit comments