mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
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
This commit is contained in:
@@ -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() {}
|
||||
@@ -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`.
|
||||
@@ -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) -> ! {
|
||||
|
||||
@@ -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 | |
|
||||
|
||||
@@ -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) -> ! {
|
||||
|
||||
@@ -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 {}
|
||||
|
||||
Reference in New Issue
Block a user