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