Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed Jul 22, 2020
1 parent 34a2a66 commit 446395e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tests/test/builtin_impls/fn_family.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ fn function_implement_fn_traits() {
struct Ty { }

trait Clone { }

impl Clone for Ty { }

opaque type MyOpaque: Clone = Ty;

}
Expand Down
16 changes: 16 additions & 0 deletions tests/test/opaque_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ fn opaque_bounds() {
struct Ty { }

trait Clone { }

impl Clone for Ty { }

opaque type T: Clone = Ty;
}

Expand All @@ -27,6 +30,7 @@ fn opaque_reveal() {
impl Trait for Ty { }

trait Clone { }
impl Clone for Ty { }
opaque type T: Clone = Ty;
}

Expand All @@ -53,11 +57,16 @@ fn opaque_where_clause() {
struct Ty { }

trait Clone { }
impl Clone for Ty { }

trait Trait { }
impl Trait for Ty { }

opaque type T: Clone where T: Trait = Ty;

struct Vec<U> { }

impl<V> Clone for Vec<V> { }
impl<U> Trait for Vec<U> { }

opaque type S<U>: Clone where U: Trait = Vec<U>;
Expand Down Expand Up @@ -130,6 +139,10 @@ fn opaque_generics() {
struct Vec<T> { }
struct Bar { }

impl<T> Iterator for Vec<T> {
type Item = T;
}

opaque type Foo<X>: Iterator<Item = X> = Vec<X>;
}

Expand Down Expand Up @@ -167,6 +180,9 @@ fn opaque_auto_traits() {
struct Baz { }
trait Trait { }

impl Trait for Bar { }
impl Trait for Baz { }

#[auto]
trait Send { }

Expand Down
14 changes: 14 additions & 0 deletions tests/test/wf_lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,3 +1103,17 @@ fn no_unsize_impls() {
}
}
}

#[test]
fn ill_formed_opaque_ty() {
lowering_error! {
program {
trait Foo {}
struct Bar {}

opaque type T: Foo = Bar;
} error_msg {
"opaque type declaration `T` does not meet well-formedness requirements"
}
}
}

0 comments on commit 446395e

Please sign in to comment.