blob: 8535f82fc0129f33566529ffa9d86ed8613d75a2 (
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
43
44
45
46
47
|
//@ compile-flags: -Zexperimental-default-bounds
#![feature(
auto_traits,
lang_items,
negative_impls,
no_core,
rustc_attrs
)]
#![allow(incomplete_features)]
#![no_std]
#![no_core]
#[lang = "pointee_sized"]
trait PointeeSized {}
#[lang = "meta_sized"]
trait MetaSized: PointeeSized {}
#[lang = "sized"]
trait Sized: MetaSized {}
#[lang = "copy"]
pub trait Copy {}
#[lang = "default_trait1"]
auto trait Leak {}
#[lang = "default_trait2"]
auto trait SyncDrop {}
struct Forbidden;
impl !Leak for Forbidden {}
impl !SyncDrop for Forbidden {}
struct Accepted;
fn bar<T: Leak>(_: T) {}
fn main() {
// checking that bounds can be added explicitly
bar(Forbidden);
//~^ ERROR the trait bound `Forbidden: Leak` is not satisfied
//~| ERROR the trait bound `Forbidden: SyncDrop` is not satisfied
bar(Accepted);
}
|