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(
13401340}
13411341
13421342private 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+
13431348 val constGenericAvailability = CONST_GENERICS .availability(constParameter)
13441349 if (constGenericAvailability == AVAILABLE ) return
13451350
Original file line number Diff line number Diff line change @@ -2913,6 +2913,23 @@ class RsErrorAnnotatorTest : RsAnnotatorTestBase(RsErrorAnnotator::class) {
29132913 enum E<const C: i32> {}
29142914 """ )
29152915
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+
29162933 @MockRustcVersion(" 1.47.0" )
29172934 fun `test min const generics E0658 1` () = checkErrors("""
29182935 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