summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs')
-rw-r--r--src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs
new file mode 100644
index 000000000..b6a89e29e
--- /dev/null
+++ b/src/test/ui/regions/regions-lifetime-static-items-enclosing-scopes.rs
@@ -0,0 +1,20 @@
+// run-pass
+#![allow(dead_code)]
+// This test verifies that temporary lifetime is correctly computed
+// for static objects in enclosing scopes.
+
+
+use std::cmp::PartialEq;
+
+fn f<T:PartialEq+std::fmt::Debug>(o: &mut Option<T>) {
+ assert_eq!(*o, None);
+}
+
+pub fn main() {
+ mod t {
+ enum E {V=1, A=0}
+ static C: E = E::V;
+ }
+
+ f::<isize>(&mut None);
+}