fix(rustup): Add PhantomData markers to phantom type users

Necessary since [RFC 738](https://github.com/rust-lang/rfcs/blob/master/text/0738-variance.md).
This commit is contained in:
Renato Zannon
2015-02-21 03:45:51 -02:00
committed by Sean McArthur
parent 039e984f68
commit 1904c4561f
4 changed files with 26 additions and 9 deletions

View File

@@ -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<S = HttpStream> {
pub version: version::HttpVersion,
status_raw: RawStatus,
body: HttpReader<BufferedReader<Box<NetworkStream + Send>>>,
_marker: PhantomData<S>,
}
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<NetworkStream + Send>)),
status_raw: RawStatus(200, Borrowed("OK"))
status_raw: RawStatus(200, Borrowed("OK")),
_marker: PhantomData,
};
let b = res.into_inner().downcast::<MockStream>().ok().unwrap();