]> git.lizzy.rs Git - rust.git/blob - src/test/ui/associated-consts/assoc-const-ty-mismatch.rs
Do not allow bad projection term to leak into the type checker
[rust.git] / src / test / ui / associated-consts / assoc-const-ty-mismatch.rs
1 #![feature(associated_const_equality)]
2 #![allow(unused)]
3
4 pub trait Foo {
5   const N: usize;
6 }
7
8 pub trait FooTy {
9   type T;
10 }
11
12 pub struct Bar;
13
14 impl Foo for Bar {
15   const N: usize = 3;
16 }
17
18 impl FooTy for Bar {
19   type T = usize;
20 }
21
22
23 fn foo<F: Foo<N=usize>>() {}
24 //~^ ERROR expected associated constant bound, found type
25 fn foo2<F: FooTy<T=3usize>>() {}
26 //~^ ERROR expected associated type bound, found constant
27
28 fn main() {
29   foo::<Bar>();
30   foo2::<Bar>();
31 }