Skip to content

Commit 2d33038

Browse files
committed
---
yaml --- r: 158695 b: refs/heads/snap-stage3 c: bfa5320 h: refs/heads/master i: 158693: 4974ca7 158691: 419b04b 158687: 595726a v: v3
1 parent 96098df commit 2d33038

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0b48001c28329392b26961eaf1c3ed293a352d6f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 9b322a6a90420759724471ca018b90603e8b1497
4+
refs/heads/snap-stage3: bfa5320527b838e1b735a2999acbe1f55b034205
55
refs/heads/try: f58aad6dce273570fb130b4df008ef9acd5a5be2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2014 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+
#![feature(unboxed_closures, overloaded_calls)]
12+
13+
#[inline]
14+
pub fn has_closures() -> uint {
15+
let x = 1u;
16+
let mut f = move |&mut:| x;
17+
let y = 1u;
18+
let g = |:| y;
19+
f() + g()
20+
}
21+
22+
pub fn has_generic_closures<T: Add<T,T> + Copy>(x: T, y: T) -> T {
23+
let mut f = move |&mut:| x;
24+
let g = |:| y;
25+
f() + g()
26+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 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+
// Test that unboxed closures work with cross-crate inlining
12+
// Acts as a regression test for #16790, #18378 and #18543
13+
14+
// aux-build:unboxed-closures-cross-crate.rs
15+
extern crate "unboxed-closures-cross-crate" as ubcc;
16+
17+
fn main() {
18+
assert_eq!(ubcc::has_closures(), 2u);
19+
assert_eq!(ubcc::has_generic_closures(2u, 3u), 5u);
20+
}

0 commit comments

Comments
 (0)