]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/moves/use_of_moved_value_copy_suggestions.rs
4 fn duplicate_t
<T
>(t
: T
) -> (T
, T
) {
5 //~^ HELP consider restricting type parameter `T`
6 (t
, t
) //~ use of moved value: `t`
9 fn duplicate_opt
<T
>(t
: Option
<T
>) -> (Option
<T
>, Option
<T
>) {
10 //~^ HELP consider restricting type parameter `T`
11 (t
, t
) //~ use of moved value: `t`
14 fn duplicate_tup1
<T
>(t
: (T
,)) -> ((T
,), (T
,)) {
15 //~^ HELP consider restricting type parameter `T`
16 (t
, t
) //~ use of moved value: `t`
19 fn duplicate_tup2
<A
, B
>(t
: (A
, B
)) -> ((A
, B
), (A
, B
)) {
20 //~^ HELP consider restricting type parameters
21 (t
, t
) //~ use of moved value: `t`
24 fn duplicate_custom
<T
>(t
: S
<T
>) -> (S
<T
>, S
<T
>) {
25 //~^ HELP consider restricting type parameter `T`
26 (t
, t
) //~ use of moved value: `t`
31 impl<T
: Trait
+ Clone
> Clone
for S
<T
> {
32 fn clone(&self) -> Self {
36 impl<T
: Trait
+ Copy
> Copy
for S
<T
> {}
41 // Test where bounds are added with different bound placements
42 fn duplicate_custom_1
<T
>(t
: S
<T
>) -> (S
<T
>, S
<T
>) where {
43 //~^ HELP consider restricting type parameter `T`
44 (t
, t
) //~ use of moved value: `t`
47 fn duplicate_custom_2
<T
>(t
: S
<T
>) -> (S
<T
>, S
<T
>)
50 //~^ HELP consider further restricting this bound
52 (t
, t
) //~ use of moved value: `t`
55 fn duplicate_custom_3
<T
>(t
: S
<T
>) -> (S
<T
>, S
<T
>)
58 //~^ HELP consider further restricting this bound
61 (t
, t
) //~ use of moved value: `t`
64 fn duplicate_custom_4
<T
: A
>(t
: S
<T
>) -> (S
<T
>, S
<T
>)
65 //~^ HELP consider further restricting this bound
69 (t
, t
) //~ use of moved value: `t`
73 fn existing_colon
<T
:>(t
: T
) {
74 //~^ HELP consider restricting type parameter `T`
75 [t
, t
]; //~ use of moved value: `t`
78 fn existing_colon_in_where
<T
>(t
: T
)
81 //~^ HELP consider further restricting type parameter `T`
83 [t
, t
]; //~ use of moved value: `t`