summaryrefslogtreecommitdiff
path: root/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs')
-rw-r--r--tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs
new file mode 100644
index 00000000000..c9e043577ed
--- /dev/null
+++ b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs
@@ -0,0 +1,11 @@
+type Lazy<T> = Box<dyn Fn() -> T + 'static>;
+
+fn test(x: &i32) -> Lazy<i32> {
+ Box::new(|| {
+ //~^ ERROR lifetime may not live long enough
+ //~| ERROR closure may outlive the current function
+ *x
+ })
+}
+
+fn main() {}