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