]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/generic_const_exprs/issue-85848.rs
Move generic error message to separate branches
[rust.git] / src / test / ui / const-generics / generic_const_exprs / issue-85848.rs
1 #![feature(const_fn_trait_bound, generic_const_exprs)]
2 #![allow(incomplete_features)]
3
4 trait _Contains<T> {
5     const does_contain: bool;
6 }
7
8 trait Contains<T, const Satisfied: bool> {}
9
10 trait Delegates<T> {}
11
12 impl<T, U> Delegates<U> for T where T: Contains<U, true> {}
13
14 const fn contains<A, B>() -> bool
15 where
16     A: _Contains<B>,
17 {
18     A::does_contain
19 }
20
21 impl<T, U> Contains<T, { contains::<T, U>() }> for U where T: _Contains<U> {}
22
23 fn writes_to_path<C>(cap: &C) {
24     writes_to_specific_path(&cap);
25     //~^ ERROR: the trait bound `(): _Contains<&C>` is not satisfied [E0277]
26     //~| ERROR: unconstrained generic constant
27 }
28
29 fn writes_to_specific_path<C: Delegates<()>>(cap: &C) {}
30
31 fn main() {}