summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui/macros
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/macros')
-rw-r--r--tests/ui/macros/builtin-prelude-no-accidents.stderr15
-rw-r--r--tests/ui/macros/issue-111749.rs12
-rw-r--r--tests/ui/macros/issue-111749.stderr18
-rw-r--r--tests/ui/macros/issue-26094.rs12
-rw-r--r--tests/ui/macros/issue-26094.stderr18
-rw-r--r--tests/ui/macros/issue-2804-2.rs12
-rw-r--r--tests/ui/macros/issue-69396-const-no-type-in-macro.rs17
-rw-r--r--tests/ui/macros/issue-69396-const-no-type-in-macro.stderr50
-rw-r--r--tests/ui/macros/macro-expanded-include/foo/mod.rs2
-rw-r--r--tests/ui/macros/macro-local-data-key-priv.stderr2
-rw-r--r--tests/ui/macros/missing-bang-in-decl.stderr14
-rw-r--r--tests/ui/macros/panic-temporaries-2018.rs55
-rw-r--r--tests/ui/macros/panic-temporaries.rs43
-rw-r--r--tests/ui/macros/parse-complex-macro-invoc-op.rs1
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs85
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs2
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs2
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs2
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs2
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs2
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout20
-rw-r--r--tests/ui/macros/stringify.rs3
-rw-r--r--tests/ui/macros/user-defined-macro-rules.rs9
23 files changed, 297 insertions, 101 deletions
diff --git a/tests/ui/macros/builtin-prelude-no-accidents.stderr b/tests/ui/macros/builtin-prelude-no-accidents.stderr
index 56af618d4..8cd9a63b8 100644
--- a/tests/ui/macros/builtin-prelude-no-accidents.stderr
+++ b/tests/ui/macros/builtin-prelude-no-accidents.stderr
@@ -4,18 +4,21 @@ error[E0433]: failed to resolve: use of undeclared crate or module `env`
LL | env::current_dir;
| ^^^ use of undeclared crate or module `env`
+error[E0433]: failed to resolve: use of undeclared crate or module `vec`
+ --> $DIR/builtin-prelude-no-accidents.rs:7:14
+ |
+LL | type B = vec::Vec<u8>;
+ | ^^^
+ | |
+ | use of undeclared crate or module `vec`
+ | help: a struct with a similar name exists (notice the capitalization): `Vec`
+
error[E0433]: failed to resolve: use of undeclared crate or module `panic`
--> $DIR/builtin-prelude-no-accidents.rs:6:14
|
LL | type A = panic::PanicInfo;
| ^^^^^ use of undeclared crate or module `panic`
-error[E0433]: failed to resolve: use of undeclared crate or module `vec`
- --> $DIR/builtin-prelude-no-accidents.rs:7:14
- |
-LL | type B = vec::Vec<u8>;
- | ^^^ use of undeclared crate or module `vec`
-
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/macros/issue-111749.rs b/tests/ui/macros/issue-111749.rs
new file mode 100644
index 000000000..6c45e4e8c
--- /dev/null
+++ b/tests/ui/macros/issue-111749.rs
@@ -0,0 +1,12 @@
+macro_rules! cbor_map {
+ ($key:expr) => {
+ $key.signum();
+ };
+}
+
+fn main() {
+ cbor_map! { #[test(test)] 4};
+ //~^ ERROR removing an expression is not supported in this position
+ //~| ERROR attribute must be of the form `#[test]`
+ //~| WARNING this was previously accepted by the compiler but is being phased out
+}
diff --git a/tests/ui/macros/issue-111749.stderr b/tests/ui/macros/issue-111749.stderr
new file mode 100644
index 000000000..7db2b8e6a
--- /dev/null
+++ b/tests/ui/macros/issue-111749.stderr
@@ -0,0 +1,18 @@
+error: removing an expression is not supported in this position
+ --> $DIR/issue-111749.rs:8:17
+ |
+LL | cbor_map! { #[test(test)] 4};
+ | ^^^^^^^^^^^^^
+
+error: attribute must be of the form `#[test]`
+ --> $DIR/issue-111749.rs:8:17
+ |
+LL | cbor_map! { #[test(test)] 4};
+ | ^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
+ = note: `#[deny(ill_formed_attribute_input)]` on by default
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/macros/issue-26094.rs b/tests/ui/macros/issue-26094.rs
new file mode 100644
index 000000000..2742529ed
--- /dev/null
+++ b/tests/ui/macros/issue-26094.rs
@@ -0,0 +1,12 @@
+macro_rules! some_macro {
+ ($other: expr) => {{
+ $other(None) //~ NOTE unexpected argument of type `Option<_>`
+ }};
+}
+
+fn some_function() {} //~ NOTE defined here
+
+fn main() {
+ some_macro!(some_function);
+ //~^ ERROR function takes 0 arguments but 1 argument was supplied
+}
diff --git a/tests/ui/macros/issue-26094.stderr b/tests/ui/macros/issue-26094.stderr
new file mode 100644
index 000000000..ecdf48470
--- /dev/null
+++ b/tests/ui/macros/issue-26094.stderr
@@ -0,0 +1,18 @@
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+ --> $DIR/issue-26094.rs:10:17
+ |
+LL | $other(None)
+ | ---- unexpected argument of type `Option<_>`
+...
+LL | some_macro!(some_function);
+ | ^^^^^^^^^^^^^
+ |
+note: function defined here
+ --> $DIR/issue-26094.rs:7:4
+ |
+LL | fn some_function() {}
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/tests/ui/macros/issue-2804-2.rs b/tests/ui/macros/issue-2804-2.rs
new file mode 100644
index 000000000..d02725505
--- /dev/null
+++ b/tests/ui/macros/issue-2804-2.rs
@@ -0,0 +1,12 @@
+// check-pass
+#![allow(dead_code)]
+// Minimized version of issue-2804.rs. Both check that callee IDs don't
+// clobber the previous node ID in a macro expr
+
+use std::collections::HashMap;
+
+fn add_interfaces(managed_ip: String, device: HashMap<String, isize>) {
+ println!("{}, {}", managed_ip, device["interfaces"]);
+}
+
+pub fn main() {}
diff --git a/tests/ui/macros/issue-69396-const-no-type-in-macro.rs b/tests/ui/macros/issue-69396-const-no-type-in-macro.rs
new file mode 100644
index 000000000..45a308574
--- /dev/null
+++ b/tests/ui/macros/issue-69396-const-no-type-in-macro.rs
@@ -0,0 +1,17 @@
+macro_rules! suite {
+ ( $( $fn:ident; )* ) => {
+ $(
+ const A = "A".$fn();
+ //~^ ERROR the name `A` is defined multiple times
+ //~| ERROR missing type for `const` item
+ //~| ERROR the placeholder `_` is not allowed within types on item signatures for constants
+ )*
+ }
+}
+
+suite! {
+ len;
+ is_empty;
+}
+
+fn main() {}
diff --git a/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr b/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr
new file mode 100644
index 000000000..89aeafeba
--- /dev/null
+++ b/tests/ui/macros/issue-69396-const-no-type-in-macro.stderr
@@ -0,0 +1,50 @@
+error[E0428]: the name `A` is defined multiple times
+ --> $DIR/issue-69396-const-no-type-in-macro.rs:4:13
+ |
+LL | const A = "A".$fn();
+ | ^^^^^^^^^^^^^^^^^^^^ `A` redefined here
+...
+LL | / suite! {
+LL | | len;
+LL | | is_empty;
+LL | | }
+ | |_- in this macro invocation
+ |
+ = note: `A` must be defined only once in the value namespace of this module
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: missing type for `const` item
+ --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20
+ |
+LL | const A = "A".$fn();
+ | ^ help: provide a type for the constant: `: usize`
+...
+LL | / suite! {
+LL | | len;
+LL | | is_empty;
+LL | | }
+ | |_- in this macro invocation
+ |
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
+ --> $DIR/issue-69396-const-no-type-in-macro.rs:4:20
+ |
+LL | const A = "A".$fn();
+ | ^
+ | |
+ | not allowed in type signatures
+ | help: replace with the correct type: `bool`
+...
+LL | / suite! {
+LL | | len;
+LL | | is_empty;
+LL | | }
+ | |_- in this macro invocation
+ |
+ = note: this error originates in the macro `suite` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0121, E0428.
+For more information about an error, try `rustc --explain E0121`.
diff --git a/tests/ui/macros/macro-expanded-include/foo/mod.rs b/tests/ui/macros/macro-expanded-include/foo/mod.rs
index cff110470..2e4c4c7f8 100644
--- a/tests/ui/macros/macro-expanded-include/foo/mod.rs
+++ b/tests/ui/macros/macro-expanded-include/foo/mod.rs
@@ -1,4 +1,4 @@
-// ignore-test
+// ignore-test (auxiliary, used by other tests)
macro_rules! m {
() => { include!("file.txt"); }
diff --git a/tests/ui/macros/macro-local-data-key-priv.stderr b/tests/ui/macros/macro-local-data-key-priv.stderr
index fb8cab279..0f412bc86 100644
--- a/tests/ui/macros/macro-local-data-key-priv.stderr
+++ b/tests/ui/macros/macro-local-data-key-priv.stderr
@@ -9,7 +9,7 @@ note: the constant `baz` is defined here
|
LL | thread_local!(static baz: f64 = 0.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- = note: this error originates in the macro `$crate::__thread_local_inner` which comes from the expansion of the macro `thread_local` (in Nightly builds, run with -Z macro-backtrace for more info)
+ = note: this error originates in the macro `$crate::thread::local_impl::thread_local_inner` which comes from the expansion of the macro `thread_local` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/tests/ui/macros/missing-bang-in-decl.stderr b/tests/ui/macros/missing-bang-in-decl.stderr
index dfabafb0a..aa78c9a69 100644
--- a/tests/ui/macros/missing-bang-in-decl.stderr
+++ b/tests/ui/macros/missing-bang-in-decl.stderr
@@ -2,13 +2,23 @@ error: expected `!` after `macro_rules`
--> $DIR/missing-bang-in-decl.rs:5:1
|
LL | macro_rules foo {
- | ^^^^^^^^^^^ help: add a `!`: `macro_rules!`
+ | ^^^^^^^^^^^
+ |
+help: add a `!`
+ |
+LL | macro_rules! foo {
+ | +
error: expected `!` after `macro_rules`
--> $DIR/missing-bang-in-decl.rs:10:1
|
LL | macro_rules bar! {
- | ^^^^^^^^^^^ help: add a `!`: `macro_rules!`
+ | ^^^^^^^^^^^
+ |
+help: add a `!`
+ |
+LL | macro_rules! bar! {
+ | +
error: macro names aren't followed by a `!`
--> $DIR/missing-bang-in-decl.rs:10:16
diff --git a/tests/ui/macros/panic-temporaries-2018.rs b/tests/ui/macros/panic-temporaries-2018.rs
new file mode 100644
index 000000000..d914df380
--- /dev/null
+++ b/tests/ui/macros/panic-temporaries-2018.rs
@@ -0,0 +1,55 @@
+// check-pass
+// edition:2018
+
+#![allow(non_fmt_panics, unreachable_code)]
+
+use std::fmt::{self, Display};
+use std::marker::PhantomData;
+
+struct NotSend {
+ marker: PhantomData<*const u8>,
+}
+
+const NOT_SEND: NotSend = NotSend { marker: PhantomData };
+
+impl Display for NotSend {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("this value does not implement Send")
+ }
+}
+
+async fn f(_: u8) {}
+
+// Exercises this matcher in panic_2015:
+// ($fmt:expr, $($arg:tt)+) => $crate::panicking::panic_fmt(...)
+async fn panic_fmt() {
+ // Panic returns `!`, so the await is never reached, and in particular the
+ // temporaries inside the formatting machinery are not still alive at the
+ // await point.
+ let todo = "...";
+ f(panic!("not yet implemented: {}", todo)).await;
+}
+
+// Exercises ("{}", $arg:expr) => $crate::panicking::panic_display(&$arg)
+async fn panic_display() {
+ f(panic!("{}", NOT_SEND)).await;
+}
+
+// Exercises ($msg:expr) => $crate::panicking::panic_str($msg)
+async fn panic_str() {
+ f(panic!((NOT_SEND, "...").1)).await;
+}
+
+// Exercises ($msg:expr) => $crate::panicking::unreachable_display(&$msg)
+async fn unreachable_display() {
+ f(unreachable!(NOT_SEND)).await;
+}
+
+fn require_send(_: impl Send) {}
+
+fn main() {
+ require_send(panic_fmt());
+ require_send(panic_display());
+ require_send(panic_str());
+ require_send(unreachable_display());
+}
diff --git a/tests/ui/macros/panic-temporaries.rs b/tests/ui/macros/panic-temporaries.rs
new file mode 100644
index 000000000..db65601fb
--- /dev/null
+++ b/tests/ui/macros/panic-temporaries.rs
@@ -0,0 +1,43 @@
+// check-pass
+// edition:2021
+
+#![allow(unreachable_code)]
+
+use std::fmt::{self, Display};
+use std::marker::PhantomData;
+
+struct NotSend {
+ marker: PhantomData<*const u8>,
+}
+
+const NOT_SEND: NotSend = NotSend { marker: PhantomData };
+
+impl Display for NotSend {
+ fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+ formatter.write_str("this value does not implement Send")
+ }
+}
+
+async fn f(_: u8) {}
+
+// Exercises this matcher in panic_2021:
+// ($($t:tt)+) => $crate::panicking::panic_fmt(...)
+async fn panic_fmt() {
+ // Panic returns `!`, so the await is never reached, and in particular the
+ // temporaries inside the formatting machinery are not still alive at the
+ // await point.
+ let todo = "...";
+ f(panic!("not yet implemented: {}", todo)).await;
+}
+
+// Exercises ("{}", $arg:expr) => $crate::panicking::panic_display(&$arg)
+async fn panic_display() {
+ f(panic!("{}", NOT_SEND)).await;
+}
+
+fn require_send(_: impl Send) {}
+
+fn main() {
+ require_send(panic_fmt());
+ require_send(panic_display());
+}
diff --git a/tests/ui/macros/parse-complex-macro-invoc-op.rs b/tests/ui/macros/parse-complex-macro-invoc-op.rs
index 8fef9b0ed..10810388d 100644
--- a/tests/ui/macros/parse-complex-macro-invoc-op.rs
+++ b/tests/ui/macros/parse-complex-macro-invoc-op.rs
@@ -4,6 +4,7 @@
#![allow(unused_assignments)]
#![allow(unused_variables)]
#![allow(stable_features)]
+#![allow(dropping_copy_types)]
// Test parsing binary operators after macro invocations.
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs
index e88e24482..b1db05afd 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs
@@ -5,7 +5,7 @@
// needs-unwind Asserting on contents of error message
#![allow(path_statements, unused_allocation)]
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
macro_rules! test {
(
@@ -51,6 +51,7 @@ macro_rules! tests {
const FOO: Foo = Foo { bar: 1 };
+
#[derive(Clone, Copy, Debug, PartialEq)]
struct Foo {
bar: i32
@@ -83,9 +84,18 @@ fn main() {
// cast
[ elem as i32 == 3 ] => "Assertion failed: elem as i32 == 3\nWith captures:\n elem = 1\n"
+ // if
+ [ if elem == 3 { true } else { false } ] => "Assertion failed: if elem == 3 { true } else { false }\nWith captures:\n elem = 1\n"
+
// index
[ [1i32, 1][elem as usize] == 3 ] => "Assertion failed: [1i32, 1][elem as usize] == 3\nWith captures:\n elem = 1\n"
+ // let
+ [ if let 3 = elem { true } else { false } ] => "Assertion failed: if let 3 = elem { true } else { false }\nWith captures:\n elem = 1\n"
+
+ // match
+ [ match elem { 3 => true, _ => false, } ] => "Assertion failed: match elem { 3 => true, _ => false, }\nWith captures:\n elem = 1\n"
+
// method call
[ FOO.add(elem, elem) == 3 ] => "Assertion failed: FOO.add(elem, elem) == 3\nWith captures:\n elem = 1\n"
@@ -107,77 +117,4 @@ fn main() {
// unary
[ -elem == -3 ] => "Assertion failed: -elem == -3\nWith captures:\n elem = 1\n"
);
-
- // ***** Disallowed *****
-
- tests!(
- let mut elem = 1i32;
-
- // assign
- [ { let local = elem; local } == 3 ] => "Assertion failed: { let local = elem; local } == 3"
-
- // assign op
- [ { elem += 1; elem } == 3 ] => "Assertion failed: { elem += 1; elem } == 3"
-
- // async
- [ { let _ = async { elem }; elem } == 3 ] => "Assertion failed: { let _ = async { elem }; elem } == 3"
-
- // await
-
- // block
- [ { elem } == 3 ] => "Assertion failed: { elem } == 3"
-
- // break
- [ loop { break elem; } == 3 ] => "Assertion failed: loop { break elem; } == 3"
-
- // closure
- [(|| elem)() == 3 ] => "Assertion failed: (|| elem)() == 3"
-
- // const block
-
- // continue
-
- // err
-
- // field
- [ FOO.bar == 3 ] => "Assertion failed: FOO.bar == 3"
-
- // for loop
- [ { for _ in 0..elem { elem; } elem } == 3 ] => "Assertion failed: { for _ in 0..elem { elem; } elem } == 3"
-
- // if
- [ if true { elem } else { elem } == 3 ] => "Assertion failed: if true { elem } else { elem } == 3"
-
- // inline asm
-
- // let
- [ if let true = true { elem } else { elem } == 3 ] => "Assertion failed: if let true = true { elem } else { elem } == 3"
-
- // lit
-
- // loop
- [ loop { elem; break elem; } == 3 ] => "Assertion failed: loop { elem; break elem; } == 3"
-
- // mac call
-
- // match
- [ match elem { _ => elem } == 3 ] => "Assertion failed: (match elem { _ => elem, }) == 3"
-
- // ret
- [ (|| { return elem; })() == 3 ] => "Assertion failed: (|| { return elem; })() == 3"
-
- // try
- [ (|| { Some(Some(elem)?) })() == Some(3) ] => "Assertion failed: (|| { Some(Some(elem)?) })() == Some(3)"
-
- // try block
-
- // underscore
-
- // while
- [ { while false { elem; break; } elem } == 3 ] => "Assertion failed: { while false { elem; break; } elem } == 3"
-
- // yeet
-
- // yield
- );
}
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs
index d46f396ee..fcf4f367d 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs
@@ -4,7 +4,7 @@
// run-pass
// needs-unwind Asserting on contents of error message
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
extern crate common;
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs
index 6a1435f79..c8408d16f 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-with-custom-errors-does-not-create-unnecessary-code.rs
@@ -1,7 +1,7 @@
// compile-flags: --test
// run-pass
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
#[should_panic(expected = "Custom user message")]
#[test]
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs
index 1f5a29ab5..0e3c14a57 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/assert-without-captures-does-not-create-unnecessary-code.rs
@@ -3,7 +3,7 @@
// run-pass
// needs-unwind Asserting on contents of error message
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
extern crate common;
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs
index 01860adaa..0d2518dc2 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs
@@ -2,7 +2,7 @@
// ignore-tidy-linelength
// run-pass
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
use std::fmt::{Debug, Formatter};
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs
index 5ec84b08f..57b79a56b 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.rs
@@ -1,7 +1,7 @@
// check-pass
// compile-flags: -Z unpretty=expanded
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
fn arbitrary_consuming_method_for_demonstration_purposes() {
let elem = 1i32;
diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
index ad97f7a4a..66321bc35 100644
--- a/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
+++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout
@@ -3,7 +3,7 @@
// check-pass
// compile-flags: -Z unpretty=expanded
-#![feature(core_intrinsics, generic_assert, generic_assert_internals)]
+#![feature(core_intrinsics, generic_assert)]
#[prelude_import]
use ::std::prelude::rust_2015::*;
#[macro_use]
@@ -26,7 +26,7 @@ fn arbitrary_consuming_method_for_demonstration_purposes() {
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem as usize\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -42,7 +42,7 @@ fn addr_of() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: &elem\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -58,7 +58,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem == 1\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -71,7 +71,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem >= 1\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -84,7 +84,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem > 0\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -97,7 +97,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem < 3\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -110,7 +110,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem <= 3\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -123,7 +123,7 @@ fn binary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: elem != 3\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
@@ -139,7 +139,7 @@ fn unary() {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
::std::rt::panic_fmt(format_args!("Assertion failed: *elem\nWith captures:\n elem = {0:?}\n",
- __capture0))
+ __capture0));
}
}
};
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 79d8cd757..816f99baa 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -134,8 +134,7 @@ fn test_expr() {
assert_eq!(stringify_expr!(expr as T<u8>), "expr as T<u8>");
// ExprKind::Type
- assert_eq!(stringify_expr!(expr: T), "expr: T");
- assert_eq!(stringify_expr!(expr: T<u8>), "expr: T<u8>");
+ // There is no syntax for type ascription.
// ExprKind::If
assert_eq!(stringify_expr!(if true {}), "if true {}");
diff --git a/tests/ui/macros/user-defined-macro-rules.rs b/tests/ui/macros/user-defined-macro-rules.rs
new file mode 100644
index 000000000..09e071ec4
--- /dev/null
+++ b/tests/ui/macros/user-defined-macro-rules.rs
@@ -0,0 +1,9 @@
+// check-pass
+
+macro_rules! macro_rules { () => { struct S; } } // OK
+
+macro_rules! {} // OK, calls the macro defined above
+
+fn main() {
+ let s = S;
+}