Experiment: Reserve guarded string literal syntax (RFC 3593) on all editions by pitaj · Pull Request #124605 · rust-lang/rust (original) (raw)

#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
------------------------------------------