summaryrefslogtreecommitdiff
path: root/tests/ui/associated-inherent-types/generic-associated-types-bad.rs
blob: e66392a0a94116c0a1120451d44f700d183ccfbe (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
// revisions: item local region

#![feature(inherent_associated_types)]
#![allow(incomplete_features)]

#[derive(Clone, Copy)]
pub enum Ty {}

impl Ty {
    type Pr<T: Copy> = T;

    type Static<Q: 'static> = Q;
}

#[cfg(item)]
const _: Ty::Pr<String> = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied

fn main() {
    #[cfg(local)]
    let _: Ty::Pr<Vec<()>>; //[local]~ ERROR the trait bound `Vec<()>: Copy` is not satisfied
}

fn user<'a>() {
    #[cfg(region)]
    let _: Ty::Static<&'a str> = ""; //[region]~ ERROR lifetime may not live long enough
}