# Println in core library and fast compile

**URL:** https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500
**Category:** compiler
**Created:** [October 6, 2022, 10:28am UTC](https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500 "2022-10-06T10:28:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![gonsolo](https://avatars.discourse-cdn.com/v4/letter/g/3e96dc/32.png) [@gonsolo](https://internals.rust-lang.org/u/gonsolo)
#### Post date: [October 6, 2022, 10:28am UTC](https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500/1 "2022-10-06T10:28:25Z")

</div>

Hi, I'm new to Rust and try print variables from library/core/src/slice/sort.rs. I have two questions;

1. How to do this? println!/debug!/dbg! don't seem to work.
2. How to get a working compiler fast? I tried ./x.py --stage 0 etc. but it is still very slow.

---

<div class="post-metadata">

### Author: ![gonsolo](https://avatars.discourse-cdn.com/v4/letter/g/3e96dc/32.png) [@gonsolo](https://internals.rust-lang.org/u/gonsolo)
#### Post date: [October 6, 2022, 12:52pm UTC](https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500/2 "2022-10-06T12:52:17Z")

</div>

> [@gonsolo](#):
>
> How to do this? println!/debug!/dbg! don't seem to work.

> **[Building and debugging - Standard library developers Guide](https://std-dev-guide.rust-lang.org/development/building-and-debugging.html#println-debugging-alloc-and-core)**
>
> Guide for standard library developers

printf works in core and alloc, format! only works in alloc. It seems the best way is to rip the code to be debugged out into a crate and use the usual println! there.

> [@gonsolo](#):
>
> How to get a working compiler fast? I tried ./x.py --stage 0 etc. but it is still very slow.

From an answer in Zulip:

1. `x.py setup`, then choose library
2. `x.py build -j22` finished in 13 seconds after an edit.

---

<div class="post-metadata">

### Author: ![Miiao](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/miiao/32/9577_2.png) [@Miiao](https://internals.rust-lang.org/u/Miiao)
#### Post date: [October 6, 2022, 1:08pm UTC](https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500/3 "2022-10-06T13:08:19Z")

</div>

Use `std` if you don’t need a freestanding binary. Don’t print variables or use native ways (bios api, for example) if you need a freestanding binary.

Also you’ve picked the wrong forum. You need [URLO](https://users.rust-lang.org)

---

<div class="post-metadata">

### Author: ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/system/32/14092_2.png) [@system](https://internals.rust-lang.org/u/system)
#### Post date: [January 4, 2023, 1:08pm UTC](https://internals.rust-lang.org/t/println-in-core-library-and-fast-compile/17500/4 "2023-01-04T13:08:32Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
