-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.
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
Metadata
Metadata
Assignees
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
DrGo commentedon May 21, 2024
Actually the compiler now crashes even when the -v is not provided with the following code
the crashing stops and errors are reported as expected when I add `dyn' in the function definition
workingjubilee commentedon May 21, 2024
How... odd. If you are using rustc via Homebrew, please try installing the Rust toolchain via https://rustup.rs instead and letting us know if this replicates?
DrGo commentedon May 21, 2024
Yes.. very odd,
I removed the Homebrew version and reinstalled using the rustup script.
Now the compiler crashes only if I add the -v option but does not report the cause of the crash
workingjubilee commentedon May 21, 2024
...that is incredibly fucky.
workingjubilee commentedon May 21, 2024
And this reproduces with the nightly compiler too, right?
workingjubilee commentedon May 21, 2024
Ah, I mean the one you can get by trying
rustup default nightly
.DrGo commentedon May 21, 2024
forgot to enable nightly..
yes, it occurs with nightly too. only with the -v option
workingjubilee commentedon May 21, 2024
Huuuh, I can't get the "crash without
-v
" sample to repro.For the other cases, I think this is just what Cargo does when you pass it
-v
. Normally it silences rustc failures which exit with1
, i.e. a "normal failure", but you asked it for verbose output, I guess?workingjubilee commentedon May 21, 2024
@DrGo As for why the code doesn't compile: you haven't defined the
AppError
type.workingjubilee commentedon May 21, 2024
The other errors you get on the later sample also have explanations. Have you acted on the error messages?
DrGo commentedon May 21, 2024
I used -v when I noticed stable rustc crashing with the SIGBUS message.
What I shared was just an example code to trigger the crash.
workingjubilee commentedon May 21, 2024
Hmm, a SIGBUS is indeed worrying...
DrGo commentedon May 21, 2024
that was the Homebrew stable rustc.. I will just use the rustup version
saethlin commentedon May 21, 2024
This whole issue is incredibly confused. I can't even tell what's being reported here.
I'm guessing that what we have is an example program which will cause the Rust toolchain distributed by homebrew to SIGBUS, but which does not cause the toolchain distributed by rustup to SIGBUS. Is that correct?
DrGo commentedon May 21, 2024
Otherwise, I am happy with your explanation to the behaviour of cargo
Thanks
DrGo commentedon May 21, 2024
yes... the error when the compiler crashed with the SIGBUS message was very similar to what cargo -v reports with when rustc can't compile code. The only difference was the brief SIGBUS part. That is very confusing for newbies like me.
saethlin commentedon May 21, 2024
So there's not necessarily any bug here. The toolchain we distribute works correctly.
There have been problems in the past with
strip
implementations mangling librustc.so, it would not surprise me if something like that is happening in whatever process homebrew is using to deliver artifacts.If I'm correct, this is a bug in homebrew.
crescentrose commentedon Jun 23, 2024
I had this happen intermittently as well when running doc-tests, and indeed removing the Homebrew version and installing
rustc
directly via Rustup as @workingjubilee suggested fixed the issue. I'm not sure exactly what's going on in the Homebrew version but so far I am satisfied by just accepting they messed up somewhere.[-]compiler SIGBUS: access to undefined memory when -v is provided[/-][+]rustc from homebrew produces SIGBUS: access to undefined memory when -v is provided[/+]