diff --git a/src/client/request.rs b/src/client/request.rs index 442261cba7..9862aeae66 100644 --- a/src/client/request.rs +++ b/src/client/request.rs @@ -1,5 +1,6 @@ //! Client Requests use std::old_io::{BufferedWriter, IoResult}; +use std::marker::PhantomData; use url::Url; @@ -25,6 +26,8 @@ pub struct Request { body: HttpWriter>>, headers: Headers, method: method::Method, + + _marker: PhantomData, } impl Request { @@ -66,7 +69,8 @@ impl Request { headers: headers, url: url, version: version::HttpVersion::Http11, - body: stream + body: stream, + _marker: PhantomData, }) } @@ -136,7 +140,8 @@ impl Request { headers: self.headers, url: self.url, version: self.version, - body: stream + body: stream, + _marker: PhantomData, }) } diff --git a/src/client/response.rs b/src/client/response.rs index 763f36cd2c..5ded928ef3 100644 --- a/src/client/response.rs +++ b/src/client/response.rs @@ -1,6 +1,7 @@ //! Client Responses use std::num::FromPrimitive; use std::old_io::{BufferedReader, IoResult}; +use std::marker::PhantomData; use header; use header::{ContentLength, TransferEncoding}; @@ -23,6 +24,8 @@ pub struct Response { pub version: version::HttpVersion, status_raw: RawStatus, body: HttpReader>>, + + _marker: PhantomData, } impl Response { @@ -72,6 +75,7 @@ impl Response { headers: headers, body: body, status_raw: raw_status, + _marker: PhantomData, }) } @@ -98,6 +102,7 @@ mod tests { use std::borrow::Cow::Borrowed; use std::boxed::BoxAny; use std::old_io::BufferedReader; + use std::marker::PhantomData; use header::Headers; use header::TransferEncoding; @@ -119,7 +124,8 @@ mod tests { headers: Headers::new(), version: version::HttpVersion::Http11, body: EofReader(BufferedReader::new(box MockStream::new() as Box)), - status_raw: RawStatus(200, Borrowed("OK")) + status_raw: RawStatus(200, Borrowed("OK")), + _marker: PhantomData, }; let b = res.into_inner().downcast::().ok().unwrap(); diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index 1c891c51c8..b36183d7bc 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -22,7 +22,7 @@ impl DerefMut for Authorization { } } -impl Header for Authorization { +impl Header for Authorization where ::Err: 'static { fn header_name() -> &'static str { "Authorization" } @@ -43,7 +43,7 @@ impl Header for Authorization { } } -impl HeaderFormat for Authorization { +impl HeaderFormat for Authorization where ::Err: 'static { fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { match Scheme::scheme(None::) { Some(scheme) => try!(write!(fmt, "{} ", scheme)), diff --git a/src/server/response.rs b/src/server/response.rs index 1e3604b0e7..e6fbb9cf99 100644 --- a/src/server/response.rs +++ b/src/server/response.rs @@ -3,6 +3,7 @@ //! These are responses sent by a `hyper::Server` to clients, after //! receiving a request. use std::old_io::IoResult; +use std::marker::PhantomData; use time::now_utc; @@ -22,7 +23,9 @@ pub struct Response<'a, W = Fresh> { // The status code for the request. status: status::StatusCode, // The outgoing headers on this response. - headers: header::Headers + headers: header::Headers, + + _marker: PhantomData } impl<'a, W> Response<'a, W> { @@ -42,7 +45,8 @@ impl<'a, W> Response<'a, W> { status: status, version: version, body: body, - headers: headers + headers: headers, + _marker: PhantomData, } } @@ -60,7 +64,8 @@ impl<'a> Response<'a, Fresh> { status: status::StatusCode::Ok, version: version::HttpVersion::Http11, headers: header::Headers::new(), - body: ThroughWriter(stream) + body: ThroughWriter(stream), + _marker: PhantomData, } } @@ -119,7 +124,8 @@ impl<'a> Response<'a, Fresh> { version: self.version, body: stream, status: self.status, - headers: self.headers + headers: self.headers, + _marker: PhantomData, }) }