Skip to content

fmt!("%?", x) is broken with x of type &[char] #4473

@SimonSapin

Description

@SimonSapin

Test case:

fn main() { let x: &[char] = ['a']; io::println(fmt!("%?", x)) }

Expected output: &[97]. Example output (changes on every run): &[42009435899428961].

Output from rustc --version

rustc 0.6 (09bb07b 2012-12-24 18:29:02 -0800)
host: x86_64-unknown-linux-gnu

Output with valgrind:

==12474== Memcheck, a memory error detector
==12474== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==12474== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==12474== Command: ./fmt_char_vector
==12474== 
&[461130830182350945]
==12474== 
==12474== HEAP SUMMARY:
==12474==     in use at exit: 8 bytes in 1 blocks
==12474==   total heap usage: 48 allocs, 47 frees, 1,074,617 bytes allocated
==12474== 
==12474== LEAK SUMMARY:
==12474==    definitely lost: 0 bytes in 0 blocks
==12474==    indirectly lost: 0 bytes in 0 blocks
==12474==      possibly lost: 0 bytes in 0 blocks
==12474==    still reachable: 8 bytes in 1 blocks
==12474==         suppressed: 0 bytes in 0 blocks
==12474== Rerun with --leak-check=full to see details of leaked memory
==12474== 
==12474== For counts of detected and suppressed errors, rerun with: -v
==12474== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

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