summaryrefslogtreecommitdiffstats
path: root/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs')
-rw-r--r--src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs
new file mode 100644
index 000000000..dca26742d
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-borrow-scope-within-loop-ok.rs
@@ -0,0 +1,12 @@
+// run-pass
+
+fn borrow<T>(x: &T) -> &T {x}
+
+pub fn main() {
+ let x: Box<_> = Box::new(3);
+ loop {
+ let y = borrow(&*x);
+ assert_eq!(*x, *y);
+ break;
+ }
+}