Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Remove support for old_impl_check #23749

Merged
merged 1 commit into from
Mar 28, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2208,18 +2208,10 @@ fn enforce_impl_ty_params_are_constrained<'tcx>(tcx: &ty::ctxt<'tcx>,
idx: index as u32,
name: ty_param.ident.name };
if !input_parameters.contains(&param_ty) {
if ty::has_attr(tcx, impl_def_id, "old_impl_check") {
tcx.sess.span_warn(
ty_param.span,
&format!("the type parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
param_ty.user_string(tcx)));
} else {
span_err!(tcx.sess, ty_param.span, E0207,
"the type parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
param_ty.user_string(tcx));
}
span_err!(tcx.sess, ty_param.span, E0207,
"the type parameter `{}` is not constrained by the \
impl trait, self type, or predicates",
param_ty.user_string(tcx));
}
}
}
1 change: 0 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@
#![feature(lang_items)]
#![feature(libc)]
#![feature(linkage, thread_local, asm)]
#![feature(old_impl_check)]
#![feature(optin_builtin_traits)]
#![feature(rand)]
#![feature(staged_api)]
Expand Down
18 changes: 9 additions & 9 deletions src/libstd/old_io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1588,9 +1588,7 @@ pub trait Seek {
/// connections.
///
/// Doing so produces some sort of Acceptor.
pub trait Listener<T, A: Acceptor<T>>
: PhantomFn<T,T> // FIXME should be an assoc type anyhow
{
pub trait Listener<A: Acceptor> {
/// Spin up the listener and start queuing incoming connections
///
/// # Error
Expand All @@ -1601,13 +1599,16 @@ pub trait Listener<T, A: Acceptor<T>>
}

/// An acceptor is a value that presents incoming connections
pub trait Acceptor<T> {
pub trait Acceptor {
/// Type of connection that is accepted by this acceptor.
type Connection;

/// Wait for and accept an incoming connection
///
/// # Error
///
/// Returns `Err` if an I/O error is encountered.
fn accept(&mut self) -> IoResult<T>;
fn accept(&mut self) -> IoResult<Self::Connection>;

/// Create an iterator over incoming connection attempts.
///
Expand All @@ -1628,11 +1629,10 @@ pub struct IncomingConnections<'a, A: ?Sized +'a> {
inc: &'a mut A,
}

#[old_impl_check]
impl<'a, T, A: ?Sized + Acceptor<T>> Iterator for IncomingConnections<'a, A> {
type Item = IoResult<T>;
impl<'a, A: ?Sized + Acceptor> Iterator for IncomingConnections<'a, A> {
type Item = IoResult<A::Connection>;

fn next(&mut self) -> Option<IoResult<T>> {
fn next(&mut self) -> Option<IoResult<A::Connection>> {
Some(self.inc.accept())
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/old_io/net/pipe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl UnixListener {
}
}

impl Listener<UnixStream, UnixAcceptor> for UnixListener {
impl Listener<UnixAcceptor> for UnixListener {
fn listen(self) -> IoResult<UnixAcceptor> {
self.inner.listen()
.map(|inner| UnixAcceptor { inner: inner })
Expand Down Expand Up @@ -250,7 +250,8 @@ impl UnixAcceptor {
}
}

impl Acceptor<UnixStream> for UnixAcceptor {
impl Acceptor for UnixAcceptor {
type Connection = UnixStream;
fn accept(&mut self) -> IoResult<UnixStream> {
self.inner.accept().map(|s| {
UnixStream { inner: s }
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/old_io/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl TcpListener {
}
}

impl Listener<TcpStream, TcpAcceptor> for TcpListener {
impl Listener<TcpAcceptor> for TcpListener {
fn listen(self) -> IoResult<TcpAcceptor> {
self.inner.listen(128).map(|a| TcpAcceptor { inner: a })
}
Expand Down Expand Up @@ -453,7 +453,8 @@ impl TcpAcceptor {
}
}

impl Acceptor<TcpStream> for TcpAcceptor {
impl Acceptor for TcpAcceptor {
type Connection = TcpStream;
fn accept(&mut self) -> IoResult<TcpStream> {
self.inner.accept().map(TcpStream::new)
}
Expand Down
7 changes: 4 additions & 3 deletions src/libstd/old_io/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl<S: Seek> Seek for IoResult<S> {
}
}

impl<T, A: Acceptor<T>, L: Listener<T, A>> Listener<T, A> for IoResult<L> {
impl<A: Acceptor, L: Listener<A>> Listener<A> for IoResult<L> {
fn listen(self) -> IoResult<A> {
match self {
Ok(listener) => listener.listen(),
Expand All @@ -67,8 +67,9 @@ impl<T, A: Acceptor<T>, L: Listener<T, A>> Listener<T, A> for IoResult<L> {
}
}

impl<T, A: Acceptor<T>> Acceptor<T> for IoResult<A> {
fn accept(&mut self) -> IoResult<T> {
impl<A: Acceptor> Acceptor for IoResult<A> {
type Connection = A::Connection;
fn accept(&mut self) -> IoResult<A::Connection> {
match *self {
Ok(ref mut acceptor) => acceptor.accept(),
Err(ref e) => Err(e.clone()),
Expand Down
11 changes: 0 additions & 11 deletions src/libsyntax/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Status)] = &[
// A way to temporarily opt out of the new orphan rules. This will *never* be accepted.
("old_orphan_check", "1.0.0", Deprecated),

// A way to temporarily opt out of the new impl rules. This will *never* be accepted.
("old_impl_check", "1.0.0", Deprecated),

// OIBIT specific features
("optin_builtin_traits", "1.0.0", Active),

Expand Down Expand Up @@ -280,7 +277,6 @@ pub const KNOWN_ATTRIBUTES: &'static [(&'static str, AttributeType)] = &[

// FIXME: #19470 this shouldn't be needed forever
("old_orphan_check", Whitelisted),
("old_impl_check", Whitelisted),
("rustc_paren_sugar", Whitelisted), // FIXME: #18101 temporary unboxed closure hack

// Crate level attributes
Expand Down Expand Up @@ -595,13 +591,6 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
i.span,
"the new orphan check rules will eventually be strictly enforced");
}

if attr::contains_name(&i.attrs[..],
"old_impl_check") {
self.gate_feature("old_impl_check",
i.span,
"`#[old_impl_check]` will be removed in the future");
}
}

_ => {}
Expand Down