]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/auto-traits.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![feature(optin_builtin_traits)]
14 // Redundant but accepted until we remove it.
18 unsafe auto trait AutoUnsafe {}
20 impl !Auto
for bool {}
21 impl !AutoUnsafe
for bool {}
23 struct AutoBool(bool
);
25 impl Auto
for AutoBool {}
26 unsafe impl AutoUnsafe
for AutoBool {}
28 fn take_auto
<T
: Auto
>(_
: T
) {}
29 fn take_auto_unsafe
<T
: AutoUnsafe
>(_
: T
) {}
33 take_auto(AutoBool(true));
35 take_auto_unsafe(AutoBool(true));
37 /// Auto traits are allowed in trait object bounds.
38 let _
: &(Send
+ Auto
) = &0;