From 1bf4068805f9b04408d7266841c3d6f90502e867 Mon Sep 17 00:00:00 2001 From: Chris Tomlinson Date: Sun, 12 Jun 2016 21:45:48 +0100 Subject: [PATCH 1/2] Add test case for issue 23477 --- src/test/debuginfo/issue-23477.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/test/debuginfo/issue-23477.rs diff --git a/src/test/debuginfo/issue-23477.rs b/src/test/debuginfo/issue-23477.rs new file mode 100644 index 00000000000..02e9241b8e8 --- /dev/null +++ b/src/test/debuginfo/issue-23477.rs @@ -0,0 +1,24 @@ +// Copyright 2016 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. + +#![crate_type = "lib"] + +extern crate core; + +pub struct Dst { + pub a: (), + pub b: (), + pub data: [u8], +} + +pub unsafe fn borrow(bytes: &[u8]) -> &Dst { + let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); + dst +} From d991b1f624dce9e89456a6382308d1a9fff3abff Mon Sep 17 00:00:00 2001 From: Chris Tomlinson Date: Mon, 13 Jun 2016 22:27:13 +0100 Subject: [PATCH 2/2] Correct broken test --- src/test/{debuginfo => run-pass}/issue-23477.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) rename src/test/{debuginfo => run-pass}/issue-23477.rs (93%) diff --git a/src/test/debuginfo/issue-23477.rs b/src/test/run-pass/issue-23477.rs similarity index 93% rename from src/test/debuginfo/issue-23477.rs rename to src/test/run-pass/issue-23477.rs index 02e9241b8e8..d4671c919b7 100644 --- a/src/test/debuginfo/issue-23477.rs +++ b/src/test/run-pass/issue-23477.rs @@ -7,10 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![crate_type = "lib"] - -extern crate core; +// compiler-flags: -g pub struct Dst { pub a: (), @@ -22,3 +19,5 @@ pub unsafe fn borrow(bytes: &[u8]) -> &Dst { let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); dst } + +fn main() {}