mirror of
				https://github.com/rust-lang/rust.git
				synced 2025-10-31 13:04:42 +00:00 
			
		
		
		
	 80c60fe783
			
		
	
	
		80c60fe783
		
			
		
	
	
	
	
		
			
			Having these implementation available crate-wide means that platforms not using sockets for their networking code have to stub out the libc definitions required to support them. This PR moves the conversions to private helper functions that are only available where actually needed. I also fixed the signature of the function converting from a C socket address to a Rust one: taking a reference to a `sockaddr_storage` resulted in unsound usage inside `LookupHost::next`, which could create a reference to a structure smaller than `sockaddr_storage`. Thus I've replaced the argument type with a pointer and made the function `unsafe`.
		
			
				
	
	
		
			11 lines
		
	
	
		
			381 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
		
			381 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| // Tests for this module
 | |
| #[cfg(all(test, not(any(target_os = "emscripten", all(target_os = "wasi", target_env = "p1")))))]
 | |
| mod tests;
 | |
| 
 | |
| #[stable(feature = "ip_addr", since = "1.7.0")]
 | |
| pub use core::net::IpAddr;
 | |
| #[unstable(feature = "ip", issue = "27709")]
 | |
| pub use core::net::Ipv6MulticastScope;
 | |
| #[stable(feature = "rust1", since = "1.0.0")]
 | |
| pub use core::net::{Ipv4Addr, Ipv6Addr};
 |