Files
rust/tests/ui/kindck/kindck-inherited-copy-bound.rs

29 lines
411 B
Rust
Raw Normal View History

// Test that Copy bounds inherited by trait are checked.
2015-01-07 18:53:58 -08:00
use std::any::Any;
trait Foo : Copy {
2015-02-18 15:58:07 -08:00
fn foo(&self) {}
}
impl<T:Copy> Foo for T {
}
fn take_param<T:Foo>(foo: &T) { }
fn a() {
let x: Box<_> = Box::new(3);
2025-02-04 02:37:13 +00:00
take_param(&x); //~ ERROR E0277
}
fn b() {
let x: Box<_> = Box::new(3);
let y = &x;
2019-05-28 14:46:13 -04:00
let z = &x as &dyn Foo;
2025-02-04 02:37:13 +00:00
//~^ ERROR E0038
//~| ERROR E0038
}
fn main() { }