Skip to content

Commit 87a916b

Browse files
committed
Make executable name snake case
Refs rust-lang/rust#45127
1 parent 6203c26 commit 87a916b

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

org.lflang.tests/src/org/lflang/tests/runtime/TestBase.xtend

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import org.eclipse.xtext.validation.CheckMode
1919
import org.eclipse.xtext.validation.IResourceValidator
2020
import org.eclipse.xtext.xbase.lib.Functions.Function1
2121
import org.lflang.ASTUtils
22+
import org.lflang.CommonExtensionsKt
2223
import org.lflang.FileConfig
2324
import org.lflang.Target
2425
import org.lflang.generator.StandaloneContext
@@ -345,6 +346,11 @@ abstract class TestBase {
345346
case Rust: {
346347
val binPath = test.fileConfig.binPath
347348
var binaryName = nameOnly
349+
if (test.target == Target.Rust) {
350+
// Rust exec names are snake case, otherwise we get a cargo warning
351+
// https://github.com/rust-lang/rust/issues/45127
352+
binaryName = CommonExtensionsKt.camelToSnakeCase(binaryName)
353+
}
348354
// Adjust binary extension if running on Window
349355
if (System.getProperty("os.name").startsWith("Windows")) {
350356
binaryName = nameOnly + ".exe"

org.lflang/src/org/lflang/generator/rust/RustGenerator.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class RustGenerator(fileConfig: RustFileConfig, errorReporter: ErrorReporter) :
7777
),
7878
reactors = reactors,
7979
mainReactor = mainReactor,
80-
executableName = mainReactor.lfName
80+
// Rust exec names are snake case, otherwise we get a cargo warning
81+
// https://github.com/rust-lang/rust/issues/45127
82+
executableName = mainReactor.lfName.camelToSnakeCase()
8183
)
8284
}
8385

0 commit comments

Comments
 (0)