]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/by-value-non-immediate-argument.rs
Add verbose option to rustdoc in order to fix problem with --version
[rust.git] / src / test / debuginfo / by-value-non-immediate-argument.rs
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
11 // ignore-tidy-linelength
12 // ignore-android: FIXME(#10381)
13 // min-lldb-version: 310
14
15 // compile-flags:-g
16
17 // === GDB TESTS ===================================================================================
18
19 // gdb-command:run
20
21 // gdb-command:print s
22 // gdb-check:$1 = {a = 1, b = 2.5}
23 // gdb-command:continue
24
25 // gdb-command:print x
26 // gdb-check:$2 = {a = 3, b = 4.5}
27 // gdb-command:print y
28 // gdb-check:$3 = 5
29 // gdb-command:print z
30 // gdb-check:$4 = 6.5
31 // gdb-command:continue
32
33 // gdb-command:print a
34 // gdb-check:$5 = {7, 8, 9.5, 10.5}
35 // gdb-command:continue
36
37 // gdb-command:print a
38 // gdb-check:$6 = {11.5, 12.5, 13, 14}
39 // gdb-command:continue
40
41 // gdb-command:print x
42 // gdb-check:$7 = {{RUST$ENUM$DISR = Case1, x = 0, y = 8970181431921507452}, {RUST$ENUM$DISR = Case1, 0, 2088533116, 2088533116}}
43 // gdb-command:continue
44
45
46 // === LLDB TESTS ==================================================================================
47
48 // lldb-command:run
49
50 // lldb-command:print s
51 // lldb-check:[...]$0 = Struct { a: 1, b: 2.5 }
52 // lldb-command:continue
53
54 // lldb-command:print x
55 // lldb-check:[...]$1 = Struct { a: 3, b: 4.5 }
56 // lldb-command:print y
57 // lldb-check:[...]$2 = 5
58 // lldb-command:print z
59 // lldb-check:[...]$3 = 6.5
60 // lldb-command:continue
61
62 // lldb-command:print a
63 // lldb-check:[...]$4 = (7, 8, 9.5, 10.5)
64 // lldb-command:continue
65
66 // lldb-command:print a
67 // lldb-check:[...]$5 = Newtype(11.5, 12.5, 13, 14)
68 // lldb-command:continue
69
70 // lldb-command:print x
71 // lldb-check:[...]$6 = Case1 { x: 0, y: 8970181431921507452 }
72 // lldb-command:continue
73
74 #[deriving(Clone)]
75 struct Struct {
76     a: int,
77     b: f64
78 }
79
80 #[deriving(Clone)]
81 struct StructStruct {
82     a: Struct,
83     b: Struct
84 }
85
86 fn fun(s: Struct) {
87     zzz(); // #break
88 }
89
90 fn fun_fun(StructStruct { a: x, b: Struct { a: y, b: z } }: StructStruct) {
91     zzz(); // #break
92 }
93
94 fn tup(a: (int, uint, f64, f64)) {
95     zzz(); // #break
96 }
97
98 struct Newtype(f64, f64, int, uint);
99
100 fn new_type(a: Newtype) {
101     zzz(); // #break
102 }
103
104 // The first element is to ensure proper alignment, irrespective of the machines word size. Since
105 // the size of the discriminant value is machine dependent, this has be taken into account when
106 // datatype layout should be predictable as in this case.
107 enum Enum {
108     Case1 { x: i64, y: i64 },
109     Case2 (i64, i32, i32),
110 }
111
112 fn by_val_enum(x: Enum) {
113     zzz(); // #break
114 }
115
116 fn main() {
117     fun(Struct { a: 1, b: 2.5 });
118     fun_fun(StructStruct { a: Struct { a: 3, b: 4.5 }, b: Struct { a: 5, b: 6.5 } });
119     tup((7, 8, 9.5, 10.5));
120     new_type(Newtype(11.5, 12.5, 13, 14));
121
122     // 0b0111110001111100011111000111110001111100011111000111110001111100 = 8970181431921507452
123     // 0b01111100011111000111110001111100 = 2088533116
124     // 0b0111110001111100 = 31868
125     // 0b01111100 = 124
126     by_val_enum(Enum::Case1 { x: 0, y: 8970181431921507452 });
127 }
128
129 fn zzz() { () }