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

Proc Macro Crate and Workspace Miri and Clippy Malloc Error #92185

Open
KSBilodeau opened this issue Dec 22, 2021 · 6 comments
Open

Proc Macro Crate and Workspace Miri and Clippy Malloc Error #92185

KSBilodeau opened this issue Dec 22, 2021 · 6 comments
Labels
A-proc-macros Area: Procedural macros C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS

Comments

@KSBilodeau
Copy link
Contributor

When compiling a workspace that has a proc macro crate in it, rustc emits a malloc error causing tools such as miri and clippy to fail. This bug affects nightly versions 2021-12-05+.

I tried this code:

playground_workspace.zip

I expected to see this happen:
Miri and clippy successfully assess my code

Instead, this happened:
the following crashes (I can supply the actual Mac IPS files if it would be more helpful than these txt copies):
clippy.txt
miri.txt

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (23f69235a 2021-12-20)
binary: rustc
commit-hash: 23f69235ad2eb9b44ac1a55eeaa3f9b484d9de4a
commit-date: 2021-12-20
host: x86_64-apple-darwin
release: 1.59.0-nightly
LLVM version: 13.0.0
@KSBilodeau KSBilodeau added the C-bug Category: This is a bug. label Dec 22, 2021
@KSBilodeau KSBilodeau changed the title Compiling a Workspace with a macro c Proc Macro Crate and Workspace Miri and Clippy Malloc Error Dec 22, 2021
@jyn514 jyn514 added A-proc-macros Area: Procedural macros I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS labels Dec 22, 2021
@hkratz
Copy link
Contributor

hkratz commented Dec 22, 2021

Looks like it is during proc macro compilation, not execution? Shouldn't that use jemalloc instead of the system malloc?

The error message is the same as in #92173.

@ehuss
Copy link
Contributor

ehuss commented Dec 22, 2021

clippy and miri are not built with jemalloc.

I think this is likely the same as #92173.

I've been trying to dig into this some. I bisected to #91505, and I've been trying to bisect within that rollup, but I'm not really finding out much. I'm still trying to go through them, it is a pretty slow process.

@ehuss
Copy link
Contributor

ehuss commented Dec 22, 2021

I'm a bit at a loss. Reverting #91385 makes the problem go away (both here and my tests with #92173). However, that PR is not doing anything that should affect any of this, since it is only within an error path. So my best guess is that PR shuffles the code layout/generation just enough to trigger the underlying issue.

cc @rust-lang/clippy and @rust-lang/miri just as a heads up that clippy and miri are crashing on macOS. I haven't tested RLS, but I would imagine it might also have issues.

I would be reluctant to enable jemalloc in miri and clippy. I don't know what is causing the underlying error. However, that is a route we could take. It would involve replicating all of this in their respective main binaries. I'm having dejavu about this, but I don't remember where I last discussed this.

@RalfJung
Copy link
Member

I assume this is the same problem as rust-lang/miri#1941

@RalfJung
Copy link
Member

RalfJung commented Dec 23, 2021

I'm a bit at a loss. Reverting #91385 makes the problem go away

At least that is consistent with the regression range from rust-lang/miri#1941.

Miri itself acts as rustc for proc-macros, but it seems (I was not aware of that) it is a different rustc than the "real" one -- it does not use jemalloc? So yeah I assume this is the same as #92173. Though I also assume that just masks the error since jemalloc doesn't do the realloc check that leads to the abort. That's my guess anyway.

@rdornin
Copy link

rdornin commented Mar 18, 2022

I just want to report that issue is currently blocking me in development. If there are any work around for the macos darwin tool chain and clippy errors... would love to hear about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-proc-macros Area: Procedural macros C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS
Projects
None yet
Development

No branches or pull requests

6 participants