]> git.lizzy.rs Git - rust.git/blob - tests/ui/generics/generic-param-attrs.rs
Rollup merge of #107576 - P1n3appl3:master, r=tmandry
[rust.git] / tests / ui / generics / generic-param-attrs.rs
1 // This test previously ensured that attributes on formals in generic parameter
2 // lists are rejected without a feature gate.
3
4 // build-pass (FIXME(62277): could be check-pass?)
5
6 #![feature(rustc_attrs)]
7
8 struct StLt<#[rustc_dummy] 'a>(&'a u32);
9 struct StTy<#[rustc_dummy] I>(I);
10 enum EnLt<#[rustc_dummy] 'b> { A(&'b u32), B }
11 enum EnTy<#[rustc_dummy] J> { A(J), B }
12 trait TrLt<#[rustc_dummy] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
13 trait TrTy<#[rustc_dummy] K> { fn foo(&self, _: K); }
14 type TyLt<#[rustc_dummy] 'd> = &'d u32;
15 type TyTy<#[rustc_dummy] L> = (L, );
16
17 impl<#[rustc_dummy] 'e> StLt<'e> { }
18 impl<#[rustc_dummy] M> StTy<M> { }
19 impl<#[rustc_dummy] 'f> TrLt<'f> for StLt<'f> {
20     fn foo(&self, _: &'f [u32]) -> &'f u32 { loop { } }
21 }
22 impl<#[rustc_dummy] N> TrTy<N> for StTy<N> {
23     fn foo(&self, _: N) { }
24 }
25
26 fn f_lt<#[rustc_dummy] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
27 fn f_ty<#[rustc_dummy] O>(_: O) { }
28
29 impl<I> StTy<I> {
30     fn m_lt<#[rustc_dummy] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
31     fn m_ty<#[rustc_dummy] P>(_: P) { }
32 }
33
34 fn hof_lt<Q>(_: Q)
35     where Q: for <#[rustc_dummy] 'i> Fn(&'i [u32]) -> &'i u32
36 {}
37
38 fn main() {}