Files
rust/tests/ui/auto-traits/auto-trait-validation.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
1.0 KiB
Rust
Raw Normal View History

#![feature(auto_traits)]
2024-02-07 10:42:01 +08:00
#![allow(dead_code)]
2021-10-03 17:58:10 +02:00
//@ run-rustfix
auto trait Generic<T> {}
//~^ ERROR auto traits cannot have generic parameters [E0567]
auto trait Bound : Copy {}
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
2021-10-03 17:58:10 +02:00
auto trait LifetimeBound : 'static {}
//~^ ERROR auto traits cannot have super traits or lifetime bounds [E0568]
auto trait MyTrait { fn foo() {} }
//~^ ERROR auto traits cannot have associated items [E0380]
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() {}
}
fn main() {}