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;
28 const STRUCT: Struct = Struct { a: 1, b: 2 };
30 struct TupleStruct(u32);
31 const TUPLE_STRUCT: TupleStruct = TupleStruct(4);
38 const VARIANT1: Enum = Enum::Variant1('v');
39 const VARIANT2: Enum = Enum::Variant2 { a: 2 };
40 const VARIANT3: Enum = Enum::Variant3;
42 const STRING: &'static str = "String";
51 // if let 3 = CONSTANT {}
53 match (Struct { a: 2, b: 2 }) {
58 // if let STRUCT = STRUCT {}
60 match TupleStruct(3) {
65 // if let TupleStruct(4) = TUPLE_STRUCT {}
74 match (VARIANT3, VARIANT2) {
75 (VARIANT1, VARIANT3) => {},
76 (VARIANT2, VARIANT2) => {},
77 (VARIANT3, VARIANT1) => {},
81 // if let VARIANT1 = Enum::Variant3 {}
82 // if let VARIANT2 = Enum::Variant3 {}
83 // if let VARIANT3 = Enum::Variant3 {}
90 if let STRING = "def" {}