]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/relate_tys/hr-fn-aau-eq-abu.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / nll / relate_tys / hr-fn-aau-eq-abu.rs
1 // Test an interesting corner case that ought to be legal (though the
2 // current code actually gets it wrong, see below): a fn that takes
3 // two arguments that are references with the same lifetime is in fact
4 // equivalent to a fn that takes two references with distinct
5 // lifetimes. This is true because the two functions can call one
6 // another -- effectively, the single lifetime `'a` is just inferred
7 // to be the intersection of the two distinct lifetimes.
8 //
9 // check-pass
10 // compile-flags:-Zno-leak-check
11
12 use std::cell::Cell;
13
14 fn make_cell_aa() -> Cell<for<'a> fn(&'a u32, &'a u32)> {
15 panic!()
16 }
17
18 fn aa_eq_ab() {
19 let a: Cell<for<'a, 'b> fn(&'a u32, &'b u32)> = make_cell_aa();
20 drop(a);
21 }
22
23 fn main() { }