-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
T-langRelevant to the language teamRelevant to the language team
Description
Test case:
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, ToSocketAddrs};
use std::{vec, io};
pub enum Host {
Domain(String),
Ipv4(Ipv4Addr),
Ipv6(Ipv6Addr),
}
impl ToSocketAddrs for (Host, u16) {
type Iter = vec::IntoIter<SocketAddr>;
fn to_socket_addrs(&self) -> io::Result<Self::Iter> {
unimplemented!()
}
}
Output with rustc 1.8.0-nightly (fae5162 2016-02-13):
a.rs:10:1: 15:2 error: the impl does not reference any types defined in this crate; only traits defined in the current crate can be implemented for arbitrary types [E0117]
a.rs:10 impl ToSocketAddrs for (Host, u16) {
a.rs:11 type Iter = vec::IntoIter<SocketAddr>;
a.rs:12 fn to_socket_addrs(&self) -> io::Result<Self::Iter> {
a.rs:13 unimplemented!()
a.rs:14 }
a.rs:15 }
a.rs:10:1: 15:2 help: run `rustc --explain E0117` to see a detailed explanation
error: aborting due to previous error
But the impl does define a type defined in this crate, Host
.
Is this impl fundamentally problematic, or could coherence rules be extended for tuples?
jashephe, eyelash, Wallacoloo, blakehawkins, Connicpu and 1 more
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language teamRelevant to the language team