-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
io: remove poll_{read,write}_buf from traits #2882
Conversation
tokio-util/src/io/mod.rs
Outdated
ready!(io.poll_read(cx, &mut b))?; | ||
let n = b.filled().len(); | ||
|
||
// Safety: we can assume `n` bytes were read, since they are in`filled`. |
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.
I believe this is this footgun: #2827
let n = b.filled().len(); | ||
|
||
// Safety: we can assume `n` bytes were read, since they are in`filled`. | ||
assert_eq!(orig, b.filled().as_ptr()); |
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.
@seanmonstar does this fix the footgun?
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.
I believe so! cc @sfackler
These functions have object safety issues. It also has been decided to
avoid vectored operations on the I/O traits. A later PR will bring back
vectored operations on specific types that support them.
Refs: #2879, #2716