Skip to content

Commit

Permalink
needs -> might need
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 20, 2020
1 parent 63bdb3a commit af309cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl UnsafetyViolationDetails {
and cause data races: all of these are undefined behavior",
),
AssignToDroppingUnionField => (
"assignment to union field that needs dropping",
"assignment to union field that might need dropping",
"the previous content of the field will be dropped, which causes undefined \
behavior if the field was not properly initialized",
),
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/union/union-unsafe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ fn deref_union_field(mut u: URef) {
}

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

Expand Down
8 changes: 4 additions & 4 deletions src/test/ui/union/union-unsafe.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ LL | *(u.p) = 13;
|
= note: the field may not be properly initialized: using uninitialized data will cause undefined behavior

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

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

Expand Down

0 comments on commit af309cc

Please sign in to comment.