Skip to content

rustc --cfg=')' exits without error #73026

New issue

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

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

Already on GitHub? # to your account

Closed
ogoffart opened this issue Jun 5, 2020 · 1 comment · Fixed by #92468
Closed

rustc --cfg=')' exits without error #73026

ogoffart opened this issue Jun 5, 2020 · 1 comment · Fixed by #92468
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@ogoffart
Copy link
Contributor

ogoffart commented Jun 5, 2020

Code

Running the command rustc --cfg=']' exits without any meaningful error.

Meta

rustc --version --verbose:

rustc 1.43.0 (4fb7144ed 2020-04-20)
binary: rustc
commit-hash: 4fb7144ed159f94491249e86d5bbd033b5d60550
commit-date: 2020-04-20
host: x86_64-unknown-linux-gnu
release: 1.43.0
LLVM version: 9.0

Also reproduced on godbold.org with the 1.45 nightly.
Changing version on godbold.org shows the problem start occuring in 1.39.
(rustc 1.38 properly give an error)

Background

I had a typo in my build.rs script, it looked something like that:

println!("cargo:rustc-cfg=something_something=\"{}\"]", something.something());

cargo build was then simply giving me an single meaningless error

error: could not compile `mycrate`.

I then had to try bisecting the code trying to find out where was the problem (as i had many change both in the build script and in the actual crate, it was not obvious what was the problem) until i found out the leftover ']' which was there from a copy paste from a line in https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script

@ogoffart ogoffart added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 5, 2020
@jonas-schievink jonas-schievink added A-diagnostics Area: Messages for errors, warnings, and lints and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Jun 5, 2020
@meithecatte
Copy link
Contributor

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 1, 2022
Emit an error for `--cfg=)`

Fixes rust-lang#73026

See also: rust-lang#64467, rust-lang#89468

The issue stems from a `FatalError` being silently raised in
`panictry_buffer`. Normally this is not a problem, because
`panictry_buffer` emits the causes of the error, but they are not
themselves fatal, so they get filtered out by the silent emitter.

To fix this, we use a parser entrypoint which doesn't use
`panictry_buffer`, and we handle the error ourselves.
@bors bors closed this as completed in 193342e Jan 2, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants