fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1// run-rustfix 2 3#[allow(unused)] 4use std::fmt::Debug; 5// Rustfix should add this, or use `std::fmt::Debug` instead. 6 7#[allow(dead_code)] 8fn test_impl(t: impl Sized + std::fmt::Debug) { 9 println!("{:?}", t); 10 //~^ ERROR doesn't implement 11} 12 13#[allow(dead_code)] 14fn test_no_bounds<T: std::fmt::Debug>(t: T) { 15 println!("{:?}", t); 16 //~^ ERROR doesn't implement 17} 18 19#[allow(dead_code)] 20fn test_one_bound<T: Sized + std::fmt::Debug>(t: T) { 21 println!("{:?}", t); 22 //~^ ERROR doesn't implement 23} 24 25#[allow(dead_code)] 26fn test_no_bounds_where<X, Y>(x: X, y: Y) where X: std::fmt::Debug, Y: std::fmt::Debug { 27 println!("{:?} {:?}", x, y); 28 //~^ ERROR doesn't implement 29} 30 31#[allow(dead_code)] 32fn test_one_bound_where<X>(x: X) where X: Sized + std::fmt::Debug { 33 println!("{:?}", x); 34 //~^ ERROR doesn't implement 35} 36 37#[allow(dead_code)] 38fn test_many_bounds_where<X>(x: X) where X: Sized + std::fmt::Debug, X: Sized { 39 println!("{:?}", x); 40 //~^ ERROR doesn't implement 41} 42 43trait Foo<T>: Sized { 44 const SIZE: usize = core::mem::size_of::<Self>(); 45 //~^ ERROR the size for values of type `Self` cannot be known at compilation time 46} 47 48trait Bar: std::fmt::Display + Sized { 49 const SIZE: usize = core::mem::size_of::<Self>(); 50 //~^ ERROR the size for values of type `Self` cannot be known at compilation time 51} 52 53trait Baz: Sized where Self: std::fmt::Display { 54 const SIZE: usize = core::mem::size_of::<Self>(); 55 //~^ ERROR the size for values of type `Self` cannot be known at compilation time 56} 57 58trait Qux<T>: Sized where Self: std::fmt::Display { 59 const SIZE: usize = core::mem::size_of::<Self>(); 60 //~^ ERROR the size for values of type `Self` cannot be known at compilation time 61} 62 63trait Bat<T>: std::fmt::Display + Sized { 64 const SIZE: usize = core::mem::size_of::<Self>(); 65 //~^ ERROR the size for values of type `Self` cannot be known at compilation time 66} 67 68fn main() { }