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

How to put a println for debug in rust src? #48839

Closed
UncP opened this issue Mar 8, 2018 · 2 comments
Closed

How to put a println for debug in rust src? #48839

UncP opened this issue Mar 8, 2018 · 2 comments

Comments

@UncP
Copy link

UncP commented Mar 8, 2018

I need to put a println in rust src and compile a local rustc to help debug, when I do that, I get such errors:

could not compile local rustc.

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: Error during translation/LLVM phase.

error: Could not compile `core`.

Caused by:
process didn't exit successfully: `/home/pingcap/uncp/rust/build/bootstrap/debug/rustc --crate-name core libcore/lib.rs --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=e2f49b08d2bc06b5 -C extra-filename=-e2f49b08d2bc06b5 --out-dir /home/pingcap/uncp/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/home/pingcap/uncp/rust/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/home/pingcap/uncp/rust/build/x86_64-unknown-linux-gnu/stage1-std/release/deps` (exit code: 101)
thread 'main' panicked at 'command did not execute successfully: "/home/pingcap/uncp/rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "-target" "x86_64-unknown-linux-gnu" "-j" "40" "release" "features" "panic-unwind jemalloc backtrace" "manifest-path" "/home/pingcap/uncp/rust/src/libstd/Cargo.toml" "-message-format" "json"
expected success, got: exit code: 101', bootstrap/compile.rs:886:9
note: Run with `RUST_BACKTRACE=1` for a backtrace.
failed to run: /home/pingcap/uncp/rust/build/bootstrap/debug/bootstrap build
Build completed unsuccessfully in 0:00:21

how can I put a println or an info log in rust src.

@varkor
Copy link
Member

varkor commented Mar 8, 2018

You should be able to use eprintln to print to stderr now that #47634 has been merged, though traditionally the standard method has been using the debug!/ info!/etc. logging macros with RUST_LOG=debug/info (you'll need to filter the output with the latter method, though, as there's a lot of noise).

@petrochenkov
Copy link
Contributor

Duplicate of #43855

@petrochenkov petrochenkov marked this as a duplicate of #43855 Mar 8, 2018
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