Skip to content

Unexpected truncated boolean when debug printing with limited float precision. #78384

Open
@CasperN

Description

@CasperN

I tried this code

fn main() {                                                                                                                                                                                                                                                                                                                                                                 
    println!("Hello, world! {:.3?}", false);                                                                                                                                                                                                                                                                                                                                
} 

Actual output

Hello, world! fal

Expected output, because a boolean isn't a decimal....

Hello, world! false

Version stuff:

$ rustc --version --verbose
rustc 1.40.0 (73528e339 2019-12-16)
binary: rustc
commit-hash: 73528e339aae0f17a15ffa49a8ac608f50c6cf14
commit-date: 2019-12-16
host: x86_64-apple-darwin
release: 1.40.0
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-fmtArea: `core::fmt`T-langRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions