5
5
6
6
package org.rust.cargo
7
7
8
+ import com.intellij.findAnnotationInstance
8
9
import com.intellij.openapi.Disposable
9
10
import com.intellij.openapi.util.Disposer
10
11
import com.intellij.openapi.util.RecursionManager
@@ -84,6 +85,7 @@ abstract class RsWithToolchainTestBase : CodeInsightFixtureTestCase<ModuleFixtur
84
85
if (disableMissedCacheAssertions) {
85
86
RecursionManager .disableMissedCacheAssertions(testRootDisposable)
86
87
}
88
+ setupExperimentalFeatures()
87
89
setupResolveEngine(project, testRootDisposable)
88
90
findAnnotationInstance<ExpandMacros >()?.let { ann ->
89
91
Disposer .register(
@@ -98,6 +100,12 @@ abstract class RsWithToolchainTestBase : CodeInsightFixtureTestCase<ModuleFixtur
98
100
setExperimentalFeatureEnabled(RsExperiments .FETCH_ACTUAL_STDLIB_METADATA , fetchActualStdlibMetadata, testRootDisposable)
99
101
}
100
102
103
+ private fun setupExperimentalFeatures () {
104
+ for (feature in findAnnotationInstance<WithExperimentalFeatures >()?.features.orEmpty()) {
105
+ setExperimentalFeatureEnabled(feature, true , testRootDisposable)
106
+ }
107
+ }
108
+
101
109
override fun tearDown () {
102
110
Disposer .dispose(earlyTestRootDisposable)
103
111
rustupFixture.tearDown()
@@ -114,10 +122,6 @@ abstract class RsWithToolchainTestBase : CodeInsightFixtureTestCase<ModuleFixtur
114
122
protected fun buildProject (builder : FileTreeBuilder .() -> Unit ): TestProject =
115
123
fileTree { builder() }.create()
116
124
117
- /* * Tries to find the specified annotation on the current test method and then on the current class */
118
- private inline fun <reified T : Annotation > findAnnotationInstance (): T ? =
119
- javaClass.getMethod(name).getAnnotation(T ::class .java) ? : javaClass.getAnnotation(T ::class .java)
120
-
121
125
/* *
122
126
* Tries to launches [action]. If it returns `false`, invokes [UIUtil.dispatchAllInvocationEvents] and tries again
123
127
*
0 commit comments