mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
reformat and update remaining ui/kindck tests
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
fn assert_copy<T:Copy>() { }
|
||||
fn assert_copy<T: Copy>() {}
|
||||
|
||||
trait Dummy { }
|
||||
trait Dummy {}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
struct MyStruct {
|
||||
@@ -16,8 +16,8 @@ struct MyNoncopyStruct {
|
||||
x: Box<char>,
|
||||
}
|
||||
|
||||
fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
// lifetime pointers are ok...
|
||||
fn test<'a, T, U: Copy>(_: &'a isize) {
|
||||
// references are ok...
|
||||
assert_copy::<&'static isize>();
|
||||
assert_copy::<&'a isize>();
|
||||
assert_copy::<&'a str>();
|
||||
@@ -25,25 +25,25 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
|
||||
// ...unless they are mutable
|
||||
assert_copy::<&'static mut isize>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<&'a mut isize>(); //~ ERROR : Copy` is not satisfied
|
||||
|
||||
// boxes are not ok
|
||||
assert_copy::<Box<isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<String>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Vec<isize> >(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Box<isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<String>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Vec<isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Box<&'a mut isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
|
||||
// borrowed object types are generally ok
|
||||
// borrowed trait objects are generally ok
|
||||
assert_copy::<&'a dyn Dummy>();
|
||||
assert_copy::<&'a (dyn Dummy + Send)>();
|
||||
assert_copy::<&'static (dyn Dummy + Send)>();
|
||||
|
||||
// owned object types are not ok
|
||||
// boxed trait objects are not ok
|
||||
assert_copy::<Box<dyn Dummy>>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Box<dyn Dummy + Send>>(); //~ ERROR : Copy` is not satisfied
|
||||
|
||||
// mutable object types are not ok
|
||||
assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : Copy` is not satisfied
|
||||
// mutable references to trait objects are not ok
|
||||
assert_copy::<&'a mut (dyn Dummy + Send)>(); //~ ERROR : Copy` is not satisfied
|
||||
|
||||
// raw ptrs are ok
|
||||
assert_copy::<*const isize>();
|
||||
@@ -55,7 +55,7 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
assert_copy::<()>();
|
||||
|
||||
// tuples are ok
|
||||
assert_copy::<(isize,isize)>();
|
||||
assert_copy::<(isize, isize)>();
|
||||
|
||||
// structs of POD are ok
|
||||
assert_copy::<MyStruct>();
|
||||
@@ -64,8 +64,7 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
|
||||
assert_copy::<MyNoncopyStruct>(); //~ ERROR : Copy` is not satisfied
|
||||
|
||||
// ref counted types are not ok
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
assert_copy::<Rc<isize>>(); //~ ERROR : Copy` is not satisfied
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
}
|
||||
pub fn main() {}
|
||||
|
||||
@@ -5,10 +5,10 @@ LL | assert_copy::<&'static mut isize>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'static mut isize`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
help: consider removing the leading `&`-reference
|
||||
|
|
||||
LL - assert_copy::<&'static mut isize>();
|
||||
@@ -22,10 +22,10 @@ LL | assert_copy::<&'a mut isize>();
|
||||
| ^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut isize`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
help: consider removing the leading `&`-reference
|
||||
|
|
||||
LL - assert_copy::<&'a mut isize>();
|
||||
@@ -39,10 +39,10 @@ LL | assert_copy::<Box<isize>>();
|
||||
| ^^^^^^^^^^ the trait `Copy` is not implemented for `Box<isize>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:32:19
|
||||
@@ -51,22 +51,22 @@ LL | assert_copy::<String>();
|
||||
| ^^^^^^ the trait `Copy` is not implemented for `String`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `Vec<isize>: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:33:19
|
||||
|
|
||||
LL | assert_copy::<Vec<isize> >();
|
||||
LL | assert_copy::<Vec<isize>>();
|
||||
| ^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<isize>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `Box<&'a mut isize>: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:34:19
|
||||
@@ -75,10 +75,10 @@ LL | assert_copy::<Box<&'a mut isize>>();
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<&'a mut isize>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `Box<dyn Dummy>: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:42:19
|
||||
@@ -87,10 +87,10 @@ LL | assert_copy::<Box<dyn Dummy>>();
|
||||
| ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<dyn Dummy>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `Box<dyn Dummy + Send>: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:43:19
|
||||
@@ -99,10 +99,10 @@ LL | assert_copy::<Box<dyn Dummy + Send>>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Box<dyn Dummy + Send>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `&'a mut (dyn Dummy + Send + 'a): Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:46:19
|
||||
@@ -111,10 +111,10 @@ LL | assert_copy::<&'a mut (dyn Dummy + Send)>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `&'a mut (dyn Dummy + Send + 'a)`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `MyNoncopyStruct: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:64:19
|
||||
@@ -128,10 +128,10 @@ help: the trait `Copy` is not implemented for `MyNoncopyStruct`
|
||||
LL | struct MyNoncopyStruct {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error[E0277]: the trait bound `Rc<isize>: Copy` is not satisfied
|
||||
--> $DIR/kindck-copy.rs:67:19
|
||||
@@ -140,10 +140,10 @@ LL | assert_copy::<Rc<isize>>();
|
||||
| ^^^^^^^^^ the trait `Copy` is not implemented for `Rc<isize>`
|
||||
|
|
||||
note: required by a bound in `assert_copy`
|
||||
--> $DIR/kindck-copy.rs:5:18
|
||||
--> $DIR/kindck-copy.rs:5:19
|
||||
|
|
||||
LL | fn assert_copy<T:Copy>() { }
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
LL | fn assert_copy<T: Copy>() {}
|
||||
| ^^^^ required by this bound in `assert_copy`
|
||||
|
||||
error: aborting due to 11 previous errors
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
trait Foo {
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl<T:Copy> Foo for T {
|
||||
}
|
||||
|
||||
fn take_param<T:Foo>(foo: &T) { }
|
||||
|
||||
fn main() {
|
||||
let x: Box<_> = Box::new(3);
|
||||
take_param(&x);
|
||||
//~^ ERROR the trait bound `Box<{integer}>: Foo` is not satisfied
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
|
||||
--> $DIR/kindck-impl-type-params-2.rs:13:16
|
||||
|
|
||||
LL | take_param(&x);
|
||||
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required for `Box<{integer}>` to implement `Foo`
|
||||
--> $DIR/kindck-impl-type-params-2.rs:6:14
|
||||
|
|
||||
LL | impl<T:Copy> Foo for T {
|
||||
| ---- ^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
note: required by a bound in `take_param`
|
||||
--> $DIR/kindck-impl-type-params-2.rs:9:17
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ^^^ required by this bound in `take_param`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
@@ -6,7 +6,9 @@
|
||||
struct S<T>(marker::PhantomData<T>);
|
||||
|
||||
trait Gettable<T> {
|
||||
fn get(&self) -> T { panic!() }
|
||||
fn get(&self) -> T {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
@@ -45,4 +47,4 @@ fn foo3<'a>() {
|
||||
//~^ ERROR : Copy` is not satisfied
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
fn main() {}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
error[E0277]: `T` cannot be sent between threads safely
|
||||
--> $DIR/kindck-impl-type-params.rs:16:13
|
||||
--> $DIR/kindck-impl-type-params.rs:18:13
|
||||
|
|
||||
LL | let a = &t as &dyn Gettable<T>;
|
||||
| ^^ `T` cannot be sent between threads safely
|
||||
|
|
||||
note: required for `S<T>` to implement `Gettable<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -18,13 +18,13 @@ LL | fn f<T: std::marker::Send>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `T: Copy` is not satisfied
|
||||
--> $DIR/kindck-impl-type-params.rs:16:13
|
||||
--> $DIR/kindck-impl-type-params.rs:18:13
|
||||
|
|
||||
LL | let a = &t as &dyn Gettable<T>;
|
||||
| ^^ the trait `Copy` is not implemented for `T`
|
||||
|
|
||||
note: required for `S<T>` to implement `Gettable<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -37,13 +37,13 @@ LL | fn f<T: std::marker::Copy>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: `T` cannot be sent between threads safely
|
||||
--> $DIR/kindck-impl-type-params.rs:23:31
|
||||
--> $DIR/kindck-impl-type-params.rs:25:31
|
||||
|
|
||||
LL | let a: &dyn Gettable<T> = &t;
|
||||
| ^^ `T` cannot be sent between threads safely
|
||||
|
|
||||
note: required for `S<T>` to implement `Gettable<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -56,13 +56,13 @@ LL | fn g<T: std::marker::Send>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `T: Copy` is not satisfied
|
||||
--> $DIR/kindck-impl-type-params.rs:23:31
|
||||
--> $DIR/kindck-impl-type-params.rs:25:31
|
||||
|
|
||||
LL | let a: &dyn Gettable<T> = &t;
|
||||
| ^^ the trait `Copy` is not implemented for `T`
|
||||
|
|
||||
note: required for `S<T>` to implement `Gettable<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -75,18 +75,18 @@ LL | fn g<T: std::marker::Copy>(val: T) {
|
||||
| +++++++++++++++++++
|
||||
|
||||
error[E0277]: the trait bound `String: Copy` is not satisfied
|
||||
--> $DIR/kindck-impl-type-params.rs:36:13
|
||||
--> $DIR/kindck-impl-type-params.rs:38:13
|
||||
|
|
||||
LL | let a = t as Box<dyn Gettable<String>>;
|
||||
| ^ the trait `Copy` is not implemented for `String`
|
||||
|
|
||||
help: the trait `Gettable<T>` is implemented for `S<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:1
|
||||
--> $DIR/kindck-impl-type-params.rs:14:1
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required for `S<String>` to implement `Gettable<String>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -95,18 +95,18 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
= note: required for the cast from `Box<S<String>>` to `Box<dyn Gettable<String>>`
|
||||
|
||||
error[E0277]: the trait bound `Foo: Copy` is not satisfied
|
||||
--> $DIR/kindck-impl-type-params.rs:44:37
|
||||
--> $DIR/kindck-impl-type-params.rs:46:37
|
||||
|
|
||||
LL | let a: Box<dyn Gettable<Foo>> = t;
|
||||
| ^ the trait `Copy` is not implemented for `Foo`
|
||||
|
|
||||
help: the trait `Gettable<T>` is implemented for `S<T>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:1
|
||||
--> $DIR/kindck-impl-type-params.rs:14:1
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: required for `S<Foo>` to implement `Gettable<Foo>`
|
||||
--> $DIR/kindck-impl-type-params.rs:12:32
|
||||
--> $DIR/kindck-impl-type-params.rs:14:32
|
||||
|
|
||||
LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
|
||||
| ---- ^^^^^^^^^^^ ^^^^
|
||||
@@ -120,7 +120,7 @@ LL | struct Foo; // does not impl Copy
|
||||
|
|
||||
|
||||
error: lifetime may not live long enough
|
||||
--> $DIR/kindck-impl-type-params.rs:30:13
|
||||
--> $DIR/kindck-impl-type-params.rs:32:13
|
||||
|
|
||||
LL | fn foo<'a>() {
|
||||
| -- lifetime `'a` defined here
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:21:16
|
||||
|
|
||||
LL | take_param(&x);
|
||||
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required for `Box<{integer}>` to implement `Foo`
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:14:14
|
||||
|
|
||||
LL | impl<T:Copy> Foo for T {
|
||||
| ---- ^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
note: required by a bound in `take_param`
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:17:17
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ^^^ required by this bound in `take_param`
|
||||
|
||||
error[E0038]: the trait `Foo` is not dyn compatible
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:28:19
|
||||
|
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^^^^^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:10:13
|
||||
|
|
||||
LL | trait Foo : Copy {
|
||||
| --- ^^^^ ...because it requires `Self: Sized`
|
||||
| |
|
||||
| this trait is not dyn compatible...
|
||||
|
||||
error[E0038]: the trait `Foo` is not dyn compatible
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:28:13
|
||||
|
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:10:13
|
||||
|
|
||||
LL | trait Foo : Copy {
|
||||
| --- ^^^^ ...because it requires `Self: Sized`
|
||||
| |
|
||||
| this trait is not dyn compatible...
|
||||
= note: required for the cast from `&Box<{integer}>` to `&dyn Foo`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0038, E0277.
|
||||
For more information about an error, try `rustc --explain E0038`.
|
||||
@@ -1,16 +1,14 @@
|
||||
// Test that Copy bounds inherited by trait are checked.
|
||||
|
||||
|
||||
use std::any::Any;
|
||||
|
||||
trait Foo : Copy {
|
||||
trait Foo: Copy {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
impl<T:Copy> Foo for T {
|
||||
}
|
||||
impl<T: Copy> Foo for T {}
|
||||
|
||||
fn take_param<T:Foo>(foo: &T) { }
|
||||
fn take_param<T: Foo>(foo: &T) {}
|
||||
|
||||
fn a() {
|
||||
let x: Box<_> = Box::new(3);
|
||||
@@ -24,4 +22,4 @@ fn b() {
|
||||
//~^ ERROR E0038
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
fn main() {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
error[E0277]: the trait bound `Box<{integer}>: Foo` is not satisfied
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:17:16
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:15:16
|
||||
|
|
||||
LL | take_param(&x);
|
||||
| ---------- ^^ the trait `Copy` is not implemented for `Box<{integer}>`
|
||||
@@ -7,30 +7,30 @@ LL | take_param(&x);
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
note: required for `Box<{integer}>` to implement `Foo`
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:10:14
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:9:15
|
||||
|
|
||||
LL | impl<T:Copy> Foo for T {
|
||||
| ---- ^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
LL | impl<T: Copy> Foo for T {}
|
||||
| ---- ^^^ ^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
note: required by a bound in `take_param`
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:13:17
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:11:18
|
||||
|
|
||||
LL | fn take_param<T:Foo>(foo: &T) { }
|
||||
| ^^^ required by this bound in `take_param`
|
||||
LL | fn take_param<T: Foo>(foo: &T) {}
|
||||
| ^^^ required by this bound in `take_param`
|
||||
|
||||
error[E0038]: the trait `Foo` is not dyn compatible
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:23:24
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:21:24
|
||||
|
|
||||
LL | let z = &x as &dyn Foo;
|
||||
| ^^^ `Foo` is not dyn compatible
|
||||
|
|
||||
note: for a trait to be dyn compatible it needs to allow building a vtable
|
||||
for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility>
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:6:13
|
||||
--> $DIR/kindck-inherited-copy-bound.rs:5:12
|
||||
|
|
||||
LL | trait Foo : Copy {
|
||||
| --- ^^^^ ...because it requires `Self: Sized`
|
||||
LL | trait Foo: Copy {
|
||||
| --- ^^^^ ...because it requires `Self: Sized`
|
||||
| |
|
||||
| this trait is not dyn compatible...
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
fn foo(_x: Rc<usize>) {}
|
||||
|
||||
fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
fn bar<F: FnOnce() + Send>(_: F) {}
|
||||
|
||||
fn main() {
|
||||
let x = Rc::new(3);
|
||||
bar(move|| foo(x));
|
||||
bar(move || foo(x));
|
||||
//~^ ERROR `Rc<usize>` cannot be sent between threads safely
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
error[E0277]: `Rc<usize>` cannot be sent between threads safely
|
||||
--> $DIR/kindck-nonsendable-1.rs:9:9
|
||||
|
|
||||
LL | bar(move|| foo(x));
|
||||
| --- ------^^^^^^^
|
||||
LL | bar(move || foo(x));
|
||||
| --- -------^^^^^^^
|
||||
| | |
|
||||
| | `Rc<usize>` cannot be sent between threads safely
|
||||
| | within this `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`
|
||||
| | within this `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:16}`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:15}`, the trait `Send` is not implemented for `Rc<usize>`
|
||||
= help: within `{closure@$DIR/kindck-nonsendable-1.rs:9:9: 9:16}`, the trait `Send` is not implemented for `Rc<usize>`
|
||||
note: required because it's used within this closure
|
||||
--> $DIR/kindck-nonsendable-1.rs:9:9
|
||||
|
|
||||
LL | bar(move|| foo(x));
|
||||
| ^^^^^^
|
||||
LL | bar(move || foo(x));
|
||||
| ^^^^^^^
|
||||
note: required by a bound in `bar`
|
||||
--> $DIR/kindck-nonsendable-1.rs:5:21
|
||||
--> $DIR/kindck-nonsendable-1.rs:5:22
|
||||
|
|
||||
LL | fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
| ^^^^ required by this bound in `bar`
|
||||
LL | fn bar<F: FnOnce() + Send>(_: F) {}
|
||||
| ^^^^ required by this bound in `bar`
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user