]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-27949.rs
3 // At one time, the `==` operator (and other binary operators) did not
4 // support subtyping during type checking, and would therefore require
5 // LHS and RHS to be exactly identical--i.e. to have the same lifetimes.
7 // This was fixed in 1a7fb7dc78439a704f024609ce3dc0beb1386552.
14 impl <'a
> std
::cmp
::PartialEq
<Input
<'a
>> for Input
<'a
> {
15 fn eq(&self, other
: &Input
<'a
>) -> bool
{
19 fn ne(&self, other
: &Input
<'a
>) -> bool
{
25 fn check_equal
<'a
, 'b
>(x
: Input
<'a
>, y
: Input
<'b
>) -> bool
{
26 // Type checking error due to 'a != 'b prior to 1a7fb7dc78
35 let input_i
= Input { foo: &i }
;
36 let input_j
= Input { foo: &j }
;
37 let input_k
= Input { foo: &k }
;
38 assert
!(check_equal(input_i
, input_i
));
39 assert
!(check_equal(input_i
, input_j
));
40 assert
!(!check_equal(input_i
, input_k
));