rust-lang / rust-lang/rust

rustc fails to build trivial hello world program; cargo build always fails : exit code: 0xc0000005, STATUS_ACCESS_VIOLATION

Open
#135,114 46 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Verification
Problem

Hi,

I have installed latest rustup-init.exe. Always i am getting build issue as below exit code: 0xc0000005, STATUS_ACCESS_VIOLATION. I have tried to reinstall couple of times still did not workout.

PS D:\rust-example> cargo new ex03
    Creating binary (application) `ex03` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
PS D:\rust-example> cd .\ex03\

PS D:\rust-example\ex03> cargo --version
cargo 1.83.0 (5ffbef321 2024-10-29)

PS D:\rust-example\ex03> rustc --version
rustc 1.83.0 (90b35a623 2024-11-26)

PS D:\rust-example\ex03> cargo build
   Compiling ex03 v0.1.0 (D:\rust-example\ex03)
error: could not compile `ex03` (bin "ex03")

Caused by:
  process didn't exit successfully: `C:\Users\LENOVO\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name ex03 --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=237 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --check-cfg cfg(docsrs) --check-cfg "cfg(feature, values())" -C metadata=3c538b4ef1d2d27e --out-dir D:\rust-example\ex03\target\debug\deps -C incremental=D:\rust-example\ex03\target\debug\incremental -L dependency=D:\rust-example\ex03\target\debug\deps` (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
PS D:\rust-example\ex03> 

Could you please help?

Steps
  1. Download and install rustup-init.exe from install exe from here
  2. Create a sample project cargo new ex03
  3. Perform cargo build

Issue: It never build success. Always getting error as exit code: 0xc0000005, STATUS_ACCESS_VIOLATION.

Possible Solution(s)

No response

Notes

I have tried to install stable-x86_64-pc-windows-gnu and checked however still did not worked out.

Windows Version:
Image
Image

Rustup version
cargo 1.83.0 (5ffbef321 2024-10-29)
Installed toolchains
Default host: x86_64-pc-windows-msvc
rustup home:  C:\Users\LENOVO\.rustup

stable-x86_64-pc-windows-msvc (default)
rustc 1.83.0 (90b35a623 2024-11-26)
OS version
Windows 11 Pro OS,  Version 24H2 (OS Build 26100.2605)

C:\Windows\System32>wmic os get osarchitecture
OSArchitecture
64-bit

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 by reproducing the failure with the reported cargo build command against src/main.rs, using the listed stable MSVC and GNU toolchains on Windows. Inspect the rustc.exe invocation and compare whether either toolchain avoids the access violation; done means identifying a confirmed cause or a minimal reproducible failure that can guide a targeted fix.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.