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

Switch to new std::io #347

Closed
John-Nagle opened this issue Feb 28, 2015 · 18 comments · Fixed by #354
Closed

Switch to new std::io #347

John-Nagle opened this issue Feb 28, 2015 · 18 comments · Fixed by #354

Comments

@John-Nagle
Copy link

Installed Rust nightly build, after not using Rust for 3 weeks. Hyper won't compile any more.
The I/O libraries changed. Again. Not your fault. Sigh.

Compiling hyper v0.2.1
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:215:25: 215:29 error: mismatched types:
 expected `&std::path::Path`,
    found `&std::old_path::posix::Path`
(expected struct `std::path::Path`,
    found struct `std::old_path::posix::Path`) [E0308]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:215                         cert, X509FileType::PEM).map(lift_ssl_error));
                                                                                                              ^~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:19:1: 24:2 note: in expansion of try_some!
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:214:17: 215:71 note: expansion site
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:217:25: 217:28 error: mismatched types:
 expected `&std::path::Path`,
    found `&std::old_path::posix::Path`
(expected struct `std::path::Path`,
    found struct `std::old_path::posix::Path`) [E0308]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:217                         key, X509FileType::PEM).map(lift_ssl_error));
                                                                                                              ^~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:19:1: 24:2 note: in expansion of try_some!
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:216:17: 217:70 note: expansion site
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:243:23: 243:57 error: the trait `std::io::Read` is not implemented for the type `std::old_io::net::tcp::TcpStream` [E0277]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:243                 match SslStream::<TcpStream>::new_server(&**ssl_context, stream) {
                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:243:23: 243:57 error: the trait `std::io::Write` is not implemented for the type `std::old_io::net::tcp::TcpStream` [E0277]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:243                 match SslStream::<TcpStream>::new_server(&**ssl_context, stream) {
                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:249:42: 249:48 error: attempted access of field `desc` on type `&std::io::error::Error`, but no field with that name was found
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:249                             detail: Some(e.desc.to_string())
                                                                                                                               ^~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:289:55: 289:64 error: type `&mut openssl::ssl::SslStream<std::old_io::net::tcp::TcpStream>` does not implement any method in scope named `read`
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:289             HttpStream::Https(ref mut inner) => inner.read(buf)
                                                                                                                                            ^~~~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:299:55: 299:69 error: type `&mut openssl::ssl::SslStream<std::old_io::net::tcp::TcpStream>` does not implement any method in scope named `write_all`
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:299             HttpStream::Https(ref mut inner) => inner.write_all(msg)
                                                                                                                                            ^~~~~~~~~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:306:55: 306:62 error: type `&mut openssl::ssl::SslStream<std::old_io::net::tcp::TcpStream>` does not implement any method in scope named `flush`
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:306             HttpStream::Https(ref mut inner) => inner.flush(),
                                                                                                                                            ^~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:315:55: 315:64 error: type `&mut openssl::ssl::SslStream<std::old_io::net::tcp::TcpStream>` does not implement any method in scope named `get_mut`
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:315             HttpStream::Https(ref mut inner) => inner.get_mut().peer_name()
                                                                                                                                            ^~~~~~~~~
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346:35: 346:49 error: the trait `std::io::Read` is not implemented for the type `std::old_io::net::tcp::TcpStream` [E0277]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346                 let stream = try!(SslStream::new(&context, stream).map_err(lift_ssl_error));
                                                                                                                        ^~~~~~~~~~~~~~
<std macros>:1:1: 6:57 note: in expansion of try!
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346:30: 346:93 note: expansion site
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346:35: 346:49 error: the trait `std::io::Write` is not implemented for the type `std::old_io::net::tcp::TcpStream` [E0277]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346                 let stream = try!(SslStream::new(&context, stream).map_err(lift_ssl_error));
                                                                                                                        ^~~~~~~~~~~~~~
<std macros>:1:1: 6:57 note: in expansion of try!
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:346:30: 346:93 note: expansion site
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:363:29: 363:32 error: mismatched types:
 expected `std::old_io::IoError`,
    found `std::io::error::Error`
(expected struct `std::old_io::IoError`,
    found struct `std::io::error::Error`) [E0308]
/home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.2.1/src/net.rs:363         StreamError(err) => err,
                                                                                                                  ^~~
error: aborting due to 12 previous errors
Could not compile `hyper`.
@ghost
Copy link

ghost commented Feb 28, 2015

What is your rustc version? are you updated?

@John-Nagle
Copy link
Author

rustc 1.0.0-nightly (4db0b3246 2015-02-25) (built 2015-02-26)
That's two hours old; it may be obsolete by now.

@John-Nagle
Copy link
Author

It looks like old_io just went away. Although I'm not entirely sure. Here's the reddit discussion:

http://www.reddit.com/r/rust/comments/2wrc3c/read_from_stdin_in_alpha_2_without_using_old_io/

@golddranks
Copy link

No, it's the upstream changes that broke the thing. OpenSSL and Cookie now use new paths. (Sorry, I kinda participated in making that happen, but then again... THEY broke because their upstream dependencies moved to use the new paths. So something's gotta be done.)

@golddranks
Copy link

Btw. I'm currently tinkering with Hyper, trying to fix things. No promises (I'm a rust noob), but I'll send a PR right away if I manage to get it to build.

