]> git.lizzy.rs Git - rust.git/blob - tests/ui/kindck/kindck-inherited-copy-bound.rs
Note predicate span on ImplDerivedObligation
[rust.git] / tests / ui / kindck / kindck-inherited-copy-bound.rs
1 // Test that Copy bounds inherited by trait are checked.
2 //
3 // revisions: curr object_safe_for_dispatch
4
5 #![cfg_attr(object_safe_for_dispatch, feature(object_safe_for_dispatch))]
6
7
8 use std::any::Any;
9
10 trait Foo : Copy {
11     fn foo(&self) {}
12 }
13
14 impl<T:Copy> Foo for T {
15 }
16
17 fn take_param<T:Foo>(foo: &T) { }
18
19 fn a() {
20     let x: Box<_> = Box::new(3);
21     take_param(&x); //[curr]~ ERROR E0277
22     //[object_safe_for_dispatch]~^ ERROR E0277
23 }
24
25 fn b() {
26     let x: Box<_> = Box::new(3);
27     let y = &x;
28     let z = &x as &dyn Foo;
29     //[curr]~^ ERROR E0038
30     //[curr]~| ERROR E0038
31     //[object_safe_for_dispatch]~^^^ ERROR E0038
32 }
33
34 fn main() { }