]>
git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/constant-in-match-pattern.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.
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.
11 // min-lldb-version: 310
15 #![allow(dead_code, unused_variables)]
16 #![feature(omit_gdb_pretty_printer_section)]
17 #![omit_gdb_pretty_printer_section]
19 // This test makes sure that the compiler doesn't crash when trying to assign
20 // debug locations to 'constant' patterns in match expressions.
22 const CONSTANT
: u64 = 3;
24 #[derive(PartialEq, Eq)]
29 const STRUCT
: Struct
= Struct { a: 1, b: 2 }
;
31 #[derive(PartialEq, Eq)]
32 struct TupleStruct(u32);
33 const TUPLE_STRUCT
: TupleStruct
= TupleStruct(4);
35 #[derive(PartialEq, Eq)]
41 const VARIANT1
: Enum
= Enum
::Variant1('v'
);
42 const VARIANT2
: Enum
= Enum
::Variant2 { a: 2 }
;
43 const VARIANT3
: Enum
= Enum
::Variant3
;
45 const STRING
: &'
static str = "String";
54 // if let 3 = CONSTANT {}
56 match (Struct { a: 2, b: 2 }
) {
61 // if let STRUCT = STRUCT {}
63 match TupleStruct(3) {
68 // if let TupleStruct(4) = TUPLE_STRUCT {}
77 match (VARIANT3
, VARIANT2
) {
78 (VARIANT1
, VARIANT3
) => {}
,
79 (VARIANT2
, VARIANT2
) => {}
,
80 (VARIANT3
, VARIANT1
) => {}
,
84 // if let VARIANT1 = Enum::Variant3 {}
85 // if let VARIANT2 = Enum::Variant3 {}
86 // if let VARIANT3 = Enum::Variant3 {}
93 if let STRING
= "def" {}