Add a test to make sure it works and switch a private struct over to a
newtype.

Closes #9155
This commit is contained in:
Steven Fackler 2013-10-03 00:15:54 -07:00
parent b637798a5a
commit 435ca16f4f
3 changed files with 46 additions and 13 deletions

View file

@ -0,0 +1,17 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub struct Foo<T>(T);
impl<T> Foo<T> {
pub fn new(t: T) -> Foo<T> {
Foo(t)
}
}

View file

@ -0,0 +1,20 @@
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// aux-build:issue_9155.rs
// xfail-fast windows doesn't like the aux-build
extern mod issue_9155;
struct Baz;
fn main() {
issue_9155::Foo::new(Baz);
}