diff --git a/src/test/run-pass/const-autoderef-newtype.rs b/src/test/run-pass/const-autoderef-newtype.rs new file mode 100644 index 00000000000..cb56ab36335 --- /dev/null +++ b/src/test/run-pass/const-autoderef-newtype.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +struct S(&'static [int]); +const C0: S = S([3]); +const C1: int = C0[0]; + +pub fn main() { + fail_unless!(C1 == 3); +} diff --git a/src/test/run-pass/const-autoderef.rs b/src/test/run-pass/const-autoderef.rs new file mode 100644 index 00000000000..9fb6c4aa0db --- /dev/null +++ b/src/test/run-pass/const-autoderef.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const A: [u8 * 1] = ['h' as u8]; +const B: u8 = (&A)[0]; +const C: &'static &'static &'static &'static [u8 * 1] = & & & &A; +const D: u8 = (&C)[0]; + +pub fn main() { + fail_unless!(B == A[0]); + fail_unless!(D == A[0]); +}