@reem
Copy link
Contributor

reem commented Feb 28, 2015

I should've said something earlier, but I actually started working on a fix a while ago (hours ago). The io changes touch a lot of code, so the fix is very large. I'm haven't finished the entire thing yet, and am going to bed, but will finish up tomorrow.

@seanmonstar
Copy link
Member

@reem i'm just about done with the patch. I found out from sfackler that the change was coming, and started working on it right away.

@John-Nagle
Copy link
Author

Thanks for all the quick effort.

"My dear, here we must run as fast as we can, just to stay in place." - Alice in Wonderland

@reem
Copy link
Contributor

reem commented Feb 28, 2015

@seanmonstar I'll defer to your patch then, instead of finishing mine.

@reem
Copy link
Contributor

reem commented Mar 1, 2015

@seanmonstar any progress? I can work on a patch if you're busy.

@seanmonstar
Copy link
Member

@reem yes progress. Everything compiles, just fixing up a couple broken tests. Should have PR shortly.

@seanmonstar seanmonstar changed the title Rust changes broke it again/ Switch to new std::io Mar 1, 2015
seanmonstar added a commit that referenced this issue Mar 1, 2015
All instances of `old_io` and `old_path` were switched to use the new
shiny `std::io`, `std::net`, and `std::path` modules. This means that
`Request` and `Response` implement `Read` and `Write` now.

Because of the changes to `TcpListener`, this also takes the opportunity
to correct the method usage of `Server`. As with other
languages/frameworks, the server is first created with a handler, and
then a host/port is passed to a `listen` method. This reverses what
`Server` used to do.

Closes #347

BREAKING CHANGE: Check the docs. Everything was touched.
seanmonstar added a commit that referenced this issue Mar 1, 2015
All instances of `old_io` and `old_path` were switched to use the new
shiny `std::io`, `std::net`, and `std::path` modules. This means that
`Request` and `Response` implement `Read` and `Write` now.

Because of the changes to `TcpListener`, this also takes the opportunity
to correct the method usage of `Server`. As with other
languages/frameworks, the server is first created with a handler, and
then a host/port is passed to a `listen` method. This reverses what
`Server` used to do.

Closes #347

BREAKING CHANGE: Check the docs. Everything was touched.
seanmonstar added a commit that referenced this issue Mar 1, 2015
All instances of `old_io` and `old_path` were switched to use the new
shiny `std::io`, `std::net`, and `std::path` modules. This means that
`Request` and `Response` implement `Read` and `Write` now.

Because of the changes to `TcpListener`, this also takes the opportunity
to correct the method usage of `Server`. As with other
languages/frameworks, the server is first created with a handler, and
then a host/port is passed to a `listen` method. This reverses what
`Server` used to do.

Closes #347

BREAKING CHANGE: Check the docs. Everything was touched.
@softprops
Copy link
Contributor

just ran into the same issue :/

@miketang84
Copy link

the same :(

@pyfisch
Copy link
Contributor

pyfisch commented Mar 2, 2015

@softprops @daogangtang You can use PR #354 for now.

@softprops
Copy link
Contributor

Yep, I'm depending on git revs for now

[dependencies.hyper]
git = "https://github.com/hyperium/hyper.git"
rev = "2ce4385c163e1a9a393c89743cf04e047b776e83"

@John-Nagle
Copy link
Author

Is "Read" live in the rev mentioned above? I'm getting

src/rssread.rs:258:28: 258:34 error: type `hyper::client::response::Response` does not implement any method in scope named `Read`
src/rssread.rs:258     let string = match res.Read() {

Should I wait a few more days for things to settle down?

seanmonstar added a commit that referenced this issue Mar 3, 2015
All instances of `old_io` and `old_path` were switched to use the new
shiny `std::io`, `std::net`, and `std::path` modules. This means that
`Request` and `Response` implement `Read` and `Write` now.

Because of the changes to `TcpListener`, this also takes the opportunity
to correct the method usage of `Server`. As with other
languages/frameworks, the server is first created with a handler, and
then a host/port is passed to a `listen` method. This reverses what
`Server` used to do.

Closes #347

BREAKING CHANGE: Check the docs. Everything was touched.
@seanmonstar
Copy link
Member

@John-Nagle Read is the new trait replacing Reader. You need to import std::io::Read, as it isn't part of the prelude. Then, you can use methods read, read_to_end, and read_to_string.

@John-Nagle
Copy link
Author

OK, got that. My RSS reader is working again with the latest Hyper, thanks to all of you.

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 a pull request may close this issue.

7 participants