Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upper bound on hashes in raw string literals #1180

Merged
merged 4 commits into from
May 17, 2022
Merged

Upper bound on hashes in raw string literals #1180

merged 4 commits into from
May 17, 2022

Conversation

GrishaVar
Copy link
Contributor

No description provided.

@Havvy
Copy link
Contributor

Havvy commented Mar 20, 2022

Has this been decided upon by the lang team, or is this just what it currently is in rustc?

@ehuss
Copy link
Contributor

ehuss commented Mar 20, 2022

I started a conversation at https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters/near/275921936, which contains some links to the history here.

I don't think this change can be made easily, as we'll probably need to go through some process to decide on an appropriate limit (and to decide how to apply limits to the language in general).

And, BTW, this change just modifies the set of examples. I don't think those are proper definitions. If we do decide to go forward with something like this, the lexer definition and text describing the format will need to be updated.

@GrishaVar
Copy link
Contributor Author

This PR now complies with the recently merged rust-lang/rust#95251. I'm not sure what the protocol is here - perhaps this PR should wait until the other makes it into stable?

@Havvy
Copy link
Contributor

Havvy commented Apr 1, 2022

The reference follows the same train as the compiler. So anything that is merged as stable on the compiler can be documented in the reference repository and it'll show up in the stable docs at the same time. I want to merge this, but @ehuss 's last paragraph still needs to be resolved.

And, BTW, this change just modifies the set of examples. I don't think those are proper definitions. If we do decide to go forward with something like this, the lexer definition and text describing the format will need to be updated.

@GrishaVar
Copy link
Contributor Author

GrishaVar commented Apr 1, 2022

For the formal definitions, both instances of 0 or more were replaced with fewer than 256. I reckon inclusion of zero and exclusion of 256 should be self-evident. Is this enough?

It might be a good idea to also mention the consequence of the upper limit, namely that (~IsolatedCR)* and ASCII* musn't contain more than 254 consecutive hash signs. I think that might need overhauling more definitions though, since the kleene as given can't restrict values in this way.

@pnkfelix
Copy link
Member

pnkfelix commented May 16, 2022

I'm nominating this for lang design team (T-lang) discussion so that we can figure out if we want include this as part of the reference spec (or if we want to encode the limit in some other way. E.g., maybe "implementation defined limit on the number of octothorpes in a raw-string literal")

See also relevant context here: rust-lang/rust#50296 (comment)

and also zulip discussion here: https://rust-lang.zulipchat.com/#narrow/stream/237824-t-lang.2Fdoc/topic/Max.20raw.20string.20delimiters/near/275921936

@pnkfelix
Copy link
Member

Discussed in T-lang triage meeting. General agreement that we prefer a concrete statement "raw strings can have between [0,255] hashmarks", rather than referencing some sort of "implementation-defined bound that must be >= 255".

So, now I'll merge this.

@pnkfelix pnkfelix merged commit 2995104 into rust-lang:master May 17, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request May 25, 2022
Update books

## reference

6 commits in 8e36971959ff238b5aa2575fbc7a2e09e1313e82..b74825d8f88b685e239ade00f00de68ba4cd63d4
2022-05-09 17:20:59 -0700 to 2022-05-20 14:30:30 -0700
- Inline assembly: Clarify references to quoted regs (rust-lang/reference#1191)
- Add tile registers to inline-assembly documentation (rust-lang/reference#1220)
- Upper bound on hashes in raw string literals (rust-lang/reference#1180)
- Remove footnote on warning about lifetime shadowing labels.
- Makes explanation for Spans in "Procedural Macros" clearer (rust-lang/reference#1219)
- Update "Match Expressions" to remove 'cold' (rust-lang/reference#1216)

## book

18 commits in d9415b7cbfcb4b24062683f429bd0ff535396362..b4dd5f00b87190ad5ef42cbc2a88a783c6ae57ef
2022-05-09 09:10:44 -0400 to 2022-05-24 21:37:06 -0400
- Snapshot of appendices for nostarch
- Update rust-analyzer URLs and make links less repetitive
- Correct byte string literal type. Fixes rust-lang/book#2631.
- Fix verb agreement. Fixes rust-lang/book#3176
- Propagate ch19 edits to src
- Edits to chapter 19 from nostarch
- Propagate ch18 edits to src
- Edits to ch18 from nostarch
- Propagate tech review edits to src ch5
- Responses to chapter 5 tech review
- Ch5 after tech review
- Merge branch 'ch7-edits'
- fix: mdBook authors
- Propagating ch17 edits to src
- Edits from nostarch for ch17
- Fix rust-lang/book#3152 - Wrong character used
- & is not valid inside image alt text
- Merge branch 'ch20'

## rust-by-example

2 commits in e9f93cfcf410bc092c9107b8a41a82f144c761f2..2ed26865e8c29ef939dc913a97bd321cadd72a9a
2022-05-08 18:24:06 -0300 to 2022-05-18 17:23:47 -0300
- Rework cpuid asm example. (rust-lang/rust-by-example#1542)
- chore: better description for eprint macro (rust-lang/rust-by-example#1541)

## rustc-dev-guide

11 commits in 0c02acd..554c00e
2022-05-10 09:45:31 -0300 to 2022-05-24 17:15:35 -0700
- Cleanup rustdoc-internals
- Fix some wording on the "Incremental Compilation In Detail" page
- Exclude `tomlee.co` from link-checking (rust-lang/rustc-dev-guide#1356)
- Add note about patching dependencies and warnings. (rust-lang/rustc-dev-guide#1354)
- make sentence more simple (rust-lang/rustc-dev-guide#1353)
- Update some links and docs (rust-lang/rustc-dev-guide#1340)
- Replace a broken YouTube link (rust-lang/rustc-dev-guide#1295)
- Edit the "Compiler Source Code" chapter (rust-lang/rustc-dev-guide#1307)
- Add docs for logging of queries. (rust-lang/rustc-dev-guide#1350)
- Fix configuration names for vscode/r-a (rust-lang/rustc-dev-guide#1352)
- Update docs for deprecated attribute (rust-lang/rustc-dev-guide#1338)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants