Skip to content

Even though Box<Reader> is a Reader, Box<Reader + Send> is not a Reader. #15906

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

Closed
reem opened this issue Jul 23, 2014 · 2 comments
Closed

Even though Box<Reader> is a Reader, Box<Reader + Send> is not a Reader. #15906

reem opened this issue Jul 23, 2014 · 2 comments

Comments

@reem
Copy link
Contributor

reem commented Jul 23, 2014

use std::io::{MemReader, MemWriter};
use std::io::util::copy;

fn main() {
    let mut rain = box MemReader::new(vec![1, 2, 3]) as Box<Reader>;
    let mut pool = MemWriter::new();
    copy(&mut rain, &mut pool);
}

Compiles.

use std::io::{MemReader, MemWriter};
use std::io::util::copy;

fn main() {
    let mut rain = box MemReader::new(vec![1, 2, 3]) as Box<Reader + Send>;
    let mut pool = MemWriter::new();
    copy(&mut rain, &mut pool);
}

Fails with:

<anon>:7:5: 7:9 error: failed to find an implementation of trait std::io::Reader for Box<std::io::Reader:Send>
<anon>:7     copy(&mut rain, &mut pool);
             ^~~~
playpen: application terminated with error code 101

This seems like it should work and is very non-ergonomic if it doesn't work.

@alexcrichton
Copy link
Member

cc @nikomatsakis, @pcwalton, I think this is fallout of more strict bounds matching recently.

@ghost
Copy link

ghost commented Nov 19, 2014

Closing as a dupe of #18524.

@ghost ghost closed this as completed Nov 19, 2014
This issue was closed.
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

No branches or pull requests

2 participants