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

Experiment: Reserve guarded string literal syntax (RFC 3593) on all editions #124605

Closed
wants to merge 1 commit into from

Conversation

pitaj
Copy link
Contributor

@pitaj pitaj commented May 2, 2024

Purpose: crater run to see if we even need to make this change on an edition boundary.

This syntax change applies to all editions, because the particular syntax #"foo"# is unlikely to exist in the wild.

Subset of #123951

Tracking issue: #123735
RFC: rust-lang/rfcs#3593

The syntax change applies to all editions, because the
particular syntax `#"foo"#` is unlikely to exist in the wild.
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2024

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 2, 2024
@pitaj pitaj added S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 2, 2024
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-llvm-17 failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
#16 exporting to docker image format
#16 sending tarball 32.7s done
#16 DONE 39.6s
##[endgroup]
Setting extra environment values for docker:  --env ENABLE_GCC_CODEGEN=1 --env GCC_EXEC_PREFIX=/usr/lib/gcc/
[CI_JOB_NAME=x86_64-gnu-llvm-17]
---
sccache: Starting the server...
##[group]Configure the build
configure: processing command line
configure: 
configure: build.configure-args := ['--build=x86_64-unknown-linux-gnu', '--llvm-root=/usr/lib/llvm-17', '--enable-llvm-link-shared', '--set', 'rust.thin-lto-import-instr-limit=10', '--set', 'change-id=99999999', '--enable-verbose-configure', '--enable-sccache', '--disable-manage-submodules', '--enable-locked-deps', '--enable-cargo-native-static', '--set', 'rust.codegen-units-std=1', '--set', 'dist.compression-profile=balanced', '--dist-compression-formats=xz', '--disable-dist-src', '--release-channel=nightly', '--enable-debug-assertions', '--enable-overflow-checks', '--enable-llvm-assertions', '--set', 'rust.verify-llvm-ir', '--set', 'rust.codegen-backends=llvm,cranelift,gcc', '--set', 'llvm.static-libstdcpp', '--enable-new-symbol-mangling']
configure: target.x86_64-unknown-linux-gnu.llvm-config := /usr/lib/llvm-17/bin/llvm-config
configure: llvm.link-shared     := True
configure: rust.thin-lto-import-instr-limit := 10
configure: change-id            := 99999999
---

+ error: invalid string literal
+   --> $DIR/edition-cstr-2015-2018.rs:47:7
+    |
+ LL |     cr##"str"##;
+    |
+    |
+    = note: unprefixed guarded string literals are reserved for future use
+ help: consider inserting whitespace here
+    |
+ LL |     cr## "str"##;
+ 
+ 
1 error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
3    |

20    = help: pass `--edition 2021` to `rustc`
21    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
21    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
22 
- error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `#`
+ error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
25    |
25    |
26 LL |     cr##"str"##;
-    |       ^ expected one of 8 possible tokens
+    |       ^^^^^^^^^ expected one of 8 possible tokens
28    |
29    = note: you may be trying to write a c-string literal
29    = note: you may be trying to write a c-string literal
30    = note: c-string literals require Rust 2021 or later
63    = note: for more on editions, read https://doc.rust-lang.org/edition-guide
64    = note: this error originates in the macro `contain` (in Nightly builds, run with -Z macro-backtrace for more info)
65 
- error: aborting due to 6 previous errors
---
To only update this specific test, also pass `--test-args editions/edition-cstr-2015-2018.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/editions/edition-cstr-2015-2018.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/editions/edition-cstr-2015-2018" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/editions/edition-cstr-2015-2018/auxiliary"
--- stderr -------------------------------
error: invalid string literal
##[error]  --> /checkout/tests/ui/editions/edition-cstr-2015-2018.rs:47:7
   |
   |
LL |     cr##"str"##;
   |
   |
   = note: unprefixed guarded string literals are reserved for future use
   |
   |
LL |     cr## "str"##;


error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
   |
LL |     c"str";
   |
   = note: you may be trying to write a c-string literal
   = note: you may be trying to write a c-string literal
   = note: c-string literals require Rust 2021 or later
   = help: pass `--edition 2021` to `rustc`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
   |
LL |     cr"str";
   |
   = note: you may be trying to write a c-string literal
   = note: you may be trying to write a c-string literal
   = note: c-string literals require Rust 2021 or later
   = help: pass `--edition 2021` to `rustc`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
   |
LL |     cr##"str"##;
   |
   = note: you may be trying to write a c-string literal
   = note: you may be trying to write a c-string literal
   = note: c-string literals require Rust 2021 or later
   = help: pass `--edition 2021` to `rustc`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
LL |     c "str";
   |       ^^^^^ expected one of 8 possible tokens


error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
   |
LL | macro_rules! construct { ($x:ident) => { $x"str" } }
...
...
LL |     construct!(c); //~ NOTE in this expansion of construct!
   |
   = note: this error originates in the macro `construct` (in Nightly builds, run with -Z macro-backtrace for more info)


error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `"str"`
   |
   |
LL | macro_rules! contain { () => { c"str" } }
...
LL |     contain!();
   |     ---------- in this macro invocation
   |
   |
   = note: you may be trying to write a c-string literal
   = note: c-string literals require Rust 2021 or later
   = help: pass `--edition 2021` to `rustc`
   = note: for more on editions, read https://doc.rust-lang.org/edition-guide
   = note: this error originates in the macro `contain` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 7 previous errors
------------------------------------------



---- [ui] tests/ui/rust-2021/reserved-prefixes-via-macro.rs stdout ----

error: test compilation failed although it shouldn't!
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/rust-2021/reserved-prefixes-via-macro.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "-O" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2021/reserved-prefixes-via-macro/a" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2021/reserved-prefixes-via-macro/auxiliary" "--edition=2021"
--- stderr -------------------------------
error: invalid string literal
##[error]  --> /checkout/tests/ui/rust-2021/reserved-prefixes-via-macro.rs:11:16
   |
   |
LL |     assert_eq!(m2018::number_of_tokens_in_a_prefixed_string_literal!(), 3);
   |
   |
   = note: unprefixed guarded string literals are reserved for future use
   = note: this error originates in the macro `m2018::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 1 previous error
