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

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

Open
peter-lyons-kehl opened this issue Mar 8, 2023 · 1 comment

Comments

@peter-lyons-kehl
Copy link

peter-lyons-kehl commented Mar 8, 2023

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

@peter-lyons-kehl
Copy link
Author

Related: Debugging alloc, core... in GDB or VS Code: rust-lang/rustc-dev-guide#443.

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

1 participant