summaryrefslogtreecommitdiffstats
path: root/tests/ui/generics/generic-param-attrs.rs
blob: 3c5cc84c6a6ac7d9e0e94c471de875fccfaa5894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// This test previously ensured that attributes on formals in generic parameter
// lists are rejected without a feature gate.

// build-pass (FIXME(62277): could be check-pass?)

#![feature(rustc_attrs)]

struct StLt<#[rustc_dummy] 'a>(&'a u32);
struct StTy<#[rustc_dummy] I>(I);
enum EnLt<#[rustc_dummy] 'b> { A(&'b u32), B }
enum EnTy<#[rustc_dummy] J> { A(J), B }
trait TrLt<#[rustc_dummy] 'c> { fn foo(&self, _: &'c [u32]) -> &'c u32; }
trait TrTy<#[rustc_dummy] K> { fn foo(&self, _: K); }
type TyLt<#[rustc_dummy] 'd> = &'d u32;
type TyTy<#[rustc_dummy] L> = (L, );

impl<#[rustc_dummy] 'e> StLt<'e> { }
impl<#[rustc_dummy] M> StTy<M> { }
impl<#[rustc_dummy] 'f> TrLt<'f> for StLt<'f> {
    fn foo(&self, _: &'f [u32]) -> &'f u32 { loop { } }
}
impl<#[rustc_dummy] N> TrTy<N> for StTy<N> {
    fn foo(&self, _: N) { }
}

fn f_lt<#[rustc_dummy] 'g>(_: &'g [u32]) -> &'g u32 { loop { } }
fn f_ty<#[rustc_dummy] O>(_: O) { }

impl<I> StTy<I> {
    fn m_lt<#[rustc_dummy] 'h>(_: &'h [u32]) -> &'h u32 { loop { } }
    fn m_ty<#[rustc_dummy] P>(_: P) { }
}

fn hof_lt<Q>(_: Q)
    where Q: for <#[rustc_dummy] 'i> Fn(&'i [u32]) -> &'i u32
{}

fn main() {}