Skip to content

Commit 07e821a

Browse files
committed
auto merge of #9225 : huonw/rust/closing-time, r=alexcrichton
Closes #2074. Closes #5008. Closes #7519. Closes #7673. Closes #7770. Closes #8171.
2 parents 6055611 + 4f92f45 commit 07e821a

5 files changed

+166
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
13+
#5008 cast to &Trait causes code to segfault on method call
14+
15+
It fixes itself if the &Trait is changed to @Trait.
16+
*/
17+
18+
trait Debuggable {
19+
fn debug_name(&self) -> ~str;
20+
}
21+
22+
#[deriving(Clone)]
23+
struct Thing {
24+
name: ~str,
25+
}
26+
27+
impl Thing {
28+
fn new() -> Thing { Thing { name: ~"dummy" } }
29+
}
30+
31+
impl Debuggable for Thing {
32+
fn debug_name(&self) -> ~str { self.name.clone() }
33+
}
34+
35+
fn print_name(x: &Debuggable)
36+
{
37+
println(fmt!("debug_name = %s", x.debug_name()));
38+
}
39+
40+
fn main() {
41+
let thing = Thing::new();
42+
print_name(&thing as &Debuggable);
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
#7519 ICE pattern matching unit in function argument
13+
*/
14+
15+
fn foo(():()) { }
16+
17+
fn main() {
18+
foo(());
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
// xfail-pretty #9253 pretty printer doesn't preserve the bounds on trait objects
12+
13+
/*
14+
15+
#7673 Polymorphically creating traits barely works
16+
17+
*/
18+
19+
fn main() {}
20+
21+
trait A {}
22+
impl<T: 'static> A for T {}
23+
24+
fn owned1<T: 'static>(a: T) { ~a as ~A:; } /* note `:` */
25+
fn owned2<T: 'static>(a: ~T) { a as ~A:; }
26+
fn owned3<T: 'static>(a: ~T) { ~a as ~A:; }
27+
28+
fn managed1<T: 'static>(a: T) { @a as @A; }
29+
fn managed2<T: 'static>(a: @T) { a as @A; }
30+
fn managed3<T: 'static>(a: @T) { @a as @A; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
13+
#8171 Self is not recognised as implementing kinds in default method implementations
14+
15+
*/
16+
17+
fn require_send<T: Send>(_: T){}
18+
19+
trait TragicallySelfIsNotSend: Send {
20+
fn x(self) {
21+
require_send(self);
22+
}
23+
}
24+
25+
fn main(){}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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+
13+
#7770 ICE with sibling methods containing same-name-enum containing
14+
same-name-member
15+
16+
If you have two methods in an impl block, each containing an enum
17+
(with the same name), each containing at least one value with the same
18+
name, rustc gives the same LLVM symbol for the two of them and fails,
19+
as it does not include the method name in the symbol name.
20+
21+
*/
22+
23+
pub struct Foo;
24+
impl Foo {
25+
pub fn foo() {
26+
enum Panic { Common };
27+
}
28+
pub fn bar() {
29+
enum Panic { Common };
30+
}
31+
}
32+
33+
/*
34+
#2074 duplicate symbols with enum in boxed closure
35+
*/
36+
37+
fn foo() {
38+
let one: @fn() -> uint = || {
39+
enum r { a }
40+
a as uint
41+
};
42+
let two: @fn() -> uint = || {
43+
enum r { a }
44+
a as uint
45+
};
46+
one(); two();
47+
}
48+
49+
fn main() {}

0 commit comments

Comments
 (0)