2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2018-09-25 23:51:35 +02:00
|
|
|
#![allow(unused_doc_comments)]
|
2020-11-22 19:54:31 -08:00
|
|
|
#![feature(auto_traits)]
|
2020-01-09 05:56:38 -05:00
|
|
|
#![feature(negative_impls)]
|
2017-10-12 19:00:30 -03:00
|
|
|
|
|
|
|
auto trait Auto {}
|
|
|
|
unsafe auto trait AutoUnsafe {}
|
|
|
|
|
|
|
|
impl !Auto for bool {}
|
|
|
|
impl !AutoUnsafe for bool {}
|
|
|
|
|
2022-07-25 22:36:03 +02:00
|
|
|
struct AutoBool(#[allow(unused_tuple_struct_fields)] bool);
|
2017-10-12 19:00:30 -03:00
|
|
|
|
|
|
|
impl Auto for AutoBool {}
|
|
|
|
unsafe impl AutoUnsafe for AutoBool {}
|
|
|
|
|
|
|
|
fn take_auto<T: Auto>(_: T) {}
|
|
|
|
fn take_auto_unsafe<T: AutoUnsafe>(_: T) {}
|
|
|
|
|
|
|
|
fn main() {
|
2017-12-04 16:26:20 -02:00
|
|
|
// Parse inside functions.
|
|
|
|
auto trait AutoInner {}
|
|
|
|
unsafe auto trait AutoUnsafeInner {}
|
|
|
|
|
2017-10-12 19:00:30 -03:00
|
|
|
take_auto(0);
|
|
|
|
take_auto(AutoBool(true));
|
|
|
|
take_auto_unsafe(0);
|
|
|
|
take_auto_unsafe(AutoBool(true));
|
2017-11-04 19:44:19 -02:00
|
|
|
|
|
|
|
/// Auto traits are allowed in trait object bounds.
|
2019-05-28 14:47:21 -04:00
|
|
|
let _: &(dyn Send + Auto) = &0;
|
2017-10-12 19:00:30 -03:00
|
|
|
}
|