Skip to content

Commit 41d06db

Browse files
committed
Reverse accidental src/llvm reversion in 876483d, and add test.
The test is reduced from a doc test, but making it separate ensures that (1) unrelated changes to the docs won't leave this case uncovered, and (2) the nature of any future failures will be more obvious to whoever sees the tree on fire as a result.
1 parent c081ffb commit 41d06db

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2013 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+
/*!
12+
* This is a regression test for a bug in LLVM, fixed in upstream r179587,
13+
* where the switch instructions generated for destructuring enums
14+
* represented with nullable pointers could be misoptimized in some cases.
15+
*/
16+
17+
enum List<X> { Nil, Cons(X, @List<X>) }
18+
pub fn main() {
19+
match Cons(10, @Nil) {
20+
Cons(10, _) => {}
21+
Nil => {}
22+
_ => fail!()
23+
}
24+
}

0 commit comments

Comments
 (0)