rust-lang / rust-lang/rust

Is `rustc -o` supposed to prescribe the *full* filename incl. extensions, or is it only supposed to describe the filename without extensions?

Open
#147,403 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs C-discussion O-windows-gnu O-windows-msvc T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

To me, both prescribes-full-filename or filename-without-extension effects make sense, but we should probably be consistent about this. It seems like

  • On x86_64-pc-windows-gnu, rustc foo.rs -o foo --target=x86_64-pc-windows-gnu produces foo.exe, but
  • On x86_64-pc-windows-msvc, rustc foo.rs -o foo --target=x86_64-pc-windows-msvc produces foo.

I would've expected either both to have the .exe extension, or neither, but not differently? 🤔

I'm on a slightly older nightly toolchain; I don't remember seeing any recent changes surrounding this.

rustc 1.92.0-nightly (595b9a498 2025-10-03)
binary: rustc
commit-hash: 595b9a498bc55fcd30111e430d8e4290ed833b4c
commit-date: 2025-10-03
host: x86_64-pc-windows-msvc
release: 1.92.0-nightly
LLVM version: 21.1.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the rustc command behavior described for the x86_64-pc-windows-gnu and x86_64-pc-windows-msvc targets, reproducing both -o foo invocations. Determine the intended extension semantics and identify the relevant compiler entry point and regression coverage. Done means the behavior is consistent across these targets and the chosen semantics are verified by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
40/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.