Refactor representation of bounds to separate out BuiltinBounds into

its own type. Use a bitset to represent built-in bounds. There
are several places in the language where only builtin bounds (aka kinds)
will be accepted, e.g. on closures, destructor type parameters perhaps,
and on trait types.
This commit is contained in:
Niko Matsakis 2013-05-07 17:30:21 -04:00
parent ca95e7f94e
commit dc2ca9d883
14 changed files with 370 additions and 213 deletions

View file

@ -20,7 +20,7 @@ struct E {
}
impl A for E {
fn b<F:Copy + Const,G>(_x: F) -> F { fail!() } //~ ERROR in method `b`, type parameter 0 has 2 bounds, but
fn b<F:Copy + Const,G>(_x: F) -> F { fail!() } //~ ERROR type parameter 0 requires `Const`
}
fn main() {}

View file

@ -8,11 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// Tests that impl methods are matched to traits exactly:
// we might be tempted to think matching is contravariant, but if
// we let an impl method can have more permissive bounds than the trait
// method it's implementing, the return type might be less specific than
// needed. Just punt and make it invariant.
// Tests that impls are allowed to have looser, more permissive bounds
// than the traits require.
trait A {
fn b<C:Copy + Const,D>(x: C) -> C;