You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error[E0308]: mismatched types
--> bug.rs:2:19
|
2 | let _: &str = include_bytes!("bug.rs");
| ^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected str, found array of 58 elements
| help: consider removing the leading `b`: `nclude_bytes!("bug.rs")`
|
= note: expected type `&str`
found type `&'static [u8; 58]`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0308`.
The compiler (correctly) complains about a type mismatch, but suggests something that isn't applicable, as there is no literal to remove the b from.
Suggestion: define a special case for the include_bytes! and include_str! macros. The compiler should suggest replacing the former with the latter.
The text was updated successfully, but these errors were encountered:
ghost
changed the title
E0308 shows an incorrect suggestion if include_bytes! is used where a &str is expected
E0308 shows an incorrect suggestion if include_bytes! is used where a &str is expected
Jun 14, 2018
ghost
changed the title
E0308 shows an incorrect suggestion if include_bytes! is used where a &str is expected
E0308 shows an incorrect suggestion if include_bytes! is used where &str is expected
Jun 14, 2018
playground link
The compiler (correctly) complains about a type mismatch, but suggests something that isn't applicable, as there is no literal to remove the
b
from.Suggestion: define a special case for the
include_bytes!
andinclude_str!
macros. The compiler should suggest replacing the former with the latter.Meta
Rustc version:
The text was updated successfully, but these errors were encountered: