Skip to content

Commit

Permalink
Rollup merge of rust-lang#95852 - niluxv:strict-provenance-lint-fixup…
Browse files Browse the repository at this point in the history
…, r=Dylan-DPC

Fix missing space in lossy provenance cast lint

See rust-lang#95599 (comment)
  • Loading branch information
Dylan-DPC authored Apr 10, 2022
2 parents 2842d44 + 1834c21 commit 4f6df46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_typeck/src/check/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ impl<'a, 'tcx> CastCheck<'tcx> {
err.help(msg);
}
err.help(
"if you can't comply with strict provenance and need to expose the pointer\
"if you can't comply with strict provenance and need to expose the pointer \
provenance you can use `.expose_addr()` instead"
);

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/lint/lint-strict-provenance-lossy-casts.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ note: the lint level is defined here
|
LL | #![deny(lossy_provenance_casts)]
| ^^^^^^^^^^^^^^^^^^^^^^
= help: if you can't comply with strict provenance and need to expose the pointerprovenance you can use `.expose_addr()` instead
= help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead

error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `u32`
--> $DIR/lint-strict-provenance-lossy-casts.rs:9:22
|
LL | let addr_32bit = &x as *const u8 as u32;
| ^^^^^^^^^^^^^^^^^^^^^^ help: use `.addr()` to obtain the address of a pointer: `(&x as *const u8).addr() as u32`
|
= help: if you can't comply with strict provenance and need to expose the pointerprovenance you can use `.expose_addr()` instead
= help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_addr()` instead

error: aborting due to 2 previous errors

0 comments on commit 4f6df46

Please sign in to comment.