summaryrefslogtreecommitdiffstats
path: root/tests/ui/macros
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:50 +0000
commit2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35 (patch)
treed325add32978dbdc1db975a438b3a77d571b1ab8 /tests/ui/macros
parentReleasing progress-linux version 1.68.2+dfsg1-1~progress7.99u1. (diff)
downloadrustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.tar.xz
rustc-2e00214b3efbdfeefaa0fe9e8b8fd519de7adc35.zip
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/ui/macros/format-args-temporaries-in-write.stderr4
-rw-r--r--tests/ui/macros/issue-102878.rs4
-rw-r--r--tests/ui/macros/issue-102878.stderr51
-rw-r--r--tests/ui/macros/macros-nonfatal-errors.stderr9
-rw-r--r--tests/ui/macros/rfc-2011-nicer-assert-messages/non-consuming-methods-have-optimized-codegen.stdout36
-rw-r--r--tests/ui/macros/stringify.rs6
6 files changed, 31 insertions, 79 deletions
diff --git a/tests/ui/macros/format-args-temporaries-in-write.stderr b/tests/ui/macros/format-args-temporaries-in-write.stderr
index 287cd7d67..520b2ce50 100644
--- a/tests/ui/macros/format-args-temporaries-in-write.stderr
+++ b/tests/ui/macros/format-args-temporaries-in-write.stderr
@@ -1,6 +1,8 @@
error[E0597]: `mutex` does not live long enough
--> $DIR/format-args-temporaries-in-write.rs:41:27
|
+LL | let mutex = Mutex;
+ | ----- binding `mutex` declared here
LL | write!(Out, "{}", mutex.lock()) /* no semicolon */
| ^^^^^^^^^^^^
| |
@@ -16,6 +18,8 @@ LL | };
error[E0597]: `mutex` does not live long enough
--> $DIR/format-args-temporaries-in-write.rs:47:29
|
+LL | let mutex = Mutex;
+ | ----- binding `mutex` declared here
LL | writeln!(Out, "{}", mutex.lock()) /* no semicolon */
| ^^^^^^^^^^^^
| |
diff --git a/tests/ui/macros/issue-102878.rs b/tests/ui/macros/issue-102878.rs
index aac589193..bdd9c2569 100644
--- a/tests/ui/macros/issue-102878.rs
+++ b/tests/ui/macros/issue-102878.rs
@@ -1,9 +1,5 @@
macro_rules!test{($l:expr,$_:r)=>({const:y y)}
//~^ ERROR mismatched closing delimiter: `)`
-//~| ERROR invalid fragment specifier `r`
-//~| ERROR expected identifier, found keyword `const`
-//~| ERROR expected identifier, found keyword `const`
-//~| ERROR expected identifier, found `:`
fn s(){test!(1,i)}
diff --git a/tests/ui/macros/issue-102878.stderr b/tests/ui/macros/issue-102878.stderr
index e0b8855a3..034e3731b 100644
--- a/tests/ui/macros/issue-102878.stderr
+++ b/tests/ui/macros/issue-102878.stderr
@@ -7,54 +7,5 @@ LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
| |unclosed delimiter
| closing delimiter possibly meant for this
-error: invalid fragment specifier `r`
- --> $DIR/issue-102878.rs:1:27
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
- | ^^^^
- |
- = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
-
-error: expected identifier, found keyword `const`
- --> $DIR/issue-102878.rs:1:36
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
- | ^^^^^ expected identifier, found keyword
-...
-LL | fn s(){test!(1,i)}
- | ---------- in this macro invocation
- |
- = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: escape `const` to use it as an identifier
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({r#const:y y)}
- | ++
-
-error: expected identifier, found keyword `const`
- --> $DIR/issue-102878.rs:1:36
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
- | ^^^^^ expected identifier, found keyword
-...
-LL | fn s(){test!(1,i)}
- | ---------- in this macro invocation
- |
- = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
-help: escape `const` to use it as an identifier
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({r#const:y y)}
- | ++
-
-error: expected identifier, found `:`
- --> $DIR/issue-102878.rs:1:41
- |
-LL | macro_rules!test{($l:expr,$_:r)=>({const:y y)}
- | ^ expected identifier
-...
-LL | fn s(){test!(1,i)}
- | ---------- in this macro invocation
- |
- = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
-
-error: aborting due to 5 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/macros/macros-nonfatal-errors.stderr b/tests/ui/macros/macros-nonfatal-errors.stderr
index d42f6c179..93fbc9c8a 100644
--- a/tests/ui/macros/macros-nonfatal-errors.stderr
+++ b/tests/ui/macros/macros-nonfatal-errors.stderr
@@ -150,18 +150,19 @@ error: expected string literal
LL | env!(invalid);
| ^^^^^^^
-error: expected string literal
- --> $DIR/macros-nonfatal-errors.rs:105:10
+error: env! takes 1 or 2 arguments
+ --> $DIR/macros-nonfatal-errors.rs:105:5
|
LL | env!(foo, abr, baz);
- | ^^^
+ | ^^^^^^^^^^^^^^^^^^^
-error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined
+error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined at compile time
--> $DIR/macros-nonfatal-errors.rs:106:5
|
LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
+ = help: Use `std::env::var("RUST_HOPEFULLY_THIS_DOESNT_EXIST")` 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: format argument must be a string literal
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 90f858f80..ad97f7a4a 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
@@ -25,8 +25,8 @@ fn arbitrary_consuming_method_for_demonstration_purposes() {
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem as usize\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem as usize\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -41,8 +41,8 @@ fn addr_of() {
if ::core::intrinsics::unlikely(!&*__local_bind0) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: &elem\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: &elem\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -57,8 +57,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 == 1)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem == 1\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem == 1\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -70,8 +70,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 >= 1)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem >= 1\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem >= 1\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -83,8 +83,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 > 0)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem > 0\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem > 0\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -96,8 +96,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 < 3)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem < 3\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem < 3\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -109,8 +109,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 <= 3)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem <= 3\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem <= 3\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -122,8 +122,8 @@ fn binary() {
if ::core::intrinsics::unlikely(!(*__local_bind0 != 3)) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: elem != 3\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: elem != 3\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
@@ -138,8 +138,8 @@ fn unary() {
if ::core::intrinsics::unlikely(!**__local_bind0) {
(&::core::asserting::Wrapper(__local_bind0)).try_capture(&mut __capture0);
{
- ::std::rt::panic_fmt(::core::fmt::Arguments::new_v1(&["Assertion failed: *elem\nWith captures:\n elem = ",
- "\n"], &[::core::fmt::ArgumentV1::new_debug(&__capture0)]))
+ ::std::rt::panic_fmt(format_args!("Assertion failed: *elem\nWith captures:\n elem = {0:?}\n",
+ __capture0))
}
}
};
diff --git a/tests/ui/macros/stringify.rs b/tests/ui/macros/stringify.rs
index 5cd217df6..fdc2a7666 100644
--- a/tests/ui/macros/stringify.rs
+++ b/tests/ui/macros/stringify.rs
@@ -626,7 +626,7 @@ fn test_item() {
stringify_item!(
impl ~const Struct {}
),
- "impl Struct {}", // FIXME
+ "impl ~const Struct {}",
);
// ItemKind::MacCall
@@ -838,7 +838,7 @@ fn test_ty() {
assert_eq!(stringify_ty!(dyn Send + 'a), "dyn Send + 'a");
assert_eq!(stringify_ty!(dyn 'a + Send), "dyn 'a + Send");
assert_eq!(stringify_ty!(dyn ?Sized), "dyn ?Sized");
- assert_eq!(stringify_ty!(dyn ~const Clone), "dyn Clone"); // FIXME
+ assert_eq!(stringify_ty!(dyn ~const Clone), "dyn ~const Clone");
assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send");
// TyKind::ImplTrait
@@ -846,7 +846,7 @@ fn test_ty() {
assert_eq!(stringify_ty!(impl Send + 'a), "impl Send + 'a");
assert_eq!(stringify_ty!(impl 'a + Send), "impl 'a + Send");
assert_eq!(stringify_ty!(impl ?Sized), "impl ?Sized");
- assert_eq!(stringify_ty!(impl ~const Clone), "impl Clone"); // FIXME
+ assert_eq!(stringify_ty!(impl ~const Clone), "impl ~const Clone");
assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send");
// TyKind::Paren