summary refs log tree commit diff
path: root/tests/ui/dyn-compatibility/bare-trait-dont-suggest-dyn.rs
blob: cf9be612d2e7e7199b92f1108df44759af08b4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//@ revisions: old new
//@[old] edition:2015
//@[new] edition:2021
//@[new] run-rustfix
#![deny(bare_trait_objects)]
fn ord_prefer_dot(s: String) -> Ord {
    //[new]~^ ERROR expected a type, found a trait
    //[old]~^^ ERROR the trait `Ord` cannot be made into an object
    //[old]~| ERROR trait objects without an explicit `dyn` are deprecated
    //[old]~| WARNING this is accepted in the current edition (Rust 2015)
    (s.starts_with("."), s)
}
fn main() {
    let _ = ord_prefer_dot(String::new());
}