From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/extenv/extenv-arg-2-not-string-literal.rs | 1 + .../extenv/extenv-arg-2-not-string-literal.stderr | 8 +++++ src/test/ui/extenv/extenv-no-args.rs | 1 + src/test/ui/extenv/extenv-no-args.stderr | 8 +++++ src/test/ui/extenv/extenv-not-defined-custom.rs | 1 + .../ui/extenv/extenv-not-defined-custom.stderr | 10 ++++++ src/test/ui/extenv/extenv-not-defined-default.rs | 4 +++ .../ui/extenv/extenv-not-defined-default.stderr | 10 ++++++ src/test/ui/extenv/extenv-not-string-literal.rs | 1 + .../ui/extenv/extenv-not-string-literal.stderr | 8 +++++ src/test/ui/extenv/extenv-too-many-args.rs | 1 + src/test/ui/extenv/extenv-too-many-args.stderr | 8 +++++ src/test/ui/extenv/issue-55897.rs | 20 +++++++++++ src/test/ui/extenv/issue-55897.stderr | 40 ++++++++++++++++++++++ 14 files changed, 121 insertions(+) create mode 100644 src/test/ui/extenv/extenv-arg-2-not-string-literal.rs create mode 100644 src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr create mode 100644 src/test/ui/extenv/extenv-no-args.rs create mode 100644 src/test/ui/extenv/extenv-no-args.stderr create mode 100644 src/test/ui/extenv/extenv-not-defined-custom.rs create mode 100644 src/test/ui/extenv/extenv-not-defined-custom.stderr create mode 100644 src/test/ui/extenv/extenv-not-defined-default.rs create mode 100644 src/test/ui/extenv/extenv-not-defined-default.stderr create mode 100644 src/test/ui/extenv/extenv-not-string-literal.rs create mode 100644 src/test/ui/extenv/extenv-not-string-literal.stderr create mode 100644 src/test/ui/extenv/extenv-too-many-args.rs create mode 100644 src/test/ui/extenv/extenv-too-many-args.stderr create mode 100644 src/test/ui/extenv/issue-55897.rs create mode 100644 src/test/ui/extenv/issue-55897.stderr (limited to 'src/test/ui/extenv') diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs b/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs new file mode 100644 index 000000000..66dced478 --- /dev/null +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs @@ -0,0 +1 @@ +fn main() { env!("one", 10); } //~ ERROR: expected string literal diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr new file mode 100644 index 000000000..258e2b347 --- /dev/null +++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr @@ -0,0 +1,8 @@ +error: expected string literal + --> $DIR/extenv-arg-2-not-string-literal.rs:1:25 + | +LL | fn main() { env!("one", 10); } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/extenv/extenv-no-args.rs b/src/test/ui/extenv/extenv-no-args.rs new file mode 100644 index 000000000..9f221ed10 --- /dev/null +++ b/src/test/ui/extenv/extenv-no-args.rs @@ -0,0 +1 @@ +fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments diff --git a/src/test/ui/extenv/extenv-no-args.stderr b/src/test/ui/extenv/extenv-no-args.stderr new file mode 100644 index 000000000..318ed635b --- /dev/null +++ b/src/test/ui/extenv/extenv-no-args.stderr @@ -0,0 +1,8 @@ +error: env! takes 1 or 2 arguments + --> $DIR/extenv-no-args.rs:1:13 + | +LL | fn main() { env!(); } + | ^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/extenv/extenv-not-defined-custom.rs b/src/test/ui/extenv/extenv-not-defined-custom.rs new file mode 100644 index 000000000..30b72783f --- /dev/null +++ b/src/test/ui/extenv/extenv-not-defined-custom.rs @@ -0,0 +1 @@ +fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message diff --git a/src/test/ui/extenv/extenv-not-defined-custom.stderr b/src/test/ui/extenv/extenv-not-defined-custom.stderr new file mode 100644 index 000000000..e7da4e046 --- /dev/null +++ b/src/test/ui/extenv/extenv-not-defined-custom.stderr @@ -0,0 +1,10 @@ +error: my error message + --> $DIR/extenv-not-defined-custom.rs:1:13 + | +LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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/src/test/ui/extenv/extenv-not-defined-default.rs b/src/test/ui/extenv/extenv-not-defined-default.rs new file mode 100644 index 000000000..30a06a254 --- /dev/null +++ b/src/test/ui/extenv/extenv-not-defined-default.rs @@ -0,0 +1,4 @@ +fn main() { + env!("__HOPEFULLY_NOT_DEFINED__"); + //~^ ERROR: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined +} diff --git a/src/test/ui/extenv/extenv-not-defined-default.stderr b/src/test/ui/extenv/extenv-not-defined-default.stderr new file mode 100644 index 000000000..884875dca --- /dev/null +++ b/src/test/ui/extenv/extenv-not-defined-default.stderr @@ -0,0 +1,10 @@ +error: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined + --> $DIR/extenv-not-defined-default.rs:2:5 + | +LL | env!("__HOPEFULLY_NOT_DEFINED__"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = 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/src/test/ui/extenv/extenv-not-string-literal.rs b/src/test/ui/extenv/extenv-not-string-literal.rs new file mode 100644 index 000000000..3eaa0b5da --- /dev/null +++ b/src/test/ui/extenv/extenv-not-string-literal.rs @@ -0,0 +1 @@ +fn main() { env!(10, "two"); } //~ ERROR: expected string literal diff --git a/src/test/ui/extenv/extenv-not-string-literal.stderr b/src/test/ui/extenv/extenv-not-string-literal.stderr new file mode 100644 index 000000000..342a9f709 --- /dev/null +++ b/src/test/ui/extenv/extenv-not-string-literal.stderr @@ -0,0 +1,8 @@ +error: expected string literal + --> $DIR/extenv-not-string-literal.rs:1:18 + | +LL | fn main() { env!(10, "two"); } + | ^^ + +error: aborting due to previous error + diff --git a/src/test/ui/extenv/extenv-too-many-args.rs b/src/test/ui/extenv/extenv-too-many-args.rs new file mode 100644 index 000000000..1adbee583 --- /dev/null +++ b/src/test/ui/extenv/extenv-too-many-args.rs @@ -0,0 +1 @@ +fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments diff --git a/src/test/ui/extenv/extenv-too-many-args.stderr b/src/test/ui/extenv/extenv-too-many-args.stderr new file mode 100644 index 000000000..54150a332 --- /dev/null +++ b/src/test/ui/extenv/extenv-too-many-args.stderr @@ -0,0 +1,8 @@ +error: env! takes 1 or 2 arguments + --> $DIR/extenv-too-many-args.rs:1:13 + | +LL | fn main() { env!("one", "two", "three"); } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/extenv/issue-55897.rs b/src/test/ui/extenv/issue-55897.rs new file mode 100644 index 000000000..64c4107e8 --- /dev/null +++ b/src/test/ui/extenv/issue-55897.rs @@ -0,0 +1,20 @@ +use prelude::*; //~ ERROR unresolved import `prelude` + +mod unresolved_env { + use env; //~ ERROR unresolved import `env` + + include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + //~^ ERROR cannot determine resolution for the macro `env` +} + +mod nonexistent_env { + include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + //~^ ERROR environment variable `NON_EXISTENT` not defined +} + +mod erroneous_literal { + include!(concat!("NON_EXISTENT"suffix, "/data.rs")); + //~^ ERROR suffixes on a string literal are invalid +} + +fn main() {} diff --git a/src/test/ui/extenv/issue-55897.stderr b/src/test/ui/extenv/issue-55897.stderr new file mode 100644 index 000000000..d2ac0b830 --- /dev/null +++ b/src/test/ui/extenv/issue-55897.stderr @@ -0,0 +1,40 @@ +error: environment variable `NON_EXISTENT` not defined + --> $DIR/issue-55897.rs:11:22 + | +LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: suffixes on a string literal are invalid + --> $DIR/issue-55897.rs:16:22 + | +LL | include!(concat!("NON_EXISTENT"suffix, "/data.rs")); + | ^^^^^^^^^^^^^^^^^^^^ invalid suffix `suffix` + +error[E0432]: unresolved import `prelude` + --> $DIR/issue-55897.rs:1:5 + | +LL | use prelude::*; + | ^^^^^^^ + | | + | unresolved import + | help: a similar path exists: `std::prelude` + +error[E0432]: unresolved import `env` + --> $DIR/issue-55897.rs:4:9 + | +LL | use env; + | ^^^ no `env` in the root + +error: cannot determine resolution for the macro `env` + --> $DIR/issue-55897.rs:6:22 + | +LL | include!(concat!(env!("NON_EXISTENT"), "/data.rs")); + | ^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0432`. -- cgit v1.2.3