-
Couldn't load subscription status.
- Fork 13.9k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This code:
struct Foo;
impl Display for Foo {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{}", f.fill() as u32)
}
}
fn main() {
println!("{:\t}", Foo)
}Compiles, and prints 32. According to the std::fmt docs,
[[fill]align][sign]['#']['0'][width]['.' precision][type]
is the syntax of format specifications; however, \t does not fulfill any of these elements. I assumed that it might accidentally be implementing the syntax
[fill][align][sign]['#']['0'][width]['.' precision][type]
however, if that were true, then this should print 9 (and not 32). I haven't looked into the parsing code, but will after filing this issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.