]> git.proxmox.com Git - rustc.git/blob - src/test/ui/type-alias-impl-trait/generic_duplicate_param_use.rs
New upstream version 1.61.0+dfsg1
[rustc.git] / src / test / ui / type-alias-impl-trait / generic_duplicate_param_use.rs
1 #![feature(type_alias_impl_trait)]
2
3 use std::fmt::Debug;
4
5 fn main() {}
6
7 // test that unused generic parameters are ok
8 type TwoTys<T, U> = impl Debug;
9
10 type TwoLifetimes<'a, 'b> = impl Debug;
11
12 type TwoConsts<const X: usize, const Y: usize> = impl Debug;
13
14
15 fn one_ty<T: Debug>(t: T) -> TwoTys<T, T> {
16 t
17 //~^ ERROR non-defining opaque type use in defining scope
18 }
19
20 fn one_lifetime<'a>(t: &'a u32) -> TwoLifetimes<'a, 'a> {
21 t
22 //~^ ERROR non-defining opaque type use in defining scope
23 }
24
25 fn one_const<const N: usize>(t: *mut [u8; N]) -> TwoConsts<N, N> {
26 t
27 //~^ ERROR non-defining opaque type use in defining scope
28 }