rust-lang / rust-lang/rust

rustc from homebrew produces SIGBUS: access to undefined memory when -v is provided

Open
#125,350 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-discussion
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

use std::path::{Path,PathBuf};
use std::{env,fs}; 

//TODO
// read src folder into a vec
// convert to typst
// compile to pdf

fn main() ->Result<(), AppError>{
   println!("Hello, world!");
    Ok(())
}

cargo build -v

I expected to see this happen: explanation
code checked and compiled

Instead, this happened: explanation
crash only when -v is provided

Caused by:
  process didn't exit successfully: `CARGO=/opt/homebrew/Cellar/rust/1.78.0/bin/cargo CARGO_BIN_NAME=rst CARGO_CRATE_NAME=rst CARGO_MANIFEST_DIR=/Users/drgo/local/code/booker/rs CARGO_PKG_AUTHORS='' CARGO_PKG_DESCRIPTION='' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=rst CARGO_PKG_README='' CARGO_PKG_REPOSITORY='' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.1.0 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=1 CARGO_PKG_VERSION_PATCH=0 CARGO_PKG_VERSION_PRE='' CARGO_PRIMARY_PACKAGE=1 DYLD_FALLBACK_LIBRARY_PATH='/Users/drgo/local/code/booker/rs/target/debug/deps:/Users/drgo/lib:/usr/local/lib:/usr/lib' rustc --crate-name rst --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=98 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C metadata=a4aaf64bcde3c91c -C extra-filename=-a4aaf64bcde3c91c --out-dir /Users/drgo/local/code/booker/rs/target/debug/deps -C incremental=/Users/drgo/local/code/booker/rs/target/debug/incremental -L dependency=/Users/drgo/local/code/booker/rs/target/debug/deps` (exit status: 1)
Meta

rustc --version --verbose:

ustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
binary: rustc
commit-hash: 9b00956e56009bab2aa15d7bff10916599e3d6d6
commit-date: 2024-04-29
host: aarch64-apple-darwin
release: 1.78.0
LLVM version: 18.1.4
Backtrace

backtrace is not produced probably because of the crash

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 src/main.rs example using cargo build -v and rustc 1.78.0 on aarch64-apple-darwin. Compare the behavior with and without -v, then use the reported rustc command and environment details to identify a reproducible compiler failure; done means the verbose build completes without the reported crash.

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
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.