rust-lang / rust-lang/std-dev-guide

Println-debugging alloc and core > format! - instruction incomplete

Open
#53 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
90
Forks
47
Avg merge
9h 22m
Merged PRs (30d)
1

Description

Thank you for this guide (and, of course, for core, alloc, std).

std-dev-guide.rust-lang.org/development/building-and-debugging.html#println-debugging-alloc-and-core suggests to use format!. But format is not available under core (at least not as std::format!, nor as core::format! - and I thought that format! generates String, which, of course, requires alloc, so format! can't be under core).

Would it work as alloc::format! with #[uses_alloc] or (whatever that is), or how?

If all that people need to debug are tests, or alloc/core functionality invoked from tests, how about mentioning something like the following (if it works):

/// inside (the body of) a non-test core or alloc function:
#[cfg(test)]
{
    use std::format;
    ...
}

Or, could we mention 3rd party #[no_std] (limited) heap-less formatting crates (there is at least one).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Println-debugging alloc and core section of building-and-debugging.html and verify the available formatting macros in core, alloc, and test contexts. Update the guidance so the example is accurate for core and alloc debugging, including any necessary cfg(test) usage; done means the instructions no longer suggest an unavailable format! path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.