rustc: store type parameter defaults outside of ty::Generics.

This commit is contained in:
Eduard-Mihai Burtescu 2017-01-25 22:01:11 +02:00
parent 1572bf104d
commit e8d01ea4c7
34 changed files with 394 additions and 385 deletions

View file

@ -13,6 +13,7 @@
trait Foo<X = Box<Foo>> {
//~^ ERROR unsupported cyclic reference
//~| ERROR unsupported cyclic reference
}
fn main() { }

View file

@ -10,10 +10,10 @@
struct Heap;
struct Vec<A = Heap, T>;
struct Vec<A = Heap, T>(A, T);
//~^ ERROR type parameters with a default must be trailing
struct Foo<A, B = Vec<C>, C>;
struct Foo<A, B = Vec<C>, C>(A, B, C);
//~^ ERROR type parameters with a default must be trailing
//~| ERROR type parameters with a default cannot use forward declared identifiers

View file

@ -9,7 +9,7 @@
// except according to those terms.
// Ensure that we get an error and not an ICE for this problematic case.
struct Foo<T = Option<U>, U = bool>;
struct Foo<T = Option<U>, U = bool>(T, U);
//~^ ERROR type parameters with a default cannot use forward declared identifiers
fn main() {
let x: Foo;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct Foo<Bar=Bar>; //~ ERROR E0128
//~| NOTE defaulted type parameters cannot be forward declared
pub struct Foo<Bar=Bar>(Bar); //~ ERROR E0128
//~| NOTE defaulted type parameters cannot be forward declared
pub struct Baz(Foo);
fn main() {}

View file

@ -15,7 +15,7 @@ impl Tr<Self> for S {} // OK
// FIXME: `Self` cannot be used in bounds because it depends on bounds itself.
impl<T: Tr<Self>> Tr<T> for S {} //~ ERROR `Self` type is used before it's determined
impl<T = Self> Tr<T> for S {} //~ ERROR `Self` type is used before it's determined
impl<T = Self> Tr<T> for S {}
impl Tr for S where Self: Copy {} //~ ERROR `Self` type is used before it's determined
impl Tr for S where S<Self>: Copy {} //~ ERROR `Self` type is used before it's determined
impl Tr for S where Self::Assoc: Copy {} //~ ERROR `Self` type is used before it's determined