summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/negative-bounds/simple.rs
blob: f6d1d5169c4fc51e3cd407b1ce88dc8a55cd396c (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
39
40
41
42
#![feature(negative_bounds, negative_impls)]
//~^ WARN the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes

fn not_copy<T: !Copy>() {}

fn neg_param_env<T: !Copy>() {
    not_copy::<T>();
}

fn pos_param_env<T: Copy>() {
    not_copy::<T>();
    //~^ ERROR the trait bound `T: !Copy` is not satisfied
}

fn unknown<T>() {
    not_copy::<T>();
    //~^ ERROR the trait bound `T: !Copy` is not satisfied
}

struct NotCopyable;
impl !Copy for NotCopyable {}

fn neg_impl() {
    not_copy::<NotCopyable>();
}

#[derive(Copy, Clone)]
struct Copyable;

fn pos_impl() {
    not_copy::<Copyable>();
    //~^ ERROR the trait bound `Copyable: !Copy` is not satisfied
}

struct NotNecessarilyCopyable;

fn unknown_impl() {
    not_copy::<NotNecessarilyCopyable>();
    //~^ ERROR the trait bound `NotNecessarilyCopyable: !Copy` is not satisfied
}

fn main() {}