From 6a803990afe1c58f22d0e3ed326d051ad07e8bbc Mon Sep 17 00:00:00 2001 From: Florian Hartwig Date: Sun, 29 Mar 2015 18:01:05 +0200 Subject: [PATCH] fix: rustup * enable slice_patterns feature * add `Reflect` trait bounds where necessary --- src/header/common/authorization.rs | 5 +++-- src/lib.rs | 2 +- src/net.rs | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/header/common/authorization.rs b/src/header/common/authorization.rs index af8efbdd5a..1dcc2b23f6 100644 --- a/src/header/common/authorization.rs +++ b/src/header/common/authorization.rs @@ -1,6 +1,7 @@ use std::fmt; use std::str::{FromStr, from_utf8}; use std::ops::{Deref, DerefMut}; +use std::marker::Reflect; use serialize::base64::{ToBase64, FromBase64, Standard, Config, Newline}; use header::{Header, HeaderFormat}; @@ -22,7 +23,7 @@ impl DerefMut for Authorization { } } -impl Header for Authorization where ::Err: 'static { +impl Header for Authorization where ::Err: 'static { fn header_name() -> &'static str { "Authorization" } @@ -43,7 +44,7 @@ impl Header for Authorization where ::Err: } } -impl HeaderFormat for Authorization where ::Err: 'static { +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/lib.rs b/src/lib.rs index 397390462d..d8244ae45c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ #![doc(html_root_url = "https://hyperium.github.io/hyper/hyper/index.html")] -#![feature(core, io, unsafe_destructor, into_cow, convert)] +#![feature(core, io, unsafe_destructor, into_cow, convert, slice_patterns)] #![deny(missing_docs)] #![cfg_attr(test, deny(warnings))] #![cfg_attr(test, feature(alloc, test))] diff --git a/src/net.rs b/src/net.rs index 1157514cc9..66dd705ce5 100644 --- a/src/net.rs +++ b/src/net.rs @@ -7,6 +7,7 @@ use std::mem; use std::path::Path; use std::raw::{self, TraitObject}; use std::sync::Arc; +use std::marker::Reflect; use openssl::ssl::{Ssl, SslStream, SslContext}; use openssl::ssl::SslVerifyMode::SslVerifyNone; @@ -117,13 +118,13 @@ impl NetworkStream + Send { impl NetworkStream + Send { /// Is the underlying type in this trait object a T? #[inline] - pub fn is(&self) -> bool { + pub fn is(&self) -> bool { self.get_type_id() == TypeId::of::() } /// If the underlying type is T, get a reference to the contained data. #[inline] - pub fn downcast_ref(&self) -> Option<&T> { + pub fn downcast_ref(&self) -> Option<&T> { if self.is::() { Some(unsafe { self.downcast_ref_unchecked() }) } else { @@ -134,7 +135,7 @@ impl NetworkStream + Send { /// If the underlying type is T, get a mutable reference to the contained /// data. #[inline] - pub fn downcast_mut(&mut self) -> Option<&mut T> { + pub fn downcast_mut(&mut self) -> Option<&mut T> { if self.is::() { Some(unsafe { self.downcast_mut_unchecked() }) } else { @@ -143,7 +144,7 @@ impl NetworkStream + Send { } /// If the underlying type is T, extract it. - pub fn downcast(self: Box) + pub fn downcast(self: Box) -> Result, Box> { if self.is::() { Ok(unsafe { self.downcast_unchecked() })