diff options
Diffstat (limited to 'lib/compilers/rust.ts')
-rw-r--r-- | lib/compilers/rust.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/compilers/rust.ts b/lib/compilers/rust.ts index a9fc71d5a..e1ba06316 100644 --- a/lib/compilers/rust.ts +++ b/lib/compilers/rust.ts @@ -32,6 +32,7 @@ import {BuildEnvDownloadInfo} from '../buildenvsetup/buildenv.interfaces'; import {parseRustOutput} from '../utils'; import {RustParser} from './argument-parsers'; +import {ParseFilters} from '../../types/features/filters.interfaces'; export class RustCompiler extends BaseCompiler { linker: string; @@ -137,7 +138,7 @@ export class RustCompiler extends BaseCompiler { if (this.linker) { options = options.concat(`-Clinker=${this.linker}`); } - } else if (!filters.binary) { + } else { if (!userRequestedEmit) { options = options.concat('--emit', 'asm'); } @@ -148,8 +149,13 @@ export class RustCompiler extends BaseCompiler { } // Override the IR file name method for rustc because the output file is different from clang. - override getIrOutputFilename(inputFilename) { - return this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase).replace('.s', '.ll'); + override getIrOutputFilename(inputFilename: string, filters: ParseFilters): string { + const outputFilename = this.getOutputFilename(path.dirname(inputFilename), this.outputFilebase); + // As per #4054, if we are asked for binary mode, the output will be in the .s file, no .ll will be emited + if (!filters.binary) { + return outputFilename.replace('.s', '.ll'); + } + return outputFilename; } override getArgumentParser() { |