]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-32008.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / issues / issue-32008.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26
XL
2#![allow(dead_code)]
3#![allow(unused_variables)]
abe05a73 4// Tests that binary operators allow subtyping on both the LHS and RHS,
0531ce1d 5// and as such do not introduce unnecessarily strict lifetime constraints.
abe05a73
XL
6
7use std::ops::Add;
8
9struct Foo;
10
11impl<'a> Add<&'a Foo> for &'a Foo {
12 type Output = ();
13 fn add(self, rhs: &'a Foo) {}
14}
15
16fn try_to_add(input: &Foo) {
17 let local = Foo;
18
19 // Manual reborrow worked even with invariant trait search.
20 &*input + &local;
21
22 // Direct use of the reference on the LHS requires additional
23 // subtyping before searching (invariantly) for `LHS: Add<RHS>`.
24 input + &local;
25}
26
27fn main() {
28}