Skip to content

Misleading error in println!/format! invocation #13876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
yuriks opened this issue May 1, 2014 · 1 comment
Closed

Misleading error in println!/format! invocation #13876

yuriks opened this issue May 1, 2014 · 1 comment

Comments

@yuriks
Copy link
Contributor

yuriks commented May 1, 2014

The expression println!(format!("test")) produces the following error:

<anon>:18:18: 18:24 error: macro undefined: 'format'
<anon>:18         println!(format!("test"))
                           ^~~~~~
<anon>:18:18: 18:33 error: format argument must be a string literal.
<anon>:18         println!(format!("test"))
                           ^~~~~~~~~~~~~~~
error: aborting due to 2 previous errors

The macro undefined: 'format' error is pretty misleading, implying that the user mispelled format! or that it has a different name, but in reality it's just complaining because you're supposed to pass a literal to println!. Why does this error get generated and is there a way to make it clearer?

@huonw
Copy link
Member

huonw commented May 18, 2014

Seems to be a bug in how our macros are resolved. Dupe of #12404.

I'll copy the example here to that one though, since that bug doesn't really state what's up very clearly. (Thanks for filing.)

@huonw huonw closed this as completed May 18, 2014
arcnmx pushed a commit to arcnmx/rust that referenced this issue Jan 9, 2023
feat: Package Windows release artifacts as ZIP and add symbols file

Closes rust-lang#13872
Closes rust-lang#7747
CC rust-lang#10371

This allows us to ship a format that's easier to handle on Windows. As a bonus, we can also include the PDB, to get useful stack traces. Unfortunately, it adds a couple of dependencies to `xtask`, increasing the debug build times from 1.28 to 1.58 s (release from 1.60s to 2.20s) on my system.
bors added a commit to rust-lang-ci/rust that referenced this issue Feb 13, 2023
minor: Bump `zip` to avoid `time-macros`

This fixes the compile time regression in rust-lang#13876 and sneaks in two typo fixes spotted by `@cuishuang` (sorry for not preserving the commit attribution, but it's a little hard to manage it across repositories).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants