Skip to content

Commit 3725067

Browse files
committed
Regression test for #3902
Closes #3902.
1 parent 3e6b29f commit 3725067

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
mod base {
12+
pub trait HasNew<T> {
13+
fn new() -> T;
14+
}
15+
16+
pub struct Foo {
17+
dummy: (),
18+
}
19+
20+
impl HasNew<Foo> for Foo {
21+
fn new() -> Foo {
22+
Foo { dummy: () }
23+
}
24+
}
25+
26+
pub struct Bar {
27+
dummy: (),
28+
}
29+
30+
impl HasNew<Bar> for Bar {
31+
fn new() -> Bar {
32+
Bar { dummy: () }
33+
}
34+
}
35+
}
36+
37+
pub fn main() {
38+
let _f: base::Foo = base::HasNew::new();
39+
let _b: base::Bar = base::HasNew::new();
40+
}

0 commit comments

Comments
 (0)