Skip to content

Commit af309cc

Browse files
committed
needs -> might need
1 parent 63bdb3a commit af309cc

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

compiler/rustc_middle/src/mir/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl UnsafetyViolationDetails {
9595
and cause data races: all of these are undefined behavior",
9696
),
9797
AssignToDroppingUnionField => (
98-
"assignment to union field that needs dropping",
98+
"assignment to union field that might need dropping",
9999
"the previous content of the field will be dropped, which causes undefined \
100100
behavior if the field was not properly initialized",
101101
),

src/test/ui/union/union-unsafe.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ fn deref_union_field(mut u: URef) {
3232
}
3333

3434
fn assign_noncopy_union_field(mut u: URefCell) {
35-
u.a = (RefCell::new(0), 1); //~ ERROR assignment to union field that needs dropping
36-
u.a.0 = RefCell::new(0); //~ ERROR assignment to union field that needs dropping
35+
u.a = (RefCell::new(0), 1); //~ ERROR assignment to union field that might need dropping
36+
u.a.0 = RefCell::new(0); //~ ERROR assignment to union field that might need dropping
3737
u.a.1 = 1; // OK
3838
}
3939

src/test/ui/union/union-unsafe.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ LL | *(u.p) = 13;
66
|
77
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
88

9-
error[E0133]: assignment to union field that needs dropping is unsafe and requires unsafe function or block
9+
error[E0133]: assignment to union field that might need dropping is unsafe and requires unsafe function or block
1010
--> $DIR/union-unsafe.rs:35:5
1111
|
1212
LL | u.a = (RefCell::new(0), 1);
13-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that needs dropping
13+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that might need dropping
1414
|
1515
= note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
1616

17-
error[E0133]: assignment to union field that needs dropping is unsafe and requires unsafe function or block
17+
error[E0133]: assignment to union field that might need dropping is unsafe and requires unsafe function or block
1818
--> $DIR/union-unsafe.rs:36:5
1919
|
2020
LL | u.a.0 = RefCell::new(0);
21-
| ^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that needs dropping
21+
| ^^^^^^^^^^^^^^^^^^^^^^^ assignment to union field that might need dropping
2222
|
2323
= note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
2424

0 commit comments

Comments
 (0)