diff options
Diffstat (limited to 'src/test/ui/associated-consts/assoc-const-ty-mismatch.rs')
-rw-r--r-- | src/test/ui/associated-consts/assoc-const-ty-mismatch.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs b/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs new file mode 100644 index 000000000..c5d78469e --- /dev/null +++ b/src/test/ui/associated-consts/assoc-const-ty-mismatch.rs @@ -0,0 +1,31 @@ +#![feature(associated_const_equality)] +#![allow(unused)] + +pub trait Foo { + const N: usize; +} + +pub trait FooTy { + type T; +} + +pub struct Bar; + +impl Foo for Bar { + const N: usize = 3; +} + +impl FooTy for Bar { + type T = usize; +} + + +fn foo<F: Foo<N=usize>>() {} +//~^ ERROR expected associated constant bound, found type +fn foo2<F: FooTy<T=3usize>>() {} +//~^ ERROR expected associated type bound, found constant + +fn main() { + foo::<Bar>(); + foo2::<Bar>(); +} |