]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/user-annotations/closure-substs.rs
1 // Test that we enforce user-provided type annotations on closures.
4 // Here `x` is free in the closure sig:
5 |x
: &'a
i32| -> &'
static i32 {
6 return x
; //~ ERROR lifetime may not live long enough
11 // Here `x` is bound in the closure sig:
12 |x
: &i32| -> &'
static i32 {
13 return x
; //~ ERROR lifetime may not live long enough
18 // Here `x` is free in the closure sig:
19 |x
: &'a
i32, b
: fn(&'
static i32)| {
20 b(x
); //~ ERROR lifetime may not live long enough
25 // Here `x` is bound in the closure sig:
26 |x
: &i32, b
: fn(&'
static i32)| {
27 b(x
); //~ ERROR borrowed data escapes outside of closure