]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/closure-requirements/return-wrong-bound-region.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / nll / closure-requirements / return-wrong-bound-region.rs
CommitLineData
ff7c6d11
XL
1// Test closure that takes two references and is supposed to return
2// the first, but actually returns the second. This should fail within
3// the closure.
4
923072b8 5// compile-flags:-Zverbose
ff7c6d11
XL
6
7#![feature(rustc_attrs)]
8
9#[rustc_regions]
10fn test() {
11 expect_sig(|a, b| b); // ought to return `a`
b7449926 12 //~^ ERROR
ff7c6d11
XL
13}
14
15fn expect_sig<F>(f: F) -> F
16 where F: for<'a> FnMut(&'a i32, &i32) -> &'a i32
17{
18 f
19}
20
21fn deref(_p: &i32) { }
22
23fn main() { }