You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.rs
+11-3
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,14 @@
4
4
5
5
use std::thread;
6
6
7
+
#[derive(Debug)]
8
+
structFoo(i32);
9
+
implDropforFoo{
10
+
fndrop(&mutself){
11
+
println!("{:?} dropped",self.0);
12
+
}
13
+
}
14
+
7
15
/* Test Send Trait Migration */
8
16
structSendPointer(*muti32);
9
17
unsafeimplSendforSendPointer{}
@@ -42,19 +50,19 @@ fn test_sync_trait() {
42
50
}
43
51
44
52
/* Test Clone Trait Migration */
45
-
structS(String);
53
+
structS(Foo);
46
54
structT(i32);
47
55
48
56
structU(S,T);
49
57
50
58
implCloneforU{
51
59
fnclone(&self) -> Self{
52
-
U(S(String::from("Hello World")),T(0))
60
+
U(S(Foo(0)),T(0))
53
61
}
54
62
}
55
63
56
64
fntest_clone_trait(){
57
-
let f = U(S(String::from("Hello World")),T(0));
65
+
let f = U(S(Foo(0)),T(0));
58
66
let c = || {
59
67
//~^ ERROR: `Clone` trait implementation for closure and drop order
60
68
//~| NOTE: in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
Copy file name to clipboardExpand all lines: src/test/ui/closures/2229_closure_analysis/migrations/auto_traits.stderr
+3-3
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
error: changes to closure capture in Rust 2021 will affect `Send` trait implementation for closure
2
-
--> $DIR/auto_traits.rs:14:19
2
+
--> $DIR/auto_traits.rs:22:19
3
3
|
4
4
LL | thread::spawn(move || unsafe {
5
5
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Send` as `fptr` implements `Send`, but in Rust 2021, this closure will no longer implement `Send` as `fptr.0` does not implement `Send`
@@ -24,7 +24,7 @@ LL | *fptr.0 = 20;
24
24
...
25
25
26
26
error: changes to closure capture in Rust 2021 will affect `Sync`, `Send` trait implementation for closure
27
-
--> $DIR/auto_traits.rs:34:19
27
+
--> $DIR/auto_traits.rs:42:19
28
28
|
29
29
LL | thread::spawn(move || unsafe {
30
30
| ^^^^^^^^^^^^^^ in Rust 2018, this closure implements `Sync`, `Send` as `fptr` implements `Sync`, `Send`, but in Rust 2021, this closure will no longer implement `Sync`, `Send` as `fptr.0.0` does not implement `Sync`, `Send`
@@ -44,7 +44,7 @@ LL | *fptr.0.0 = 20;
44
44
...
45
45
46
46
error: changes to closure capture in Rust 2021 will affect `Clone` trait implementation for closure and drop order
47
-
--> $DIR/auto_traits.rs:58:13
47
+
--> $DIR/auto_traits.rs:66:13
48
48
|
49
49
LL | let c = || {
50
50
| ^^ in Rust 2018, this closure implements `Clone` as `f` implements `Clone`, but in Rust 2021, this closure will no longer implement `Clone` as `f.1` does not implement `Clone`
0 commit comments