Skip to content

Nonsense suggestion for concat!(x) #52347

Closed
@ollie27

Description

@ollie27

The error for concat!(x) is:

error: expected a literal
 --> src/main.rs:2:13
  |
2 |     concat!(x);
  |             ^
help: you might be missing a string literal to format with
  |
2 |     concat!("{}", x);
  |             ^^^^^^^

That suggestion will clearly not work and gets worse when there are more arguments:

error: expected a literal
 --> src/main.rs:2:13
  |
2 |     concat!(x, y, z);
  |             ^
help: you might be missing a string literal to format with
  |
2 |     concat!("{}", x, y, z);
  |             ^^^^^^^

error: expected a literal
 --> src/main.rs:2:16
  |
2 |     concat!(x, y, z);
  |                ^
help: you might be missing a string literal to format with
  |
2 |     concat!(x, "{}", y, z);
  |                ^^^^^^^

error: expected a literal
 --> src/main.rs:2:19
  |
2 |     concat!(x, y, z);
  |                   ^
help: you might be missing a string literal to format with
  |
2 |     concat!(x, y, "{}", z);
  |                   ^^^^^^^

This suggestion was added by #51614. cc. @csmoe, @estebank

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions