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 04:06:51 -05:00
Dyn::func();
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
2021-04-16 04:06:51 -05:00
::Dyn::func();
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
2021-04-16 04:06:51 -05:00
Dyn::CONST;
//~^ WARN trait objects without an explicit `dyn` are deprecated
2021-06-16 07:27:44 -05:00
//~| WARN this is accepted in the current edition
let _: Dyn::Ty; //~ ERROR ambiguous associated type
2021-07-10 03:00:54 -05:00
//~^ WARN trait objects without an explicit `dyn` are deprecated
//~| WARN this is accepted in the current edition
}