]> git.proxmox.com Git - rustc.git/blame - src/test/debuginfo/borrowed-struct.rs
New upstream version 1.13.0+dfsg1
[rustc.git] / src / test / debuginfo / borrowed-struct.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
1a4d82fc
JJ
11// compile-flags:-g
12// min-lldb-version: 310
13
14// === GDB TESTS ===================================================================================
15
16// gdb-command:run
17
18// gdb-command:print *stack_val_ref
19// gdb-check:$1 = {x = 10, y = 23.5}
20
21// gdb-command:print *stack_val_interior_ref_1
22// gdb-check:$2 = 10
23
24// gdb-command:print *stack_val_interior_ref_2
25// gdb-check:$3 = 23.5
26
27// gdb-command:print *ref_to_unnamed
28// gdb-check:$4 = {x = 11, y = 24.5}
29
30// gdb-command:print *unique_val_ref
31// gdb-check:$5 = {x = 13, y = 26.5}
32
33// gdb-command:print *unique_val_interior_ref_1
34// gdb-check:$6 = 13
35
36// gdb-command:print *unique_val_interior_ref_2
37// gdb-check:$7 = 26.5
38
39
40// === LLDB TESTS ==================================================================================
41
42// lldb-command:run
43
44// lldb-command:print *stack_val_ref
45// lldb-check:[...]$0 = SomeStruct { x: 10, y: 23.5 }
46
47// lldb-command:print *stack_val_interior_ref_1
48// lldb-check:[...]$1 = 10
49
50// lldb-command:print *stack_val_interior_ref_2
51// lldb-check:[...]$2 = 23.5
52
53// lldb-command:print *ref_to_unnamed
54// lldb-check:[...]$3 = SomeStruct { x: 11, y: 24.5 }
55
56// lldb-command:print *unique_val_ref
57// lldb-check:[...]$4 = SomeStruct { x: 13, y: 26.5 }
58
59// lldb-command:print *unique_val_interior_ref_1
60// lldb-check:[...]$5 = 13
61
62// lldb-command:print *unique_val_interior_ref_2
63// lldb-check:[...]$6 = 26.5
64
65#![allow(unused_variables)]
66#![feature(box_syntax)]
b039eaaf 67#![feature(omit_gdb_pretty_printer_section)]
1a4d82fc
JJ
68#![omit_gdb_pretty_printer_section]
69
70struct SomeStruct {
c34b1796 71 x: isize,
1a4d82fc
JJ
72 y: f64
73}
74
75fn main() {
76 let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
77 let stack_val_ref: &SomeStruct = &stack_val;
c34b1796 78 let stack_val_interior_ref_1: &isize = &stack_val.x;
1a4d82fc
JJ
79 let stack_val_interior_ref_2: &f64 = &stack_val.y;
80 let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
81
c34b1796 82 let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 };
1a4d82fc 83 let unique_val_ref: &SomeStruct = &*unique_val;
c34b1796 84 let unique_val_interior_ref_1: &isize = &unique_val.x;
1a4d82fc
JJ
85 let unique_val_interior_ref_2: &f64 = &unique_val.y;
86
87 zzz(); // #break
88}
89
90fn zzz() {()}