summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/macros')
-rw-r--r--tests/ui/macros/assert-eq-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-eq-macro-panic.rs6
-rw-r--r--tests/ui/macros/assert-macro-explicit.rs2
-rw-r--r--tests/ui/macros/assert-macro-fmt.rs3
-rw-r--r--tests/ui/macros/assert-macro-owned.rs3
-rw-r--r--tests/ui/macros/assert-macro-static.rs3
-rw-r--r--tests/ui/macros/assert-matches-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-ne-macro-msg.rs6
-rw-r--r--tests/ui/macros/assert-ne-macro-panic.rs6
-rw-r--r--tests/ui/macros/builtin-env-issue-114010.rs10
-rw-r--r--tests/ui/macros/builtin-env-issue-114010.stderr20
-rw-r--r--tests/ui/macros/builtin-prelude-no-accidents.stderr4
-rw-r--r--tests/ui/macros/format-args-temporaries-in-write.stderr4
-rw-r--r--tests/ui/macros/issue-19163.stderr6
-rw-r--r--tests/ui/macros/macro-interpolation.rs4
-rw-r--r--tests/ui/macros/macro-interpolation.stderr16
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs14
-rw-r--r--tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr19
18 files changed, 107 insertions, 31 deletions
diff --git a/tests/ui/macros/assert-eq-macro-msg.rs b/tests/ui/macros/assert-eq-macro-msg.rs
index accbd2d1e..3d921f400 100644
--- a/tests/ui/macros/assert-eq-macro-msg.rs
+++ b/tests/ui/macros/assert-eq-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left == right)`
-// error-pattern: left: `2`
-// error-pattern:right: `3`: 1 + 1 definitely should be 3'
+// error-pattern:assertion `left == right` failed: 1 + 1 definitely should be 3
+// error-pattern: left: 2
+// error-pattern: right: 3
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-eq-macro-panic.rs b/tests/ui/macros/assert-eq-macro-panic.rs
index 5e505c30b..6745290cb 100644
--- a/tests/ui/macros/assert-eq-macro-panic.rs
+++ b/tests/ui/macros/assert-eq-macro-panic.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:assertion failed: `(left == right)`
-// error-pattern: left: `14`
-// error-pattern:right: `15`
+// error-pattern:assertion `left == right` failed
+// error-pattern: left: 14
+// error-pattern: right: 15
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-explicit.rs b/tests/ui/macros/assert-macro-explicit.rs
index 578ef5632..3d1a9a6b1 100644
--- a/tests/ui/macros/assert-macro-explicit.rs
+++ b/tests/ui/macros/assert-macro-explicit.rs
@@ -1,5 +1,5 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: false'
+// error-pattern:assertion failed: false
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-fmt.rs b/tests/ui/macros/assert-macro-fmt.rs
index b8d319d85..ceec53ceb 100644
--- a/tests/ui/macros/assert-macro-fmt.rs
+++ b/tests/ui/macros/assert-macro-fmt.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-fmt 42 rust'
+// error-pattern: panicked
+// error-pattern: test-assert-fmt 42 rust
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-macro-owned.rs b/tests/ui/macros/assert-macro-owned.rs
index 753675872..fb4b389b8 100644
--- a/tests/ui/macros/assert-macro-owned.rs
+++ b/tests/ui/macros/assert-macro-owned.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-owned'
+// error-pattern:panicked
+// error-pattern:test-assert-owned
// ignore-emscripten no processes
#![allow(non_fmt_panics)]
diff --git a/tests/ui/macros/assert-macro-static.rs b/tests/ui/macros/assert-macro-static.rs
index dc5274a7e..fccc32592 100644
--- a/tests/ui/macros/assert-macro-static.rs
+++ b/tests/ui/macros/assert-macro-static.rs
@@ -1,5 +1,6 @@
// run-fail
-// error-pattern:panicked at 'test-assert-static'
+// error-pattern:panicked
+// error-pattern:test-assert-static
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-matches-macro-msg.rs b/tests/ui/macros/assert-matches-macro-msg.rs
index fd8cd5a1a..7af6a0778 100644
--- a/tests/ui/macros/assert-matches-macro-msg.rs
+++ b/tests/ui/macros/assert-matches-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left matches right)`
-// error-pattern: left: `2`
-// error-pattern:right: `3`: 1 + 1 definitely should be 3'
+// error-pattern:assertion `left matches right` failed: 1 + 1 definitely should be 3
+// error-pattern: left: 2
+// error-pattern: right: 3
// ignore-emscripten no processes
#![feature(assert_matches)]
diff --git a/tests/ui/macros/assert-ne-macro-msg.rs b/tests/ui/macros/assert-ne-macro-msg.rs
index fc0472b99..adda0af88 100644
--- a/tests/ui/macros/assert-ne-macro-msg.rs
+++ b/tests/ui/macros/assert-ne-macro-msg.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:panicked at 'assertion failed: `(left != right)`
-// error-pattern: left: `2`
-// error-pattern:right: `2`: 1 + 1 definitely should not be 2'
+// error-pattern:assertion `left != right` failed: 1 + 1 definitely should not be 2
+// error-pattern: left: 2
+// error-pattern: right: 2
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/assert-ne-macro-panic.rs b/tests/ui/macros/assert-ne-macro-panic.rs
index 4f507d7b5..d977473a2 100644
--- a/tests/ui/macros/assert-ne-macro-panic.rs
+++ b/tests/ui/macros/assert-ne-macro-panic.rs
@@ -1,7 +1,7 @@
// run-fail
-// error-pattern:assertion failed: `(left != right)`
-// error-pattern: left: `14`
-// error-pattern:right: `14`
+// error-pattern:assertion `left != right` failed
+// error-pattern: left: 14
+// error-pattern: right: 14
// ignore-emscripten no processes
fn main() {
diff --git a/tests/ui/macros/builtin-env-issue-114010.rs b/tests/ui/macros/builtin-env-issue-114010.rs
new file mode 100644
index 000000000..819b8b1e8
--- /dev/null
+++ b/tests/ui/macros/builtin-env-issue-114010.rs
@@ -0,0 +1,10 @@
+// unset-rustc-env:oopsie
+// unset-rustc-env:a""a
+
+env![r#"oopsie"#];
+//~^ ERROR environment variable `oopsie` not defined at compile time
+
+env![r#"a""a"#];
+//~^ ERROR environment variable `a""a` not defined at compile time
+
+fn main() {}
diff --git a/tests/ui/macros/builtin-env-issue-114010.stderr b/tests/ui/macros/builtin-env-issue-114010.stderr
new file mode 100644
index 000000000..0da42089c
--- /dev/null
+++ b/tests/ui/macros/builtin-env-issue-114010.stderr
@@ -0,0 +1,20 @@
+error: environment variable `oopsie` not defined at compile time
+ --> $DIR/builtin-env-issue-114010.rs:4:1
+ |
+LL | env![r#"oopsie"#];
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: use `std::env::var(r#"oopsie"#)` 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 `a""a` not defined at compile time
+ --> $DIR/builtin-env-issue-114010.rs:7:1
+ |
+LL | env![r#"a""a"#];
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: use `std::env::var(r#"a""a"#)` 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 2 previous errors
+
diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr
index b726e1862..c1054230b 100644
--- a/tests/ui/macros/builtin-prelude-no-accidents.stderr
+++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr
@@ -26,10 +26,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `vec`
LL | type B = vec::Vec<u8>;
| ^^^ use of undeclared crate or module `vec`
|
-help: a struct with a similar name exists
- |
-LL | type B = Vec::Vec<u8>;
- | ~~~
help: consider importing this module
|
LL + use std::vec;
diff --git a/tests/ui/macros/format-args-temporaries-in-write.stderr b/tests/ui/macros/format-args-temporaries-in-write.stderr
index 520b2ce50..e05246cfb 100644
--- a/tests/ui/macros/format-args-temporaries-in-write.stderr
+++ b/tests/ui/macros/format-args-temporaries-in-write.stderr
@@ -4,7 +4,7 @@ error[E0597]: `mutex` does not live long enough
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | write!(Out, "{}", mutex.lock()) /* no semicolon */
- | ^^^^^^^^^^^^
+ | ^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
@@ -21,7 +21,7 @@ error[E0597]: `mutex` does not live long enough
LL | let mutex = Mutex;
| ----- binding `mutex` declared here
LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */
- | ^^^^^^^^^^^^
+ | ^^^^^-------
| |
| borrowed value does not live long enough
| a temporary with access to the borrow is created here ...
diff --git a/tests/ui/macros/issue-19163.stderr b/tests/ui/macros/issue-19163.stderr
index ae1ae1426..af509aa59 100644
--- a/tests/ui/macros/issue-19163.stderr
+++ b/tests/ui/macros/issue-19163.stderr
@@ -1,10 +1,8 @@
error[E0596]: cannot borrow data in a `&` reference as mutable
- --> $DIR/issue-19163.rs:9:5
+ --> $DIR/issue-19163.rs:9:14
|
LL | mywrite!(&v, "Hello world");
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
- |
- = note: this error originates in the macro `mywrite` (in Nightly builds, run with -Z macro-backtrace for more info)
+ | ^^ cannot borrow as mutable
error: aborting due to previous error
diff --git a/tests/ui/macros/macro-interpolation.rs b/tests/ui/macros/macro-interpolation.rs
index 35003a79a..48c1f19e7 100644
--- a/tests/ui/macros/macro-interpolation.rs
+++ b/tests/ui/macros/macro-interpolation.rs
@@ -1,5 +1,3 @@
-// run-pass
-
macro_rules! overly_complicated {
($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) =>
({
@@ -21,12 +19,14 @@ macro_rules! qpath {
(ty, <$type:ty as $trait:ty>::$name:ident) => {
<$type as $trait>::$name
+ //~^ ERROR expected identifier, found `!`
};
}
pub fn main() {
let _: qpath!(path, <str as ToOwned>::Owned);
let _: qpath!(ty, <str as ToOwned>::Owned);
+ let _: qpath!(ty, <str as !>::Owned);
assert!(overly_complicated!(f, x, Option<usize>, { return Some(x); },
Some(8), Some(y), y) == 8)
diff --git a/tests/ui/macros/macro-interpolation.stderr b/tests/ui/macros/macro-interpolation.stderr
new file mode 100644
index 000000000..7ef1fcbbc
--- /dev/null
+++ b/tests/ui/macros/macro-interpolation.stderr
@@ -0,0 +1,16 @@
+error: expected identifier, found `!`
+ --> $DIR/macro-interpolation.rs:21:19
+ |
+LL | <$type as $trait>::$name
+ | ^^^^^^ expected identifier
+...
+LL | let _: qpath!(ty, <str as !>::Owned);
+ | -----------------------------
+ | |
+ | this macro call doesn't expand to a type
+ | in this macro invocation
+ |
+ = note: this error originates in the macro `qpath` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
new file mode 100644
index 000000000..9cc572c23
--- /dev/null
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.rs
@@ -0,0 +1,14 @@
+#![feature(macro_metavar_expr)]
+
+macro_rules! foo {
+ ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ //~^ ERROR `count` followed by a comma must have an associated
+ //~| ERROR expected expression, found `$`
+}
+
+fn test() {
+ foo!(a, a; b, b);
+}
+
+fn main() {
+}
diff --git a/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
new file mode 100644
index 000000000..e9317a5c3
--- /dev/null
+++ b/tests/ui/macros/rfc-3086-metavar-expr/issue-111904.stderr
@@ -0,0 +1,19 @@
+error: `count` followed by a comma must have an associated index indicating its depth
+ --> $DIR/issue-111904.rs:4:37
+ |
+LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ | ^^^^^
+
+error: expected expression, found `$`
+ --> $DIR/issue-111904.rs:4:35
+ |
+LL | ( $( $($t:ident),* );* ) => { ${count(t,)} }
+ | ^ expected expression
+...
+LL | foo!(a, a; b, b);
+ | ---------------- in this macro invocation
+ |
+ = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+