update test ui for raw-ptr borrow inside generator
This commit is contained in:
parent
42b6ed13be
commit
cd7b5edc2c
4 changed files with 44 additions and 2 deletions
|
@ -12,8 +12,8 @@ use rustc_errors::{
|
|||
error_code, pluralize, struct_span_err, Applicability, DiagnosticBuilder, Style,
|
||||
};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::intravisit::Visitor;
|
||||
use rustc_hir::Node;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
|
|
|
@ -25,7 +25,7 @@ LL | let _x = get().await;
|
|||
...
|
||||
LL | }
|
||||
| - `client` is later dropped here
|
||||
help: consider moving this method call into a `let` binding to create a shorter lived borrow
|
||||
help: consider moving this into a `let` binding to create a shorter lived borrow
|
||||
--> $DIR/issue-64130-4-async-move.rs:19:15
|
||||
|
|
||||
LL | match client.status() {
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
// edition:2018
|
||||
|
||||
struct Foo(*const u8);
|
||||
|
||||
unsafe impl Send for Foo {}
|
||||
|
||||
async fn bar(_: Foo) {}
|
||||
|
||||
fn assert_send<T: Send>(_: T) {}
|
||||
|
||||
fn main() {
|
||||
assert_send(async {
|
||||
//~^ ERROR future cannot be sent between threads safely
|
||||
bar(Foo(std::ptr::null())).await;
|
||||
})
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:12:5
|
||||
|
|
||||
LL | fn assert_send<T: Send>(_: T) {}
|
||||
| ----------- ---- required by this bound in `assert_send`
|
||||
...
|
||||
LL | assert_send(async {
|
||||
| ^^^^^^^^^^^ future returned by `main` is not `Send`
|
||||
|
|
||||
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `*const u8`
|
||||
note: future is not `Send` as this value is used across an await
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:9
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ^^^^^^^^----------------^^^^^^^^- `std::ptr::null()` is later dropped here
|
||||
| | |
|
||||
| | has type `*const u8`
|
||||
| await occurs here, with `std::ptr::null()` maybe used later
|
||||
help: consider moving this into a `let` binding to create a shorter lived borrow
|
||||
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
|
||||
|
|
||||
LL | bar(Foo(std::ptr::null())).await;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue