Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustfmt crashes inside ./x.py test #5303

Closed
shahn opened this issue Apr 8, 2022 · 4 comments
Closed

rustfmt crashes inside ./x.py test #5303

shahn opened this issue Apr 8, 2022 · 4 comments

Comments

@shahn
Copy link

shahn commented Apr 8, 2022

I am trying to run the rustc tests, but rustfmt is crashing like given below. I am on macOS Monterey, XCode 13.3, on an M1 Macbook Pro.

$ ./x.py test
Updating only changed submodules
Submodules updated in 0.01 seconds
Building rustbuild
Finished dev [unoptimized] target(s) in 0.10s
Building stage0 tool tidy (x86_64-apple-darwin)
Finished release [optimized] target(s) in 0.11s
tidy check
Checking which error codes lack tests...

629 error codes
highest error code: E0787
Found 504 error codes
Found 0 error(s) in error codes
Done!

372 features
fmt check
rustfmt(7389,0x20133a600) malloc: *** error for object 0x6000036d4600: pointer being freed was not allocated
rustfmt(7389,0x20133a600) malloc: *** set a breakpoint in malloc_error_break to debug
Running "/Users/code/git/rust/build/x86_64-apple-darwin/stage0/bin/rustfmt" "--config-path" "/Users/code/git/rust" "--edition" "2021" "--unstable-features" "--skip-children" "--check" "/Users/code/git/rust/library/std/src/collections/hash/set.rs" "/Users/code/git/rust/library/std/src/collections/hash/set/tests.rs" "/Users/code/git/rust/library/std/src/collections/hash/map/tests.rs" "/Users/code/git/rust/library/std/src/sync/condvar.rs" "/Users/code/git/rust/library/std/src/sync/poison.rs" "/Users/code/git/rust/library/std/src/sync/barrier/tests.rs" "/Users/code/git/rust/library/std/src/sync/mutex/tests.rs" "/Users/code/git/rust/library/std/src/prelude/v1.rs" failed.

@calebcartwright
Copy link
Member

I realize things can be somewhat muddy given the subtrees/modules, but when you encounter an issue working in the rust-lang/rust repository it's typically best to report the issue in that same repository.

We're not doing any work with raw pointers in rustfmt, so I'd assume this is actually surfacing up from the compiler internals of which rustfmt is a consumer.

I'm going to reach out to the infra team to suggest that they transfer the issue, though I'd also encourage you to post some more specifics about your local environment where you're experiencing the issue, including the git details of your local rust-lang/rust repo

@calebcartwright
Copy link
Member

Based on chat in Zulip I'm going to close as a functional dupe of rust-lang/rust#92173.

Seems you should be able to work around this by enabling jemalloc in your local config.toml file

@shahn
Copy link
Author

shahn commented Apr 9, 2022

Thank you, and apologies if this was misfiled. I was under the (probably wrong) assumption that the way the crash happens in stage0 rustfmt that it was a precompiled rustfmt that crashes. None of the suggestions in rust-lang/rust#92173 worked for me and it didn't describe rustfmt, therefore I opened an issue here.

@inikulin
Copy link

I'm seeing the same issue with my codebase after upgrading the toolchain to 1.60 (even though rustfmt version hasn't changed). The issue disappears if I downgrade to 1.59. That makes me wonder if it's a rustc issue in disguise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants