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