Skip to content

Commit cd7b5ed

Browse files
committed
update test ui for raw-ptr borrow inside generator
1 parent 42b6ed1 commit cd7b5ed

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

src/librustc/traits/error_reporting/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use rustc_errors::{
1212
error_code, pluralize, struct_span_err, Applicability, DiagnosticBuilder, Style,
1313
};
1414
use rustc_hir as hir;
15-
use rustc_hir::def_id::DefId;
1615
use rustc_hir::def::DefKind;
16+
use rustc_hir::def_id::DefId;
1717
use rustc_hir::intravisit::Visitor;
1818
use rustc_hir::Node;
1919
use rustc_span::source_map::SourceMap;

src/test/ui/async-await/issue-64130-4-async-move.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ LL | let _x = get().await;
2525
...
2626
LL | }
2727
| - `client` is later dropped here
28-
help: consider moving this method call into a `let` binding to create a shorter lived borrow
28+
help: consider moving this into a `let` binding to create a shorter lived borrow
2929
--> $DIR/issue-64130-4-async-move.rs:19:15
3030
|
3131
LL | match client.status() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// edition:2018
2+
3+
struct Foo(*const u8);
4+
5+
unsafe impl Send for Foo {}
6+
7+
async fn bar(_: Foo) {}
8+
9+
fn assert_send<T: Send>(_: T) {}
10+
11+
fn main() {
12+
assert_send(async {
13+
//~^ ERROR future cannot be sent between threads safely
14+
bar(Foo(std::ptr::null())).await;
15+
})
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
error: future cannot be sent between threads safely
2+
--> $DIR/issue-65436-raw-ptr-not-send.rs:12:5
3+
|
4+
LL | fn assert_send<T: Send>(_: T) {}
5+
| ----------- ---- required by this bound in `assert_send`
6+
...
7+
LL | assert_send(async {
8+
| ^^^^^^^^^^^ future returned by `main` is not `Send`
9+
|
10+
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `*const u8`
11+
note: future is not `Send` as this value is used across an await
12+
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:9
13+
|
14+
LL | bar(Foo(std::ptr::null())).await;
15+
| ^^^^^^^^----------------^^^^^^^^- `std::ptr::null()` is later dropped here
16+
| | |
17+
| | has type `*const u8`
18+
| await occurs here, with `std::ptr::null()` maybe used later
19+
help: consider moving this into a `let` binding to create a shorter lived borrow
20+
--> $DIR/issue-65436-raw-ptr-not-send.rs:14:13
21+
|
22+
LL | bar(Foo(std::ptr::null())).await;
23+
| ^^^^^^^^^^^^^^^^^^^^^
24+
25+
error: aborting due to previous error
26+

0 commit comments

Comments
 (0)