Skip to content

Commit 95b072e

Browse files
committed
Rust: remove shipped feature flag
1 parent b694213 commit 95b072e

File tree

8 files changed

+21
-51
lines changed

8 files changed

+21
-51
lines changed

.github/workflows/__rust.yml

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/feature-flags.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

Lines changed: 9 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pr-checks/checks/rust.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ steps:
77
with:
88
languages: rust
99
tools: ${{ steps.prepare-test.outputs.tools-url }}
10-
env:
11-
CODEQL_ACTION_RUST_ANALYSIS: true
1210
- uses: ./../action/analyze
1311
id: analysis
1412
with:

src/feature-flags.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export enum Feature {
5454
ExtractToToolcache = "extract_to_toolcache",
5555
PythonDefaultIsToNotExtractStdlib = "python_default_is_to_not_extract_stdlib",
5656
QaTelemetryEnabled = "qa_telemetry_enabled",
57-
RustAnalysis = "rust_analysis",
5857
ZstdBundleStreamingExtraction = "zstd_bundle_streaming_extraction",
5958
}
6059

@@ -154,11 +153,6 @@ export const featureConfig: Record<
154153
minimumVersion: undefined,
155154
toolsFeature: ToolsFeature.PythonDefaultIsToNotExtractStdlib,
156155
},
157-
[Feature.RustAnalysis]: {
158-
defaultValue: false,
159-
envVar: "CODEQL_ACTION_RUST_ANALYSIS",
160-
minimumVersion: "2.19.3",
161-
},
162156
[Feature.QaTelemetryEnabled]: {
163157
defaultValue: false,
164158
envVar: "CODEQL_ACTION_QA_TELEMETRY",

src/init-action.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import {
1414
getRequiredInput,
1515
getTemporaryDirectory,
1616
persistInputs,
17-
isDefaultSetup,
1817
} from "./actions-util";
1918
import { getGitHubVersion } from "./api-client";
2019
import {
@@ -32,7 +31,7 @@ import {
3231
makeDiagnostic,
3332
} from "./diagnostics";
3433
import { EnvVar } from "./environment";
35-
import { Feature, featureConfig, Features } from "./feature-flags";
34+
import { Feature, Features } from "./feature-flags";
3635
import {
3736
checkInstallPython311,
3837
cleanupDatabaseClusterDirectory,
@@ -588,32 +587,25 @@ async function run() {
588587
core.exportVariable(bmnVar, value);
589588
}
590589

591-
// For rust: set CODEQL_ENABLE_EXPERIMENTAL_FEATURES, unless codeql already supports rust without it
590+
// For rust, if running a version prior to public preview (2.22.1) set CODEQL_ENABLE_EXPERIMENTAL_FEATURES
592591
if (
593592
config.languages.includes(Language.rust) &&
594-
!(await codeql.resolveLanguages()).rust
593+
!(await codeql.resolveLanguages()).rust // means codeql already supports rust without any intervention
595594
) {
596-
const feat = Feature.RustAnalysis;
597-
const minVer = featureConfig[feat].minimumVersion as string;
595+
const minVer = "2.19.3";
598596
const envVar = "CODEQL_ENABLE_EXPERIMENTAL_FEATURES";
599-
// if in default setup, it means the feature flag was on when rust was enabled
600-
// if the feature flag gets turned off, let's not have rust analysis throwing a configuration error
601-
// in that case rust analysis will be disabled only when default setup is refreshed
602-
if (isDefaultSetup() || (await features.getValue(feat, codeql))) {
603-
core.exportVariable(envVar, "true");
604-
}
605-
if (process.env[envVar] !== "true") {
597+
const actualVer = (await codeql.getVersion()).version;
598+
if (semver.lt(actualVer, minVer)) {
606599
throw new ConfigurationError(
607-
`Experimental and not officially supported Rust analysis requires setting ${envVar}=true in the environment`,
600+
`Experimental Rust analysis is supported by CodeQL CLI version ${minVer} or higher, but found version ${actualVer}`,
608601
);
609602
}
610-
const actualVer = (await codeql.getVersion()).version;
611-
if (semver.lt(actualVer, minVer)) {
603+
if (process.env[envVar] !== "true") {
612604
throw new ConfigurationError(
613-
`Experimental rust analysis is supported by CodeQL CLI version ${minVer} or higher, but found version ${actualVer}`,
605+
`Experimental Rust analysis requires setting ${envVar}=true in the environment, or running version 2.22.1 or higher`,
614606
);
615607
}
616-
logger.info("Experimental rust analysis enabled");
608+
logger.info("Experimental Rust analysis enabled");
617609
}
618610

619611
// Restore dependency cache(s), if they exist.

0 commit comments

Comments
 (0)