about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-11 22:20:35 +0000
committerbors <bors@rust-lang.org>2024-06-11 22:20:35 +0000
commitebcb862bbb9031c4969c06ec73d44780ea37d0ff (patch)
treef71fabd3f6c637b9eeb5afb72180a50f8ba285b3 /tests
parentd0227c6a19c2d6e8dceb87c7a2776dc2b10d2a04 (diff)
parente37c423f106a16302718c5e413166b74ea3d4583 (diff)
downloadrust-ebcb862bbb9031c4969c06ec73d44780ea37d0ff.tar.gz
rust-ebcb862bbb9031c4969c06ec73d44780ea37d0ff.zip
Auto merge of #126284 - jieyouxu:rollup-nq7bf9k, r=jieyouxu
Rollup of 6 pull requests

Successful merges:

 - #115974 (Split core's PanicInfo and std's PanicInfo)
 - #125659 (Remove usage of `isize` in example)
 - #125669 (CI: Update riscv64gc-linux job to Ubuntu 22.04, rename to riscv64gc-gnu)
 - #125684 (Account for existing bindings when suggesting `pin!()`)
 - #126055 (Expand list of trait implementers in E0277 when calling rustc with --verbose)
 - #126174 (Migrate `tests/run-make/prefer-dylib` to `rmake.rs`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/run-make/prefer-dylib/Makefile9
-rw-r--r--tests/run-make/prefer-dylib/rmake.rs16
-rw-r--r--tests/ui/async-await/pin-needed-to-poll-3.rs25
-rw-r--r--tests/ui/async-await/pin-needed-to-poll-3.stderr18
-rw-r--r--tests/ui/duplicate_entry_error.rs4
-rw-r--r--tests/ui/duplicate_entry_error.stderr2
-rw-r--r--tests/ui/panic-handler/panic-handler-std.rs3
-rw-r--r--tests/ui/panic-handler/panic-handler-std.stderr2
8 files changed, 66 insertions, 13 deletions
diff --git a/tests/run-make/prefer-dylib/Makefile b/tests/run-make/prefer-dylib/Makefile
deleted file mode 100644
index cc26e70ae67..00000000000
--- a/tests/run-make/prefer-dylib/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) bar.rs --crate-type=dylib --crate-type=rlib -C prefer-dynamic
-	$(RUSTC) foo.rs -C prefer-dynamic
-	$(call RUN,foo)
-	rm $(TMPDIR)/*bar*
-	$(call FAIL,foo)
diff --git a/tests/run-make/prefer-dylib/rmake.rs b/tests/run-make/prefer-dylib/rmake.rs
new file mode 100644
index 00000000000..ad9fd8a15a2
--- /dev/null
+++ b/tests/run-make/prefer-dylib/rmake.rs
@@ -0,0 +1,16 @@
+//@ ignore-cross-compile
+
+use run_make_support::{cwd, dynamic_lib_name, read_dir, run, run_fail, rustc};
+use std::fs::remove_file;
+use std::process::Command;
+
+fn main() {
+    rustc().input("bar.rs").crate_type("dylib").crate_type("rlib").arg("-Cprefer-dynamic").run();
+    rustc().input("foo.rs").arg("-Cprefer-dynamic").run();
+
+    run("foo");
+
+    remove_file(dynamic_lib_name("bar")).unwrap();
+    // This time the command should fail.
+    run_fail("foo");
+}
diff --git a/tests/ui/async-await/pin-needed-to-poll-3.rs b/tests/ui/async-await/pin-needed-to-poll-3.rs
new file mode 100644
index 00000000000..11ba7d29aba
--- /dev/null
+++ b/tests/ui/async-await/pin-needed-to-poll-3.rs
@@ -0,0 +1,25 @@
+use std::{
+    future::Future,
+    pin::Pin,
+    task::{Context, Poll},
+};
+
+
+struct FutureWrapper<F> {
+    fut: F,
+}
+
+impl<F> Future for FutureWrapper<F>
+where
+    F: Future,
+{
+    type Output = F::Output;
+
+    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
+        let res = self.fut.poll(cx);
+        //~^ ERROR no method named `poll` found for type parameter `F` in the current scope
+        res
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/pin-needed-to-poll-3.stderr b/tests/ui/async-await/pin-needed-to-poll-3.stderr
new file mode 100644
index 00000000000..e4fbef69bac
--- /dev/null
+++ b/tests/ui/async-await/pin-needed-to-poll-3.stderr
@@ -0,0 +1,18 @@
+error[E0599]: no method named `poll` found for type parameter `F` in the current scope
+  --> $DIR/pin-needed-to-poll-3.rs:19:28
+   |
+LL | impl<F> Future for FutureWrapper<F>
+   |      - method `poll` not found for this type parameter
+...
+LL |         let res = self.fut.poll(cx);
+   |                            ^^^^ method not found in `F`
+   |
+help: consider pinning the expression
+   |
+LL ~         let mut pinned = std::pin::pin!(self.fut);
+LL ~         let res = pinned.as_mut().poll(cx);
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/tests/ui/duplicate_entry_error.rs b/tests/ui/duplicate_entry_error.rs
index 7ebbab47095..8e49f57a3df 100644
--- a/tests/ui/duplicate_entry_error.rs
+++ b/tests/ui/duplicate_entry_error.rs
@@ -5,7 +5,9 @@
 
 #![feature(lang_items)]
 
-use std::panic::PanicInfo;
+extern crate core;
+
+use core::panic::PanicInfo;
 
 #[lang = "panic_impl"]
 fn panic_impl(info: &PanicInfo) -> ! {
diff --git a/tests/ui/duplicate_entry_error.stderr b/tests/ui/duplicate_entry_error.stderr
index 3b5998df353..958e9c7527d 100644
--- a/tests/ui/duplicate_entry_error.stderr
+++ b/tests/ui/duplicate_entry_error.stderr
@@ -1,5 +1,5 @@
 error[E0152]: found duplicate lang item `panic_impl`
-  --> $DIR/duplicate_entry_error.rs:11:1
+  --> $DIR/duplicate_entry_error.rs:13:1
    |
 LL | / fn panic_impl(info: &PanicInfo) -> ! {
 LL | |
diff --git a/tests/ui/panic-handler/panic-handler-std.rs b/tests/ui/panic-handler/panic-handler-std.rs
index 91b3997819c..051828ec880 100644
--- a/tests/ui/panic-handler/panic-handler-std.rs
+++ b/tests/ui/panic-handler/panic-handler-std.rs
@@ -1,8 +1,9 @@
 //@ normalize-stderr-test "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
 //@ error-pattern: found duplicate lang item `panic_impl`
 
+extern crate core;
 
-use std::panic::PanicInfo;
+use core::panic::PanicInfo;
 
 #[panic_handler]
 fn panic(info: PanicInfo) -> ! {
diff --git a/tests/ui/panic-handler/panic-handler-std.stderr b/tests/ui/panic-handler/panic-handler-std.stderr
index 48c216ce27e..caae16118ef 100644
--- a/tests/ui/panic-handler/panic-handler-std.stderr
+++ b/tests/ui/panic-handler/panic-handler-std.stderr
@@ -1,5 +1,5 @@
 error[E0152]: found duplicate lang item `panic_impl`
-  --> $DIR/panic-handler-std.rs:8:1
+  --> $DIR/panic-handler-std.rs:9:1
    |
 LL | / fn panic(info: PanicInfo) -> ! {
 LL | |     loop {}