File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
main/kotlin/org/rust/ide/annotator
test/kotlin/org/rust/ide/annotator Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1340,6 +1340,11 @@ private fun checkDuplicates(
1340
1340
}
1341
1341
1342
1342
private fun checkConstGenerics (holder : RsAnnotationHolder , constParameter : RsConstParameter ) {
1343
+ val default = constParameter.blockExpr
1344
+ if (default != null ) {
1345
+ CONST_GENERICS_DEFAULTS .check(holder, default, " const generics defaults" )
1346
+ }
1347
+
1343
1348
val constGenericAvailability = CONST_GENERICS .availability(constParameter)
1344
1349
if (constGenericAvailability == AVAILABLE ) return
1345
1350
Original file line number Diff line number Diff line change @@ -2913,6 +2913,23 @@ class RsErrorAnnotatorTest : RsAnnotatorTestBase(RsErrorAnnotator::class) {
2913
2913
enum E<const C: i32> {}
2914
2914
""" )
2915
2915
2916
+ @MockRustcVersion(" 1.51.0" )
2917
+ fun `test const generics defaults E0658 1` () = checkErrors("""
2918
+ fn f<const C: i32 = <error descr="const generics defaults is experimental [E0658]">{ 0 }</error>>() {}
2919
+ struct S<const C: i32 = <error descr="const generics defaults is experimental [E0658]">{ 0 }</error>>(A);
2920
+ trait T<const C: i32 = <error descr="const generics defaults is experimental [E0658]">{ 0 }</error>> {}
2921
+ enum E<const C: i32 = <error descr="const generics defaults is experimental [E0658]">{ 0 }</error>> {}
2922
+ """ )
2923
+
2924
+ @MockRustcVersion(" 1.51.0-nightly" )
2925
+ fun `test const generics defaults E0658 2` () = checkErrors("""
2926
+ #![feature(const_generics_defaults)]
2927
+ fn f<const C: i32 = { 0 }>() {}
2928
+ struct S<const C: i32 = { 0 }>(A);
2929
+ trait T<const C: i32 = { 0 }> {}
2930
+ enum E<const C: i32 = { 0 }> {}
2931
+ """ )
2932
+
2916
2933
@MockRustcVersion(" 1.47.0" )
2917
2934
fun `test min const generics E0658 1` () = checkErrors("""
2918
2935
fn f<<error descr="const generics is experimental [E0658]">const C: i32</error>>() {}
You can’t perform that action at this time.
0 commit comments