]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
Loop over all opaque types instead of looking at just the first one with the same...
[rust.git] / src / test / ui / type-alias-impl-trait / generic_duplicate_param_use.rs
1 #![feature(const_generics)]
2 // revisions: min_tait full_tait
3 #![feature(min_type_alias_impl_trait)]
4 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
5 #![allow(incomplete_features)]
6
7 use std::fmt::Debug;
8
9 fn main() {}
10
11 // test that unused generic parameters are ok
12 type TwoTys<T, U> = impl Debug;
13 type TwoLifetimes<'a, 'b> = impl Debug;
14 type TwoConsts<const X: usize, const Y: usize> = impl Debug;
15
16 fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
17 //~^ ERROR non-defining opaque type use in defining scope
18     t
19 }
20
21 fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
22 //~^ ERROR non-defining opaque type use in defining scope
23     t
24 }
25
26 fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
27 //~^ ERROR non-defining opaque type use in defining scope
28     t
29 }