1
1
error[E0740]: unions cannot contain fields that may need dropping
2
- --> $DIR/field_checks.rs:25 :5
2
+ --> $DIR/field_checks.rs:24 :5
3
3
|
4
4
LL | a: String,
5
5
| ^^^^^^^^^
@@ -11,7 +11,7 @@ LL | a: std::mem::ManuallyDrop<String>,
11
11
| +++++++++++++++++++++++ +
12
12
13
13
error[E0740]: unions cannot contain fields that may need dropping
14
- --> $DIR/field_checks.rs:29 :5
14
+ --> $DIR/field_checks.rs:28 :5
15
15
|
16
16
LL | a: std::cell::RefCell<i32>,
17
17
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -23,7 +23,7 @@ LL | a: std::mem::ManuallyDrop<std::cell::RefCell<i32>>,
23
23
| +++++++++++++++++++++++ +
24
24
25
25
error[E0740]: unions cannot contain fields that may need dropping
26
- --> $DIR/field_checks.rs:33 :5
26
+ --> $DIR/field_checks.rs:32 :5
27
27
|
28
28
LL | a: T,
29
29
| ^^^^
@@ -35,7 +35,7 @@ LL | a: std::mem::ManuallyDrop<T>,
35
35
| +++++++++++++++++++++++ +
36
36
37
37
error[E0740]: unions cannot contain fields that may need dropping
38
- --> $DIR/field_checks.rs:45 :5
38
+ --> $DIR/field_checks.rs:44 :5
39
39
|
40
40
LL | nest: U5,
41
41
| ^^^^^^^^
@@ -46,6 +46,18 @@ help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>
46
46
LL | nest: std::mem::ManuallyDrop<U5>,
47
47
| +++++++++++++++++++++++ +
48
48
49
- error: aborting due to 4 previous errors
49
+ error[E0740]: unions cannot contain fields that may need dropping
50
+ --> $DIR/field_checks.rs:48:5
51
+ |
52
+ LL | nest: [U5; 0],
53
+ | ^^^^^^^^^^^^^
54
+ |
55
+ = note: a type is guaranteed not to need dropping when it implements `Copy`, or when it is the special `ManuallyDrop<_>` type
56
+ help: when the type does not implement `Copy`, wrap it inside a `ManuallyDrop<_>` and ensure it is manually dropped
57
+ |
58
+ LL | nest: std::mem::ManuallyDrop<[U5; 0]>,
59
+ | +++++++++++++++++++++++ +
60
+
61
+ error: aborting due to 5 previous errors
50
62
51
63
For more information about this error, try `rustc --explain E0740`.
0 commit comments