Closed
Description
String literals in asm!()
's outputs, inputs, clobbers and options are lexed like usual non-raw strings (asm!("something" : "outputs" : "inputs" : "clobbers" : "options")
).
String literals in ABI specifications are also lexed like usual non-raw strings (extern "C" fn f();
).
In particular, all escapes are checked for correctness and corresponding errors are reported.
However, during parsing strings from those literals are directly transplanted into AST.
Directly means all those sweet \r\n
s are preserved, that's even raw-er than raw string literals!
That's not good.
Proposed solutions:
- Alternative 1: Treat them as usual non-raw literals and escape properly.
That would meanextern "\x43" fn f();
being legal code.
This is slightly weird, butextern r#"C"# fn f() {}
is already accepted, if we are talking about weird. - Alternative 2: Treat them as implicitly raw during parsing (share the same code path with raw literals), but not during lexing (cannot do that without an explicit lexical marker).
This is slightly weird because lexing errors about escaping make no sense if the escaping is not even used.
I tend to prefer the first alternative for simplicity/consistency - "..."
means non-raw, r"..."
means raw, end of the story.