2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2018-09-25 21:51:35 +00:00
|
|
|
#![allow(unused_doc_comments)]
|
2020-11-23 03:54:31 +00:00
|
|
|
#![feature(auto_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 {}
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
struct AutoBool(#[allow(dead_code)] bool);
|
2017-10-12 22:00:30 +00: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 18:26:20 +00:00
|
|
|
// Parse inside functions.
|
2024-02-07 02:42:01 +00:00
|
|
|
auto trait AutoInner {} //~ WARN trait `AutoInner` is never used
|
|
|
|
unsafe auto trait AutoUnsafeInner {} //~ WARN trait `AutoUnsafeInner` is never used
|
2017-12-04 18:26:20 +00:00
|
|
|
|
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
|
|
|
}
|