Closed
Description
use std::time::SystemTime;
fn main() {
println!("Hello, {:?}!". SystemTime::now());
}
says:
error: expected token: `,`
--> src/main.rs:4:40
|
4 | println!("Hello, {:?}!". SystemTime::now());
| ^^ expected `,`
... which isn't exactly where the ,
was expected.
Another variation is this code:
fn random_xkcd_number () -> i32 {
4
}
fn main() {
println!("Hello, {}!". random_xkcd_number());
}
which gives this result:
error: format argument must be a string literal
--> src/main.rs:6:14
|
6 | println!("Hello, {}!". random_xkcd_number());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: you might be missing a string literal to format with
|
6 | println!("{}", "Hello, {}!". random_xkcd_number());
| ^^^^^
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTCategory: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that doesn't give enough information about the problem at hand.Relevant to the compiler team, which will review and decide on the PR/issue.