]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/constant-debug-locs.rs
f150e84b9fdfecb5ded086e2d7ecc2b432b57f3d
[rust.git] / src / test / debuginfo / constant-debug-locs.rs
1 // Copyright 2013-2015 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-android: FIXME(#10381)
12 // min-lldb-version: 310
13
14 // compile-flags:-g
15
16 #![allow(unused_variables)]
17 #![allow(dead_code)]
18 #![omit_gdb_pretty_printer_section]
19 #![feature(std_misc, core)]
20
21 // This test makes sure that the compiler doesn't crash when trying to assign
22 // debug locations to const-expressions.
23
24 use std::sync::MUTEX_INIT;
25 use std::cell::UnsafeCell;
26
27 const CONSTANT: u64 = 3 + 4;
28
29 struct Struct {
30     a: isize,
31     b: usize,
32 }
33 const STRUCT: Struct = Struct { a: 1, b: 2 };
34
35 struct TupleStruct(u32);
36 const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
37
38 enum Enum {
39     Variant1(char),
40     Variant2 { a: u8 },
41     Variant3
42 }
43
44 const VARIANT1: Enum = Enum::Variant1('v');
45 const VARIANT2: Enum = Enum::Variant2 { a: 2 };
46 const VARIANT3: Enum = Enum::Variant3;
47
48 const STRING: &'static str = "String";
49
50 const VEC: [u32; 8] = [0; 8];
51
52 const NESTED: (Struct, TupleStruct) = (STRUCT, TUPLE_STRUCT);
53
54 const UNSAFE_CELL: UnsafeCell<bool> = UnsafeCell { value: false };
55
56 fn main() {
57     let mut _constant = CONSTANT;
58     let mut _struct = STRUCT;
59     let mut _tuple_struct = TUPLE_STRUCT;
60     let mut _variant1 = VARIANT1;
61     let mut _variant2 = VARIANT2;
62     let mut _variant3 = VARIANT3;
63     let mut _string = STRING;
64     let mut _vec = VEC;
65     let mut _nested = NESTED;
66     let mut _extern = MUTEX_INIT;
67     let mut _unsafe_cell = UNSAFE_CELL;
68 }