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

Const propagate casts #52498

Merged
merged 3 commits into from
Jul 20, 2018
Merged

Const propagate casts #52498

merged 3 commits into from
Jul 20, 2018

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 18, 2018

fixes #49760

So... This fixes the original issue about the missing warnings.

But our test suite contains fun things like

fn foo() {}
assert_eq!(foo as i16, foo as usize as i16);

Which, will result in

a raw memory access tried to access part of a pointer value as raw bytes

on both sides of the assertion. Because well... that's exactly what's going on! We're ripping out 16 bits of a pointer.

@rust-highfive
Copy link
Collaborator

r? @nikomatsakis

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 18, 2018
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jul 19, 2018

📌 Commit 9329957 has been approved by nikomatsakis

@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 Jul 19, 2018
@bors
Copy link
Contributor

bors commented Jul 20, 2018

⌛ Testing commit 9329957 with merge 509cbf3...

bors added a commit that referenced this pull request Jul 20, 2018
Const propagate casts

fixes #49760

So... This fixes the original issue about the missing warnings.

But our test suite contains fun things like

```rust
fn foo() {}
assert_eq!(foo as i16, foo as usize as i16);
```

Which, will result in

> a raw memory access tried to access part of a pointer value as raw bytes

on both sides of the assertion. Because well... that's exactly what's going on! We're ripping out 16 bits of a pointer.
@bors
Copy link
Contributor

bors commented Jul 20, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 509cbf3 to master...

@bors bors merged commit 9329957 into rust-lang:master Jul 20, 2018
@oli-obk oli-obk deleted the const_prop branch August 2, 2018 11:04
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.

no warning for div by zero: let x = 1 / false as u8;
4 participants