-
Notifications
You must be signed in to change notification settings - Fork 490
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
Update C-String literals to reject NUL #1450
Conversation
This was the least worse way I could see to do this, but I'm sure there are other possibilities. |
src/tokens.md
Outdated
> | BYTE_ESCAPE _except `\0` or `\x00`\ | ||
> | UNICODE_ESCAPE _except `\u{0}`, `\u{00}`, …, `\u{000000}`\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
> | BYTE_ESCAPE _except `\0` or `\x00`\ | |
> | UNICODE_ESCAPE _except `\u{0}`, `\u{00}`, …, `\u{000000}`\ | |
> | BYTE_ESCAPE <sub>_Except `\0` or `\x00`_</sub>\ | |
> | UNICODE_ESCAPE <sub>_Except `\u{0}`, `\u{00}`, …, `\u{000000}`_</sub>\ |
The italics weren't coming out properly. I've imitated the markup under "Reserved prefixes", which I think is the most similar case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had omitted the trailing _
to close the italics. I've added that instead of using <sub>
, see what you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no objection to that
491d7e3
to
14f1c05
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
src/tokens.md
Outdated
> ~\[`"` `\` _IsolatedCR_]\ | ||
> | BYTE_ESCAPE\ | ||
> | UNICODE_ESCAPE\ | ||
> ~\[`"` `\` _IsolatedCR_ _ZeroByte_]\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ZeroByte doesn't seem to be defined anywhere, and I think could be confused with DIGIT ZERO. Could we use a different term here? Perhaps just Null?
> ~\[`"` `\` _IsolatedCR_ _ZeroByte_]\ | |
> ~\[`"` `\` _IsolatedCR_ _Null_]\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't define ZeroByte because IsolatedCR also isn't defined. I have changed ZeroByte to Nul. (Not Null, because that tends to be used for the zero pointer while Nul tends to be used for the zero character.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what it's worth, the IsolatedCR
definition is hiding in the "Comments" chapter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed it from "Nul" to "NUL", because "NUL" is defined earlier in the sentence "The null escape is the character U+0030 (0) and denotes the Unicode value U+0000 (NUL)." which I hope is good enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I don't know if the world has an agreement if it is NULL or NUL. They seem to be used interchangeably, and I don't think there is any ambiguity what either spellings mean here, which means I think it is largely a matter of personal preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking some more, I suspect "null" is the proper word, and NUL is an ASCII-ism (because the control chars all have two or three letter abbreviations) that has crept into ordinary use, including Unicode names.
14f1c05
to
028f106
Compare
Which moved the checking for NUL chars in C string literals earlier.
028f106
to
a393aaf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Update books ## rust-lang/edition-guide 1 commits in bbffb074e16bef89772818b400b6c76a65eac126..baafacc6d8701269dab1e1e333f3547fb54b5a59 2024-01-18 18:44:06 UTC to 2024-01-18 18:44:06 UTC - Update c-string literal stabilization release number. (rust-lang/edition-guide#289) ## rust-embedded/book 1 commits in 3f9df2b9885c6741365da2e12ed6662cd0e827d6..2e95fc2fd31d669947e993aa07ef10dc9828bee7 2024-01-29 07:19:07 UTC to 2024-01-29 07:19:07 UTC - Mention generics in "optimizing dependencies" (rust-embedded/book#366) ## rust-lang/reference 3 commits in 8c77e8be9da1a9c70545556218d563c8d061f1fd..a0b119535e7740f68494c4f0582f7ad008b00ccd 2024-01-27 19:22:06 UTC to 2024-01-27 16:43:49 UTC - Update C-String literals to reject NUL (rust-lang/reference#1450) - pure asm blocks must terminate (rust-lang/reference#1442) - String literal expressions (rust-lang/reference#1452) ## rust-lang/rust-by-example 4 commits in ddf5cb0e6ee54ba2dd84c8ca3e1314120014e20d..179256a445d6144f5f371fdefb993f48f33978b0 2024-01-22 12:21:42 UTC to 2024-01-20 23:10:42 UTC - Updated first sentence of "parsing a string" in string.md (rust-lang/rust-by-example#1805) - Update the rustdoc example to match best practice (rust-lang/rust-by-example#1804) - Add reference to crates.io error handling crates (rust-lang/rust-by-example#1803) - fix(str.md): avoid misunderstanding that there were only two string types (rust-lang/rust-by-example#1802) ## rust-lang/rustc-dev-guide 15 commits in 4af29d1a7f64f88a36539662c6a84fe1fbe6cde1..ec287e332777627185be4798ad22599ffe7b84aa 2024-01-28 22:45:18 UTC to 2024-01-15 17:44:49 UTC - Upgrade actions to use Node.js v20 (rust-lang/rustc-dev-guide#1863) - Fix some links (rust-lang/rustc-dev-guide#1865) - Add link in salsa (rust-lang/rustc-dev-guide#1866) - Clarify what rt.rs is. (rust-lang/rustc-dev-guide#1876) - update link to rustc dependencies (rust-lang/rustc-dev-guide#1869) - Followup to rust-lang#1862 (rust-lang/rustc-dev-guide#1864) - Clarify debugging graph dependency (rust-lang/rustc-dev-guide#1862) - Get diagnostics directly in `rustc-driver-getting-diagnostics` example (rust-lang/rustc-dev-guide#1857) - Update examples (rust-lang/rustc-dev-guide#1856) - Add a perf. bot command and a link to its help page (rust-lang/rustc-dev-guide#1855) - Add some explanations for frequently used rustbot commands (rust-lang/rustc-dev-guide#1849) - update some of the diagnostic translations info (rust-lang/rustc-dev-guide#1711) - Document unsafety checking (rust-lang/rustc-dev-guide#1847) - Remove outdated references to `-Z dump-mir-spanview` (rust-lang/rustc-dev-guide#1853) - update old bootstrap docs (rust-lang/rustc-dev-guide#1852)
Rollup merge of rust-lang#120467 - rustbot:docs-update, r=ehuss Update books ## rust-lang/edition-guide 1 commits in bbffb074e16bef89772818b400b6c76a65eac126..baafacc6d8701269dab1e1e333f3547fb54b5a59 2024-01-18 18:44:06 UTC to 2024-01-18 18:44:06 UTC - Update c-string literal stabilization release number. (rust-lang/edition-guide#289) ## rust-embedded/book 1 commits in 3f9df2b9885c6741365da2e12ed6662cd0e827d6..2e95fc2fd31d669947e993aa07ef10dc9828bee7 2024-01-29 07:19:07 UTC to 2024-01-29 07:19:07 UTC - Mention generics in "optimizing dependencies" (rust-embedded/book#366) ## rust-lang/reference 3 commits in 8c77e8be9da1a9c70545556218d563c8d061f1fd..a0b119535e7740f68494c4f0582f7ad008b00ccd 2024-01-27 19:22:06 UTC to 2024-01-27 16:43:49 UTC - Update C-String literals to reject NUL (rust-lang/reference#1450) - pure asm blocks must terminate (rust-lang/reference#1442) - String literal expressions (rust-lang/reference#1452) ## rust-lang/rust-by-example 4 commits in ddf5cb0e6ee54ba2dd84c8ca3e1314120014e20d..179256a445d6144f5f371fdefb993f48f33978b0 2024-01-22 12:21:42 UTC to 2024-01-20 23:10:42 UTC - Updated first sentence of "parsing a string" in string.md (rust-lang/rust-by-example#1805) - Update the rustdoc example to match best practice (rust-lang/rust-by-example#1804) - Add reference to crates.io error handling crates (rust-lang/rust-by-example#1803) - fix(str.md): avoid misunderstanding that there were only two string types (rust-lang/rust-by-example#1802) ## rust-lang/rustc-dev-guide 15 commits in 4af29d1a7f64f88a36539662c6a84fe1fbe6cde1..ec287e332777627185be4798ad22599ffe7b84aa 2024-01-28 22:45:18 UTC to 2024-01-15 17:44:49 UTC - Upgrade actions to use Node.js v20 (rust-lang/rustc-dev-guide#1863) - Fix some links (rust-lang/rustc-dev-guide#1865) - Add link in salsa (rust-lang/rustc-dev-guide#1866) - Clarify what rt.rs is. (rust-lang/rustc-dev-guide#1876) - update link to rustc dependencies (rust-lang/rustc-dev-guide#1869) - Followup to rust-lang#1862 (rust-lang/rustc-dev-guide#1864) - Clarify debugging graph dependency (rust-lang/rustc-dev-guide#1862) - Get diagnostics directly in `rustc-driver-getting-diagnostics` example (rust-lang/rustc-dev-guide#1857) - Update examples (rust-lang/rustc-dev-guide#1856) - Add a perf. bot command and a link to its help page (rust-lang/rustc-dev-guide#1855) - Add some explanations for frequently used rustbot commands (rust-lang/rustc-dev-guide#1849) - update some of the diagnostic translations info (rust-lang/rustc-dev-guide#1711) - Document unsafety checking (rust-lang/rustc-dev-guide#1847) - Remove outdated references to `-Z dump-mir-spanview` (rust-lang/rustc-dev-guide#1853) - update old bootstrap docs (rust-lang/rustc-dev-guide#1852)
Which moved the checking for NUL chars in C string literals earlier.
See rust-lang/rust#119172