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

Add AioCb::from_boxed_slice #582

Merged
merged 1 commit into from
Apr 16, 2017
Merged

Add AioCb::from_boxed_slice #582

merged 1 commit into from
Apr 16, 2017

Conversation

asomers
Copy link
Member

@asomers asomers commented Apr 15, 2017

The existing AioCb constructors work for simple programs where
everything is stored on the stack. But in more complicated programs the
borrow checker can't prove that a buffer will outlive the AioCb that
references it. Fix this problem by introducting
AioCb::from_boxed_slice, which takes a reference-counted buffer.

Fixes #575

src/sys/aio.rs Outdated
/// Keeps a reference to a Boxed slice
boxed(Rc<Box<[u8]>>),
/// Keeps a reference to a slice
phantom(PhantomData<&'a mut [u8]>)
Copy link
Member

Choose a reason for hiding this comment

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

nit: Indentation on this block seems off

@posborne
Copy link
Member

One super minor nit, but otherwise the change looks good to me.

@asomers
Copy link
Member Author

asomers commented Apr 16, 2017

good catch. I'll fix it and merge.

@asomers
Copy link
Member Author

asomers commented Apr 16, 2017

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 16, 2017

Merge conflict

@homu
Copy link
Contributor

homu commented Apr 16, 2017

☔ The latest upstream changes (presumably 8c47de4) made this pull request unmergeable. Please resolve the merge conflicts.

The existing AioCb constructors work for simple programs where
everything is stored on the stack.  But in more complicated programs the
borrow checker can't prove that a buffer will outlive the AioCb that
references it.  Fix this problem by introducting
AioCb::from_boxed_slice, which takes a reference-counted buffer.

Fixes nix-rust#575
@asomers
Copy link
Member Author

asomers commented Apr 16, 2017

bors +r

@posborne
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Apr 16, 2017
582: Add AioCb::from_boxed_slice r=posborne
The existing AioCb constructors work for simple programs where
everything is stored on the stack.  But in more complicated programs the
borrow checker can't prove that a buffer will outlive the AioCb that
references it.  Fix this problem by introducting
AioCb::from_boxed_slice, which takes a reference-counted buffer.

Fixes #575
@asomers
Copy link
Member Author

asomers commented Apr 16, 2017

thanks @posborne . I obviously need to work on my bors-foo.

@bors
Copy link
Contributor

bors bot commented Apr 16, 2017

Build succeeded

@bors bors bot merged commit d3ad3c7 into nix-rust:master Apr 16, 2017
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.

None yet

3 participants