summaryrefslogtreecommitdiffstats
path: root/tests/ui/extenv
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:42 +0000
commit837b550238aa671a591ccf282dddeab29cadb206 (patch)
tree914b6b8862bace72bd3245ca184d374b08d8a672 /tests/ui/extenv
parentAdding debian version 1.70.0+dfsg2-1. (diff)
downloadrustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz
rustc-837b550238aa671a591ccf282dddeab29cadb206.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/extenv')
-rw-r--r--tests/ui/extenv/extenv-escaped-var.rs3
-rw-r--r--tests/ui/extenv/extenv-escaped-var.stderr11
-rw-r--r--tests/ui/extenv/issue-110547.rs7
-rw-r--r--tests/ui/extenv/issue-110547.stderr29
4 files changed, 50 insertions, 0 deletions
diff --git a/tests/ui/extenv/extenv-escaped-var.rs b/tests/ui/extenv/extenv-escaped-var.rs
new file mode 100644
index 000000000..d898feb78
--- /dev/null
+++ b/tests/ui/extenv/extenv-escaped-var.rs
@@ -0,0 +1,3 @@
+fn main() {
+ env!("\t"); //~ERROR environment variable `\t` not defined at compile time
+}
diff --git a/tests/ui/extenv/extenv-escaped-var.stderr b/tests/ui/extenv/extenv-escaped-var.stderr
new file mode 100644
index 000000000..25e218c63
--- /dev/null
+++ b/tests/ui/extenv/extenv-escaped-var.stderr
@@ -0,0 +1,11 @@
+error: environment variable `\t` not defined at compile time
+ --> $DIR/extenv-escaped-var.rs:2:5
+ |
+LL | env!("\t");
+ | ^^^^^^^^^^
+ |
+ = help: use `std::env::var("\t")` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/extenv/issue-110547.rs b/tests/ui/extenv/issue-110547.rs
new file mode 100644
index 000000000..a6fb96ac0
--- /dev/null
+++ b/tests/ui/extenv/issue-110547.rs
@@ -0,0 +1,7 @@
+// compile-flags: -C debug-assertions
+
+fn main() {
+ env!{"\t"}; //~ ERROR not defined at compile time
+ env!("\t"); //~ ERROR not defined at compile time
+ env!("\u{2069}"); //~ ERROR not defined at compile time
+}
diff --git a/tests/ui/extenv/issue-110547.stderr b/tests/ui/extenv/issue-110547.stderr
new file mode 100644
index 000000000..10589ec2f
--- /dev/null
+++ b/tests/ui/extenv/issue-110547.stderr
@@ -0,0 +1,29 @@
+error: environment variable `\t` not defined at compile time
+ --> $DIR/issue-110547.rs:4:5
+ |
+LL | env!{"\t"};
+ | ^^^^^^^^^^
+ |
+ = help: use `std::env::var("\t")` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: environment variable `\t` not defined at compile time
+ --> $DIR/issue-110547.rs:5:5
+ |
+LL | env!("\t");
+ | ^^^^^^^^^^
+ |
+ = help: use `std::env::var("\t")` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: environment variable `\u{2069}` not defined at compile time
+ --> $DIR/issue-110547.rs:6:5
+ |
+LL | env!("\u{2069}");
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: use `std::env::var("\u{2069}")` to read the variable at run time
+ = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
+