-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Update hyper to latest nightly #324
Conversation
Send no longer implies 'static; update needed lifetime bounds.
Seems that travis' rust is outdated. I tested on |
When using the compiler version mentioned by @renato-zannon, the build, tests and benchmarks work for me too. |
Oh, actually, the benchmarks seem to hang, like a deadlock of some sort. I am on OSX 10.10.2, in case it matters. Also it's the first time I am running hyper benchmarks, and thus can't tell if this hang is new. |
@renato-zannon I may have been premature with that comment. Unless we want |
work: F, | ||
threads: usize) -> JoinGuard<'static, ()> { | ||
pub fn accept<F>(self, work: F, threads: usize) -> JoinGuard<'static, ()> | ||
where F: Fn(A::Stream) + Send + Sync + 'static { |
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.
Additional advantage of making this blocking: 'a
here instead of 'static
, so this can be used with non-'static data.
… data Change AcceptorPool to not spawn detached threads anymore. This, together with the recent `Send` changes, allows the `work` closure to close over non-`'static` data. This doesn't change the high-level `Server` interface, because that would make it's `listen` a blocking call (it's currently non-blocking) - which would be a breaking change.
@reem I tried to address your comments on the last commit. I refrained from changing the non-blocking behavior of |
Looks like good work, but there is still another error. |
An error about IntoCow, it looks like? And all those warnings about the On Fri, Feb 20, 2015, 11:58 PM Jonathan Reem notifications@github.com
|
Those are from a recent breaking change. I'll download the new nightly and fix that! |
@reem I've updated the PR again even though it is still WIP, because there's an an error I haven't been able to figure out by myself - from lines 252 to 256 on
Error:
If I comment these lines out, hyper compiles, and all tests pass. BTW: turns out there were lots of breaking changes on the nightly. Let me know if I should squash all these |
After we're done reviewing and are ready to merge you'll squash. |
Boiled this down to #[allow(unconditional_recursion)]
fn _assert_send<T: Send>() {
use std::borrow::Cow;
_assert_send::<Cow<'static, str>>();
} Fails with:
Even though this compiles fine: #[allow(unconditional_recursion)]
fn _assert_send<T: Send>() {
use std::borrow::ToOwned;
_assert_send::<<str as ToOwned>::Owned>();
} Which seems contradictory to me. |
I updated my cargo config to point to [dependencies.hyper]
git = "https://github.com/renato-zannon/hyper.git"
rev = "124a31fb9b7363960bebbdcf71df9e1e1cb0e075" My compiler errors/warnings went down to the following afterwards error: the trait `core::marker::Send` is not implemented for the type `<str as collections::borrow::ToOwned>::Owned` [E0277]
_assert_send::<client::Request<net::Fresh>>();
note: `<str as collections::borrow::ToOwned>::Owned` cannot be sent between threads safely
_assert_send::<client::Request<net::Fresh>>(); |
@@ -22,14 +22,14 @@ impl<S: Scheme> DerefMut for Authorization<S> { | |||
} | |||
} | |||
|
|||
impl<S: Scheme> Header for Authorization<S> { | |||
impl<S: Scheme + 'static> Header for Authorization<S> where <S as FromStr>::Err: 'static { |
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.
Huh, seems odd to need this bound, but I see why. Not something I would immediately think of...
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.
Yes, I found this odd too. Took me a while to figure out where to put the bound
@renato-zannon This is awesome, thanks! I realize this can be tedious work (updating for syntax changes). I've fixed the last remaining thing, and will merge the new PR that includes your commits and mine. I feel like the commits are sufficiently separated that they can be merged as-is, without squashing. |
Merged as #329 |
@seanmonstar Cool :) Even though they can be a bit tedious, these changes are a great way to get early exposure to the codebase. Maybe in the future I'll be able to submit more interesting PRs :) |
Thanks for patching this up quickly. You guys are awesome |
This makes hyper compile again under the recent
Send
changes, which just landed on nightly. I also addressed a few new warnings.I tried to address the comment on server/acceptor.rs:26, but was unable to do so. It seems that I need to improve my lifetime-fu :)