Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crank up invalid value lint #63657

Merged
merged 10 commits into from
Aug 18, 2019
Merged

Crank up invalid value lint #63657

merged 10 commits into from
Aug 18, 2019

Conversation

RalfJung
Copy link
Member

  • Warn against uninit bool and char.
  • Warn against 0-init NonNull and friends
  • Detect transmute-from-0 as zero-initialization (seen in the wild)

@rust-highfive

This comment has been minimized.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2019
src/librustc_lint/builtin.rs Outdated Show resolved Hide resolved
src/librustc_lint/builtin.rs Outdated Show resolved Hide resolved
src/librustc_lint/builtin.rs Show resolved Hide resolved
@Centril
Copy link
Contributor

Centril commented Aug 17, 2019

r? @Centril

r=me with comments addressed :)

@rust-highfive rust-highfive assigned Centril and unassigned varkor Aug 17, 2019
@rust-highfive

This comment has been minimized.

RalfJung and others added 3 commits August 17, 2019 13:42
@RalfJung
Copy link
Member Author

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 17, 2019

📌 Commit f19087d has been approved by Centril

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2019
if let hir::ExprKind::Path(ref qpath) = path_expr.node {
let def_id = cx.tables.qpath_res(qpath, path_expr.hir_id).opt_def_id()?;

if cx.match_def_path(def_id, &ZEROED_PATH) {
Copy link
Contributor

@tesuji tesuji Aug 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to borrow ZEROED_PATH here.
(It's already a slice).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks.

@RalfJung
Copy link
Member Author

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 17, 2019

📌 Commit 72d9fe8 has been approved by Centril

@bors
Copy link
Contributor

bors commented Aug 17, 2019

⌛ Testing commit 72d9fe8 with merge 602e7dec16b4db3eddeb072ec9489a544d998f6b...

@bors
Copy link
Contributor

bors commented Aug 17, 2019

💔 Test failed - checks-azure

@rust-highfive

This comment has been minimized.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 17, 2019
@RalfJung
Copy link
Member Author

Ah, this is caused by musl not being able to display spans in libstd... I cannot test with Vec. :/

@RalfJung
Copy link
Member Author

@bors r=Centril

@bors
Copy link
Contributor

bors commented Aug 17, 2019

📌 Commit 3288be5 has been approved by Centril

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2019
Centril added a commit to Centril/rust that referenced this pull request Aug 17, 2019
Crank up invalid value lint

* Warn against uninit `bool` and `char`.
* Warn against 0-init `NonNull` and friends
* Detect transmute-from-0 as zero-initialization ([seen in the wild](glium/glium#1775 (comment)))
bors added a commit that referenced this pull request Aug 17, 2019
Rollup of 5 pull requests

Successful merges:

 - #62451 (Add APIs for uninitialized Box, Rc, and Arc. (Plus get_mut_unchecked))
 - #63487 (Remove meaningless comments in src/test)
 - #63657 (Crank up invalid value lint)
 - #63667 (resolve: Properly integrate derives and `macro_rules` scopes)
 - #63669 (fix typos in mir/interpret)

Failed merges:

r? @ghost
@bors bors merged commit 3288be5 into rust-lang:master Aug 18, 2019
@RalfJung RalfJung deleted the invalid_value branch August 18, 2019 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants