]> git.lizzy.rs Git - rust.git/blob - tests/ui/auto-traits/auto-traits.rs
Rollup merge of #106692 - eggyal:mv-binary_heap.rs-binary_heap/mod.rs, r=Mark-Simulacrum
[rust.git] / tests / ui / auto-traits / auto-traits.rs
1 // run-pass
2 #![allow(unused_doc_comments)]
3 #![feature(auto_traits)]
4 #![feature(negative_impls)]
5
6 auto trait Auto {}
7 unsafe auto trait AutoUnsafe {}
8
9 impl !Auto for bool {}
10 impl !AutoUnsafe for bool {}
11
12 struct AutoBool(#[allow(unused_tuple_struct_fields)] bool);
13
14 impl Auto for AutoBool {}
15 unsafe impl AutoUnsafe for AutoBool {}
16
17 fn take_auto<T: Auto>(_: T) {}
18 fn take_auto_unsafe<T: AutoUnsafe>(_: T) {}
19
20 fn main() {
21     // Parse inside functions.
22     auto trait AutoInner {}
23     unsafe auto trait AutoUnsafeInner {}
24
25     take_auto(0);
26     take_auto(AutoBool(true));
27     take_auto_unsafe(0);
28     take_auto_unsafe(AutoBool(true));
29
30     /// Auto traits are allowed in trait object bounds.
31     let _: &(dyn Send + Auto) = &0;
32 }