-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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
Apologies if this has been posted before, I couldn't find anything but many of my searches had several hundred results and I didn't want to go through pages upon pages of them for such a minor issue (yeah, I'm part of the problem, sorry).
If you have an error where you pass a String
instead of a &str
inside a macro, the suggestion rustc
emits is meaningless:
error[E0308]: mismatched types
--> src/tests.rs:1108:1
|
1108 | test_select!(select32, i32);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected &str, found struct `std::string::String`
| help: consider borrowing here: `&test_select!(select32, i32);`
| in this macro invocation
|
= note: expected type `&str`
found type `std::string::String`
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
Note this:
help: consider borrowing here: `&test_select!(select32, i32);`
This is an item-position macro and so this suggestion will only cause a syntax error.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-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.