fix(rustup): rustc 1.0.0-nightly (ea8b82e90)
This commit fixes `cargo build` and `cargo test`. Method lookup on traits seems to have changed to force `impl TraitName` expressions to be more specific. That means that `method` will not be found anymore on an object of type `&Trait+Send`, unless you provide an `impl Trait+Send`. Now `NetworkStream` and `HeaderFormat` trait implementations are done against `* + Send`, which helps the compiler to find the respective `downcast*` method implementations once again.
This commit is contained in:
		| @@ -75,7 +75,7 @@ impl<T: HeaderFormat + Send + Sync + Clone> HeaderClone for T { | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl HeaderFormat { | ||||
| impl HeaderFormat + Send + Sync { | ||||
|     #[inline] | ||||
|     unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T { | ||||
|         mem::transmute(mem::transmute::<&HeaderFormat, raw::TraitObject>(self).data) | ||||
|   | ||||
							
								
								
									
										12
									
								
								src/net.rs
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								src/net.rs
									
									
									
									
									
								
							| @@ -97,7 +97,7 @@ impl Clone for Box<NetworkStream + Send> { | ||||
|     fn clone(&self) -> Box<NetworkStream + Send> { self.clone_box() } | ||||
| } | ||||
|  | ||||
| impl NetworkStream { | ||||
| impl NetworkStream + Send { | ||||
|     unsafe fn downcast_ref_unchecked<T: 'static>(&self) -> &T { | ||||
|         mem::transmute(mem::transmute::<&NetworkStream, | ||||
|                                         raw::TraitObject>(self).data) | ||||
| @@ -108,13 +108,13 @@ impl NetworkStream { | ||||
|                                         raw::TraitObject>(self).data) | ||||
|     } | ||||
|  | ||||
|     unsafe fn downcast_unchecked<T: 'static>(self: Box<NetworkStream>) -> Box<T>  { | ||||
|         mem::transmute(mem::transmute::<Box<NetworkStream>, | ||||
|     unsafe fn downcast_unchecked<T: 'static>(self: Box<NetworkStream + Send>) -> Box<T>  { | ||||
|         mem::transmute(mem::transmute::<Box<NetworkStream + Send>, | ||||
|                                         raw::TraitObject>(self).data) | ||||
|     } | ||||
| } | ||||
|  | ||||
| impl NetworkStream { | ||||
| impl NetworkStream + Send { | ||||
|     /// Is the underlying type in this trait object a T? | ||||
|     #[inline] | ||||
|     pub fn is<T: 'static>(&self) -> bool { | ||||
| @@ -143,8 +143,8 @@ impl NetworkStream { | ||||
|     } | ||||
|  | ||||
|     /// If the underlying type is T, extract it. | ||||
|     pub fn downcast<T: 'static>(self: Box<NetworkStream>) | ||||
|             -> Result<Box<T>, Box<NetworkStream>> { | ||||
|     pub fn downcast<T: 'static>(self: Box<NetworkStream + Send>) | ||||
|             -> Result<Box<T>, Box<NetworkStream + Send>> { | ||||
|         if self.is::<T>() { | ||||
|             Ok(unsafe { self.downcast_unchecked() }) | ||||
|         } else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user