rust/tests/ui/lint/bare-trait-objects-path.rs

27 lines
771 B
Rust
Raw Normal View History

#![feature(associated_type_defaults)]
trait Assoc {
fn func() {}
const CONST: u8 = 0;
type Ty = u8;
}
trait Dyn {}
impl Assoc for dyn Dyn {}
fn main() {
2021-04-16 09:06:51 +00:00
Dyn::func();
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 12:27:44 +00:00
//~| WARN this is accepted in the current edition
2021-04-16 09:06:51 +00:00
::Dyn::func();
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 12:27:44 +00:00
//~| WARN this is accepted in the current edition
2021-04-16 09:06:51 +00:00
Dyn::CONST;
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 12:27:44 +00:00
//~| WARN this is accepted in the current edition
let _: Dyn::Ty; //~ ERROR ambiguous associated type
2021-07-10 08:00:54 +00:00
//~^ WARN trait objects without an explicit `dyn` are deprecated
//~| WARN this is accepted in the current edition
}