Skip to content

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

Open
@peter-lyons-kehl

Description

@peter-lyons-kehl

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions