-
Notifications
You must be signed in to change notification settings - Fork 13.4k
debug-assert ptr sanity in ptr::write #69509
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,8 +78,8 @@ fn verify_stack_usage(before_ptr: *mut Vec<Big>) { | |
let stack_usage = isize::abs( | ||
(&mut stack_var as *mut _ as isize) - | ||
(before_ptr as isize)) as usize; | ||
// give space for 2 copies of `Big` + 128 "misc" bytes. | ||
if stack_usage > mem::size_of::<Big>() * 2 + 128 { | ||
// give space for 2 copies of `Big` + 256 "misc" bytes. | ||
if stack_usage > mem::size_of::<Big>() * 2 + 256 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could this constant be binary searched so it's less than double the previous value? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought powers of two were nice, but sure. ;) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 208 is the smallest value that works for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't support a target with larger sizes/alignments than x64 I don't think. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh nevermind, they could less efficient in their stack usage even if the types aren't larger. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's what I meant. |
||
panic!("used {} bytes of stack, but `struct Big` is only {} bytes", | ||
stack_usage, mem::size_of::<Big>()); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.