C string literals can't just use a trivial conversion from regular string or byte literals #106479
Labels
F-c_str_literals
`#![feature(c_str_literals)]`
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Initial comment
In the "Rationale and alternatives" section of RFC 3348, it mentions a hypothetical
FromStringLiteral
. While I like the idea, it couldn't be as simple as aFrom<&'static str>
/TryFrom<&'static str>
: error messages would need at least a character offset + string message to be more useful than just "hey, this string contains a problem character". Also,&CStr
s are really more like byte string literals, and that offset would have to be a byte offset, not achar
offset, too.This probably could justify the existence of such a trait, though. C string literals in particular wouldn't push the boundaries much, but I could see other things like regular expressions benefitting a ton from it.
The text was updated successfully, but these errors were encountered: