-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rustup #3711
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
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(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@bors r+ |
📌 Commit 6033294 has been approved by |
Rustup fixes #3709 I'm currently in the process of making rustc's deprecation lint emit the `AtomicFoo::new(0)` suggestion
☀️ Test successful - checks-travis, status-appveyor |
fixes #3709
I'm currently in the process of making rustc's deprecation lint emit the
AtomicFoo::new(0)
suggestion