]> git.lizzy.rs Git - rust.git/commit
Implement impl reachability rules. This is a [breaking-change]. Type
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 5 Jan 2015 11:17:42 +0000 (06:17 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 6 Jan 2015 22:17:48 +0000 (17:17 -0500)
commit2375a79152b8a6554c3e97a3f127fedd75f7495f
tree5e69902cf0c81942c2e79d6dba326650680b689f
parent3ed7f067dc0319cd9e7bb6a8253ba031d0bdf1f3
Implement impl reachability rules. This is a [breaking-change]. Type
parameters on impls must now also appear in the trait ref, self type,
or some associated type declared on the impl. This ensures that they
are constrianed in some way and that the semantics of the trait system
are well-defined (always a good thing).

There are three major ways to fix this error:

1. Convert the trait to use associated types; most often the type
   parameters are not constrained because they are in fact outputs of
   the impl.

2. Move the type parameters to methods.

3. Add an additional type parameter to the self type or trait so that
   the unused parameter can appear there.

In some cases, it is not possible to fix the impl because the trait
definition needs to be changed first (and that may be out of your
control). In that case, for the time being, you can opt out of these
rules by using `#[old_impl_check]` on the impl and adding a
`#![feature(old_impl_check)]` to your crate declaration.
src/librustc/lint/builtin.rs
src/librustc_typeck/collect.rs
src/libsyntax/feature_gate.rs