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