1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // "guessing" in trait selection can affect `copy_or_move`. Check that this
12 // is correctly handled. I am not sure what is the "correct" behaviour,
13 // but we should at least not ICE.
19 struct S
<'a
,T
:'a
>(&'a T
);
20 impl<'a
, T
> Clone
for S
<'a
, T
> { fn clone(&self) -> Self { S(self.0) }
}
21 /// This impl triggers inference "guessing" - S<_>: Copy => _ = U
22 impl<'a
> Copy
for S
<'a
, Option
<U
>> {}
24 fn assert_impls_fn
<R
,T
: Fn()->R
>(_
: &T
){}
30 // S being copy is critical for this to work
35 assert_eq
!(f(), 1337+1);
38 // S being Copy is not critical here, but
39 // we check it anyway.
42 let ret
= mem
::size_of_val(e
.0);