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

Error with -Z time-passes #64339

Closed
Ploppz opened this issue Sep 10, 2019 · 7 comments · Fixed by #64497
Closed

Error with -Z time-passes #64339

Ploppz opened this issue Sep 10, 2019 · 7 comments · Fixed by #64497
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Ploppz
Copy link

Ploppz commented Sep 10, 2019

$ rustc --version
rustc 1.39.0-nightly (0b36e9dea 2019-09-09)
$ export RUSTFLAGS="-Z time-passes"
$ cargo build

error: failed to parse the cfg from `rustc --print=cfg`, got:
___
lib___.rlib
lib___.so
lib___.so
lib___.a
lib___.so
/home/erlend/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu
debug_assertions
proc_macro
target_arch="x86_64"
target_endian="little"
target_env="gnu"
target_family="unix"
target_feature="fxsr"
target_feature="mmx"
target_feature="sse"
target_feature="sse2"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="cas"
target_has_atomic="ptr"
target_os="linux"
target_pointer_width="64"
target_thread_local
target_vendor="unknown"
unix
time: 0.020; rss: 53MB		total


Caused by:
  malformed cfg value or key/value pair: `time: 0.020; rss: 53MB		total`

@matthiaskrgr
Copy link
Member

I encountered this as well.

What project are you trying to build?

My theory is that it tries to run something like rustc --print=cfg -Z time=passes (in build.rs?) and then fails to parse the output which is a mix of --print=cfg and -Ztime=passes...

@bjorn3
Copy link
Member

bjorn3 commented Sep 13, 2019

My theory is that it tries to run something like rustc --print=cfg -Z time=passes (in build.rs?)

Way earlier, it runs it right at the start of a compilation to get the rustc version and enabled #[cfg(...)].

and then fails to parse the output which is a mix of --print=cfg and -Ztime=passes...

Probably

@Mark-Simulacrum
Copy link
Member

Could someone use https://github.com/rust-lang-nursery/cargo-bisect-rustc to narrow this down to a particular commit?

@Mark-Simulacrum Mark-Simulacrum added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 13, 2019
@ehuss
Copy link
Contributor

ehuss commented Sep 13, 2019

It looks to be caused by #62419 (I would assume it is #62110 in that rollup). It is now printing the time-passes information even for --print.

@Mark-Simulacrum
Copy link
Member

@nnethercote would you be up for a fix here?

@Mark-Simulacrum Mark-Simulacrum removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Sep 13, 2019
@nnethercote
Copy link
Contributor

I'll take a look on Monday. In the meantime, here's my best guess: I added an extra entry to the -Ztime-passes output that prints the total time for the compilation. That extra line may not be indented at all, and it's possible this means it isn't ignored the same way as indented lines.

@nnethercote
Copy link
Contributor

nnethercote commented Sep 16, 2019

My theory about indentation was wrong. It was indeed a bad interaction between -Ztime-passes and --print=..., as others suggested, because they both print to stdout. #64497 has a fix.

Centril added a commit to Centril/rust that referenced this issue Sep 16, 2019
Don't print the "total" `-Ztime-passes` output if `--prints=...` is also given

Fixes rust-lang#64339.
@bors bors closed this as completed in bb22986 Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants