rust/tests/ui/dst/dst-sized-trait-param.rs

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

14 lines
407 B
Rust
Raw Normal View History

// Check that when you implement a trait that has a sized type
// parameter, the corresponding value must be sized. Also that the
// self type must be sized if appropriate.
2014-12-19 05:54:09 -06:00
trait Foo<T> : Sized { fn take(self, x: &T) { } } // Note: T is sized
impl Foo<[isize]> for usize { }
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
2014-12-05 20:12:25 -06:00
impl Foo<isize> for [usize] { }
2018-07-10 16:10:13 -05:00
//~^ ERROR the size for values of type
pub fn main() { }