------------------------------------------



---- [ui] tests/ui/rust-2021/reserved-prefixes-via-macro-2.rs stdout ----
diff of stderr:

+ error: invalid string literal
+   --> $DIR/reserved-prefixes-via-macro-2.rs:12:5
+    |
+ LL |     m2018::number_of_tokens_in_a_prefixed_string_literal!();
+    |
+    |
+    = note: unprefixed guarded string literals are reserved for future use
+    = note: this error originates in the macro `m2018::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ 
1 error: prefix `hey` is unknown
3    |

25    = note: prefixed identifiers and literals are reserved since Rust 2021
25    = note: prefixed identifiers and literals are reserved since Rust 2021
26    = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
- error: aborting due to 3 previous errors
+ error: invalid string literal
+   --> $DIR/reserved-prefixes-via-macro-2.rs:19:5
+    |
+    |
+ LL |     m2021::number_of_tokens_in_a_prefixed_string_literal!();
+    |
+    |
+    = note: unprefixed guarded string literals are reserved for future use
+    = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
+ error: aborting due to 5 previous errors
29 
30 

---
To only update this specific test, also pass `--test-args rust-2021/reserved-prefixes-via-macro-2.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/rust-2021/reserved-prefixes-via-macro-2.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2021/reserved-prefixes-via-macro-2" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/rust-2021/reserved-prefixes-via-macro-2/auxiliary" "--edition=2018"
--- stderr -------------------------------
error: invalid string literal
##[error]  --> /checkout/tests/ui/rust-2021/reserved-prefixes-via-macro-2.rs:12:5
   |
   |
LL |     m2018::number_of_tokens_in_a_prefixed_string_literal!();
   |
   |
   = note: unprefixed guarded string literals are reserved for future use
   = note: this error originates in the macro `m2018::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: prefix `hey` is unknown
   |
   |
LL |     m2021::number_of_tokens_in_a_prefixed_integer_literal!();
   |
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_integer_literal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: prefix `hey` is unknown
   |
   |
LL |     m2021::number_of_tokens_in_a_prefixed_char_literal!();
   |
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_char_literal` (in Nightly builds, run with -Z macro-backtrace for more info)

error: prefix `hey` is unknown
   |
   |
LL |     m2021::number_of_tokens_in_a_prefixed_string_literal!();
   |
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: prefixed identifiers and literals are reserved since Rust 2021
   = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: invalid string literal
##[error]  --> /checkout/tests/ui/rust-2021/reserved-prefixes-via-macro-2.rs:19:5
   |
   |
LL |     m2021::number_of_tokens_in_a_prefixed_string_literal!();
   |
   |
   = note: unprefixed guarded string literals are reserved for future use
   = note: this error originates in the macro `m2021::number_of_tokens_in_a_prefixed_string_literal` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 5 previous errors
------------------------------------------


@ehuss
Copy link
Contributor

ehuss commented May 14, 2024

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request May 14, 2024
Experiment: Reserve guarded string literal syntax (RFC 3593) on all editions

Purpose: crater run to see if we even need to make this change on an edition boundary.

This syntax change applies to all editions, because the particular syntax `#"foo"#` is unlikely to exist in the wild.

Subset of rust-lang#123951

Tracking issue: rust-lang#123735
RFC: rust-lang/rfcs#3593
@bors
Copy link
Contributor

bors commented May 14, 2024

⌛ Trying commit b64c7f4 with merge fcc50f7...

@bors
Copy link
Contributor

bors commented May 14, 2024

☀️ Try build successful - checks-actions
Build commit: fcc50f7 (fcc50f77e1a14e407d895972348a0ff09eafc210)

@ehuss
Copy link
Contributor

ehuss commented May 14, 2024

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-124605 created and queued.
🤖 Automatically detected try build fcc50f7
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-experimental Status: Ongoing experiment that does not require reviewing and won't be merged in its current state. labels May 14, 2024
@craterbot
Copy link
Collaborator

🚧 Experiment pr-124605 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot
Copy link
Collaborator

🎉 Experiment pr-124605 is completed!
📊 31 regressed and 3 fixed (462054 total)
📰 Open the full report.

⚠️ If you notice any spurious failure please add them to the blacklist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels May 19, 2024
@pitaj pitaj closed this May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants