about summary refs log tree commit diff
path: root/tests/ui/static/static-region-bound.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/static/static-region-bound.rs')
-rw-r--r--tests/ui/static/static-region-bound.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/static/static-region-bound.rs b/tests/ui/static/static-region-bound.rs
new file mode 100644
index 00000000000..d70706e5764
--- /dev/null
+++ b/tests/ui/static/static-region-bound.rs
@@ -0,0 +1,12 @@
+fn id<T>(x: T) -> T { x }
+
+fn f<T:'static>(_: T) {}
+
+fn main() {
+
+    let x: Box<_> = Box::new(3);
+    f(x);
+
+    let x = &id(3); //~ ERROR temporary value dropped while borrowed
+    f(x);
+}