about summary refs log tree commit diff
path: root/tests/ui/const-ptr/pointer-address-stability.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/const-ptr/pointer-address-stability.rs')
-rw-r--r--tests/ui/const-ptr/pointer-address-stability.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/ui/const-ptr/pointer-address-stability.rs b/tests/ui/const-ptr/pointer-address-stability.rs
new file mode 100644
index 00000000000..84a36e1ddf5
--- /dev/null
+++ b/tests/ui/const-ptr/pointer-address-stability.rs
@@ -0,0 +1,11 @@
+//! Check that taking the address of a stack variable with `&`
+//! yields a stable and comparable pointer.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/2040>.
+
+//@ run-pass
+
+pub fn main() {
+    let foo: isize = 1;
+    assert_eq!(&foo as *const isize, &foo as *const isize);
+}