]>
Commit | Line | Data |
---|---|---|
abe05a73 XL |
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. | |
4 | // | |
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. | |
10 | ||
11 | #![feature(optin_builtin_traits)] | |
12 | ||
13 | auto trait Auto {} | |
abe05a73 XL |
14 | unsafe auto trait AutoUnsafe {} |
15 | ||
16 | impl !Auto for bool {} | |
17 | impl !AutoUnsafe for bool {} | |
18 | ||
19 | struct AutoBool(bool); | |
20 | ||
21 | impl Auto for AutoBool {} | |
22 | unsafe impl AutoUnsafe for AutoBool {} | |
23 | ||
24 | fn take_auto<T: Auto>(_: T) {} | |
25 | fn take_auto_unsafe<T: AutoUnsafe>(_: T) {} | |
26 | ||
27 | fn main() { | |
2c00a5a8 XL |
28 | // Parse inside functions. |
29 | auto trait AutoInner {} | |
30 | unsafe auto trait AutoUnsafeInner {} | |
31 | ||
abe05a73 XL |
32 | take_auto(0); |
33 | take_auto(AutoBool(true)); | |
34 | take_auto_unsafe(0); | |
35 | take_auto_unsafe(AutoBool(true)); | |
36 | ||
37 | /// Auto traits are allowed in trait object bounds. | |
38 | let _: &(Send + Auto) = &0; | |
39 | } |