]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/constant-debug-locs.rs
Rollup merge of #44562 - eddyb:ugh-rustdoc, r=nikomatsakis
[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 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 #![allow(dead_code, unused_variables)]
16 #![feature(omit_gdb_pretty_printer_section)]
17 #![omit_gdb_pretty_printer_section]
18 #![feature(const_unsafe_cell_new)]
19 #![feature(static_mutex)]
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::cell::UnsafeCell;
25
26 const CONSTANT: u64 = 3 + 4;
27
28 struct Struct {
29     a: isize,
30     b: usize,
31 }
32 const STRUCT: Struct = Struct { a: 1, b: 2 };
33
34 struct TupleStruct(u32);
35 const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
36
37 enum Enum {
38     Variant1(char),
39     Variant2 { a: u8 },
40     Variant3
41 }
42
43 const VARIANT1: Enum = Enum::Variant1('v');
44 const VARIANT2: Enum = Enum::Variant2 { a: 2 };
45 const VARIANT3: Enum = Enum::Variant3;
46
47 const STRING: &'static str = "String";
48
49 const VEC: [u32; 8] = [0; 8];
50
51 const NESTED: (Struct, TupleStruct) = (STRUCT, TUPLE_STRUCT);
52
53 const UNSAFE_CELL: UnsafeCell<bool> = UnsafeCell::new(false);
54
55 fn main() {
56     let mut _constant = CONSTANT;
57     let mut _struct = STRUCT;
58     let mut _tuple_struct = TUPLE_STRUCT;
59     let mut _variant1 = VARIANT1;
60     let mut _variant2 = VARIANT2;
61     let mut _variant3 = VARIANT3;
62     let mut _string = STRING;
63     let mut _vec = VEC;
64     let mut _nested = NESTED;
65     let mut _unsafe_cell = UNSAFE_CELL;
66 }