about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-19 13:41:13 +0000
committerbors <bors@rust-lang.org>2024-02-19 13:41:13 +0000
commite29a1530f670d66f617f7aac8601920a87263ac6 (patch)
tree15b760fb602a870653fdfc0fff6ac294ea8bd930 /tests
parent43d3470f11a18d7bfa0b288954bf327cbf7549ab (diff)
parent3fe809b38de2597f211a149e87eee15ea8f5ccdd (diff)
downloadrust-e29a1530f670d66f617f7aac8601920a87263ac6.tar.gz
rust-e29a1530f670d66f617f7aac8601920a87263ac6.zip
Auto merge of #121295 - matthiaskrgr:rollup-j2vffew, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #119808 (Store core::str::CharSearcher::utf8_size as u8)
 - #121032 (Continue reporting remaining errors instead of silently dropping them)
 - #121041 (Add `Future` and `IntoFuture` to the 2024 prelude)
 - #121230 (Extend Level API)
 - #121272 (Add diagnostic items for legacy numeric constants)
 - #121275 (add test for panicking attribute macros)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/async-await/for-await-passthrough.rs2
-rw-r--r--tests/ui/coroutine/async_gen_fn_iter.rs1
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.rs8
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.stderr10
-rw-r--r--tests/ui/rust-2024/prelude2024.rs9
-rw-r--r--tests/ui/typeck/cyclic_type_ice.rs7
-rw-r--r--tests/ui/typeck/cyclic_type_ice.stderr31
7 files changed, 65 insertions, 3 deletions
diff --git a/tests/ui/async-await/for-await-passthrough.rs b/tests/ui/async-await/for-await-passthrough.rs
index 3769ef60b01..e09e843332e 100644
--- a/tests/ui/async-await/for-await-passthrough.rs
+++ b/tests/ui/async-await/for-await-passthrough.rs
@@ -4,8 +4,6 @@
 #![feature(async_iterator, async_iter_from_iter, const_waker, async_for_loop, noop_waker,
            gen_blocks)]
 
-use std::future::Future;
-
 async gen fn async_iter() -> i32 {
     let iter = core::async_iter::from_iter(0..3);
     for await i in iter {
diff --git a/tests/ui/coroutine/async_gen_fn_iter.rs b/tests/ui/coroutine/async_gen_fn_iter.rs
index c4a7629f314..42288712c70 100644
--- a/tests/ui/coroutine/async_gen_fn_iter.rs
+++ b/tests/ui/coroutine/async_gen_fn_iter.rs
@@ -46,7 +46,6 @@ async fn async_main() {
 use std::pin::{Pin, pin};
 use std::task::*;
 use std::async_iter::AsyncIterator;
-use std::future::Future;
 
 trait AsyncIterExt {
     fn next(&mut self) -> Next<'_, Self>;
diff --git a/tests/ui/proc-macro/custom-attr-panic.rs b/tests/ui/proc-macro/custom-attr-panic.rs
new file mode 100644
index 00000000000..23bcb66319d
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.rs
@@ -0,0 +1,8 @@
+//@ aux-build: test-macros.rs
+
+extern crate test_macros;
+
+#[test_macros::panic_attr] //~ ERROR custom attribute panicked
+fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/proc-macro/custom-attr-panic.stderr b/tests/ui/proc-macro/custom-attr-panic.stderr
new file mode 100644
index 00000000000..e436162bcc1
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.stderr
@@ -0,0 +1,10 @@
+error: custom attribute panicked
+  --> $DIR/custom-attr-panic.rs:5:1
+   |
+LL | #[test_macros::panic_attr]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: panic-attr
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/rust-2024/prelude2024.rs b/tests/ui/rust-2024/prelude2024.rs
new file mode 100644
index 00000000000..e58ebe74188
--- /dev/null
+++ b/tests/ui/rust-2024/prelude2024.rs
@@ -0,0 +1,9 @@
+//@ check-pass
+//@ compile-flags: -Zunstable-options
+//@ edition:2024
+
+fn main() {
+    fut(async {}.into_future(), async {});
+}
+
+fn fut(_: impl Future, _: impl IntoFuture) {}
diff --git a/tests/ui/typeck/cyclic_type_ice.rs b/tests/ui/typeck/cyclic_type_ice.rs
new file mode 100644
index 00000000000..7899b354f38
--- /dev/null
+++ b/tests/ui/typeck/cyclic_type_ice.rs
@@ -0,0 +1,7 @@
+fn thing() {
+    let f = |_, _| ();
+    f(f); //~ ERROR: closure/coroutine type that references itself
+    //~^ ERROR: this function takes 2 arguments but 1 argument was supplied
+}
+
+fn main() {}
diff --git a/tests/ui/typeck/cyclic_type_ice.stderr b/tests/ui/typeck/cyclic_type_ice.stderr
new file mode 100644
index 00000000000..bfff6830fc5
--- /dev/null
+++ b/tests/ui/typeck/cyclic_type_ice.stderr
@@ -0,0 +1,31 @@
+error[E0644]: closure/coroutine type that references itself
+  --> $DIR/cyclic_type_ice.rs:3:7
+   |
+LL |     f(f);
+   |       ^ cyclic type of infinite size
+   |
+   = note: closures cannot capture themselves or take themselves as argument;
+           this error may be the result of a recent compiler bug-fix,
+           see issue #46062 <https://github.com/rust-lang/rust/issues/46062>
+           for more information
+
+error[E0057]: this function takes 2 arguments but 1 argument was supplied
+  --> $DIR/cyclic_type_ice.rs:3:5
+   |
+LL |     f(f);
+   |     ^--- an argument is missing
+   |
+note: closure defined here
+  --> $DIR/cyclic_type_ice.rs:2:13
+   |
+LL |     let f = |_, _| ();
+   |             ^^^^^^
+help: provide the argument
+   |
+LL |     f(/*  */, /*  */);
+   |      ~~~~~~~~~~~~~~~~
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0057, E0644.
+For more information about an error, try `rustc --explain E0057`.