Skip to content

Wrong formatting with format_args #44538

Closed
@werner-matthias

Description

@werner-matthias

Formating yields incorrect result.
I tried this code at a bare metal Raspberry Pi (no_std):

    let foo: u32 = 13;
    kprint::fkprint(format_args!("foo = {} = {:?} = {:x} = {:b}\n",foo,foo,foo,foo));

kprint::fkprint writes to the frame buffer using the Write trait.

I expected to see this output:

foo = 13 = 13 = d = 1101

Instead, the output is:

foo = 21 = 21 = d = 1101

Meta

I'm using rustc 1.22.0-nightly (dd08c30 2017-09-12) with xargo, i.e., core is newly built.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateP-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions