Skip to content

Rustup #3711

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

Merged
merged 7 commits into from
Jan 28, 2019
Merged

Rustup #3711

merged 7 commits into from
Jan 28, 2019

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jan 28, 2019

fixes #3709

I'm currently in the process of making rustc's deprecation lint emit the AtomicFoo::new(0) suggestion

ty::Ref(_, tam, _) => match tam.sty {
ty::Str => {
let alloc = tcx.alloc_map.lock().unwrap_memory(ptr.alloc_id);
let offset = ptr.offset.bytes().try_into().expect("too-large pointer offset");
let n = n as usize;
let n = usize::try_from(n).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling try_from() just to instantly unwrap it looks odd.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea it is, but it's similar to foo.checked_add(bar).unwrap() which prevents silent overflow irrelevant of the compiler flags.

@oli-obk
Copy link
Contributor Author

oli-obk commented Jan 28, 2019

@bors r+

@bors
Copy link
Contributor

bors commented Jan 28, 2019

📌 Commit 6033294 has been approved by oli-obk

@bors
Copy link
Contributor

bors commented Jan 28, 2019

⌛ Testing commit 6033294 with merge 4a2116b...

bors added a commit that referenced this pull request Jan 28, 2019
Rustup

fixes #3709

I'm currently in the process of making rustc's deprecation lint emit the `AtomicFoo::new(0)` suggestion
@bors
Copy link
Contributor

bors commented Jan 28, 2019

☀️ Test successful - checks-travis, status-appveyor
Approved by: oli-obk
Pushing 4a2116b to master...

@bors bors merged commit 6033294 into master Jan 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

needs rustup
3 participants