2020-11-22 19:54:31 -08:00
|
|
|
#![feature(auto_traits)]
|
2024-02-07 10:42:01 +08:00
|
|
|
#![allow(dead_code)]
|
2017-10-15 16:03:03 -02:00
|
|
|
|
2021-10-03 17:58:10 +02:00
|
|
|
//@ run-rustfix
|
|
|
|
|
|
2017-10-15 16:03:03 -02:00
|
|
|
auto trait Generic<T> {}
|
2025-04-05 19:19:56 +03:00
|
|
|
//~^ ERROR auto traits cannot have generic parameters [E0567]
|
2017-10-15 16:03:03 -02:00
|
|
|
auto trait Bound : Copy {}
|
2025-04-05 19:19:56 +03:00
|
|
|
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
|
2021-10-03 17:58:10 +02:00
|
|
|
auto trait LifetimeBound : 'static {}
|
2025-04-05 19:19:56 +03:00
|
|
|
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
|
2017-10-15 16:03:03 -02:00
|
|
|
auto trait MyTrait { fn foo() {} }
|
2025-04-05 19:19:56 +03:00
|
|
|
//~^ ERROR auto traits cannot have associated items [E0380]
|
2025-02-28 23:37:37 +00:00
|
|
|
auto trait AssocTy { type Bar; }
|
|
|
|
|
//~^ ERROR auto traits cannot have associated items [E0380]
|
|
|
|
|
auto trait All<'a, T> {
|
|
|
|
|
//~^ ERROR auto traits cannot have generic parameters [E0567]
|
|
|
|
|
type Bar;
|
|
|
|
|
//~^ ERROR auto traits cannot have associated items [E0380]
|
|
|
|
|
fn foo() {}
|
|
|
|
|
}
|
|
|
|
|
// We can't test both generic params and super-traits because the suggestion span overlaps.
|
|
|
|
|
auto trait All2: Copy + 'static {
|
|
|
|
|
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
|
|
|
|
|
type Bar;
|
|
|
|
|
//~^ ERROR auto traits cannot have associated items [E0380]
|
|
|
|
|
fn foo() {}
|
|
|
|
|
}
|
2017-10-15 16:03:03 -02:00
|
|
|
fn main() {}
|