rust-lang / rust-lang/fls

CR in string continuation escapes

Open
#605 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
reStructuredText
Stars
497
Forks
41
Avg merge
3h 52m
Merged PRs (30d)
4

Description

Rust accepts the following as a simple string literal, even though it contains a CR:"a\␊␍b" (where ␊ indicates an LF control character and ␍ indicates a CR control character).

The FLS defines StringContinuation in §2.4.6.1:2 (fls_wawtu6j3fiqn) as follows:

StringContinuation is the character sequence 0x5C 0x0A (reverse solidus, new line).

With that definition, the above example would be rejected.

The Reference models this situation by treating all the characters which will be removed by the string continuation escape as part of the escape.

I think it would make sense to look at this together with describing how literals containing StringContinuation are evaluated (#590).

NB the Reference has a note (in expr.literal.continuation) saying that the behaviour of string continuation escapes may change in a backwards-incompatible manner in future.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with FLS §2.4.6.1:2, the Reference's expr.literal.continuation note, and issue #590. Compare the formal StringContinuation definition with the Reference's treatment of removed characters, then clarify the specification consistently with literal evaluation. Done means the CR behavior and any compatibility implications are explicitly described.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.