mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
auto merge of #12738 : alexcrichton/rust/needstest, r=brson,just
Closes #6738 Closes #7061 Closes #7899 Closes #9719 Closes #10028 Closes #10228 Closes #10401 Closes #11192 Closes #11508 Closes #11529 Closes #11873 Closes #11925
This commit is contained in:
commit
0e95b086db
20
src/test/auxiliary/issue-10028.rs
Normal file
20
src/test/auxiliary/issue-10028.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#[unsafe_no_drop_flag]
|
||||
pub struct ZeroLengthThingWithDestructor;
|
||||
impl Drop for ZeroLengthThingWithDestructor {
|
||||
fn drop(&mut self) {}
|
||||
}
|
||||
impl ZeroLengthThingWithDestructor {
|
||||
pub fn new() -> ZeroLengthThingWithDestructor {
|
||||
ZeroLengthThingWithDestructor
|
||||
}
|
||||
}
|
20
src/test/auxiliary/issue-11508.rs
Normal file
20
src/test/auxiliary/issue-11508.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 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 Closed01<F>(F);
|
||||
|
||||
pub trait Bar { fn new() -> Self; }
|
||||
|
||||
impl<T: Bar> Bar for Closed01<T> {
|
||||
fn new() -> Closed01<T> { Closed01(Bar::new()) }
|
||||
}
|
||||
impl Bar for f32 { fn new() -> f32 { 1.0 } }
|
||||
|
||||
pub fn random<T: Bar>() -> T { Bar::new() }
|
11
src/test/auxiliary/issue-11529.rs
Normal file
11
src/test/auxiliary/issue-11529.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 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 A<'a>(&'a int);
|
11
src/test/auxiliary/issue-7899.rs
Normal file
11
src/test/auxiliary/issue-7899.rs
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 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 V2<T>(T, T);
|
15
src/test/compile-fail/issue-10401.rs
Normal file
15
src/test/compile-fail/issue-10401.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
fn main() {
|
||||
let mut a = "a";
|
||||
a += { "b" };
|
||||
//~^ ERROR: binary assignment operation `+=` cannot be applied
|
||||
}
|
31
src/test/compile-fail/issue-11192.rs
Normal file
31
src/test/compile-fail/issue-11192.rs
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
struct Foo {
|
||||
x: int
|
||||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
println!("drop {}", self.x);
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut ptr = ~Foo { x: 0 };
|
||||
let test = |foo: &Foo| {
|
||||
println!("access {}", foo.x);
|
||||
ptr = ~Foo { x: ptr.x + 1 };
|
||||
println!("access {}", foo.x);
|
||||
};
|
||||
test(ptr);
|
||||
//~^ ERROR: cannot borrow `*ptr` as immutable
|
||||
}
|
||||
|
19
src/test/compile-fail/issue-11873.rs
Normal file
19
src/test/compile-fail/issue-11873.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2012-2014 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.
|
||||
|
||||
use std::vec_ng::Vec;
|
||||
|
||||
fn main() {
|
||||
let mut v = vec!(1);
|
||||
let f = || v.push(2);
|
||||
let _w = v; //~ ERROR: cannot move out of `v`
|
||||
|
||||
f();
|
||||
}
|
19
src/test/compile-fail/issue-11925.rs
Normal file
19
src/test/compile-fail/issue-11925.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
fn main() {
|
||||
let r = {
|
||||
let x = ~42;
|
||||
let f = proc() &x; //~ ERROR: borrowed value does not live long enough
|
||||
f()
|
||||
};
|
||||
|
||||
drop(r);
|
||||
}
|
20
src/test/compile-fail/issue-6738.rs
Normal file
20
src/test/compile-fail/issue-6738.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
struct Foo<T> {
|
||||
x: T,
|
||||
}
|
||||
impl<T> Foo<T> {
|
||||
fn add(&mut self, v: Foo<T>){
|
||||
self.x += v.x;
|
||||
//~^ ERROR: binary assignment operation `+=` cannot be applied
|
||||
}
|
||||
}
|
||||
fn main() {}
|
20
src/test/compile-fail/issue-7061.rs
Normal file
20
src/test/compile-fail/issue-7061.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
#[feature(managed_boxes)];
|
||||
|
||||
struct BarStruct;
|
||||
|
||||
impl<'a> BarStruct {
|
||||
fn foo(&'a mut self) -> @BarStruct { self }
|
||||
//~^ ERROR: error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct
|
||||
}
|
||||
|
||||
fn main() {}
|
28
src/test/run-pass/issue-10028.rs
Normal file
28
src/test/run-pass/issue-10028.rs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright 2014 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-10028.rs
|
||||
// ignore-fast
|
||||
|
||||
extern crate issue10028 = "issue-10028";
|
||||
|
||||
use issue10028::ZeroLengthThingWithDestructor;
|
||||
|
||||
struct Foo {
|
||||
zero_length_thing: ZeroLengthThingWithDestructor
|
||||
}
|
||||
|
||||
fn make_foo() -> Foo {
|
||||
Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _f:Foo = make_foo();
|
||||
}
|
25
src/test/run-pass/issue-10228.rs
Normal file
25
src/test/run-pass/issue-10228.rs
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
enum StdioContainer {
|
||||
CreatePipe(bool)
|
||||
}
|
||||
|
||||
struct Test<'a> {
|
||||
args: &'a [~str],
|
||||
io: &'a [StdioContainer]
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let test = Test {
|
||||
args: &[],
|
||||
io: &[CreatePipe(true)]
|
||||
};
|
||||
}
|
21
src/test/run-pass/issue-11508.rs
Normal file
21
src/test/run-pass/issue-11508.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2014 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-11508.rs
|
||||
// ignore-fast
|
||||
|
||||
extern crate rand = "issue-11508";
|
||||
|
||||
use rand::{Closed01, random};
|
||||
|
||||
fn main() {
|
||||
let Closed01(val) = random::<Closed01<f32>>();
|
||||
println!("{}", val);
|
||||
}
|
19
src/test/run-pass/issue-11529.rs
Normal file
19
src/test/run-pass/issue-11529.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2014 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-11529.rs
|
||||
// ignore-fast
|
||||
|
||||
extern crate a = "issue-11529";
|
||||
|
||||
fn main() {
|
||||
let one = 1;
|
||||
let _a = a::A(&one);
|
||||
}
|
18
src/test/run-pass/issue-7899.rs
Normal file
18
src/test/run-pass/issue-7899.rs
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
// ignore-fast
|
||||
// aux-build:issue-7899.rs
|
||||
|
||||
extern crate testcrate = "issue-7899";
|
||||
|
||||
fn main() {
|
||||
let f = testcrate::V2(1.0f32, 2.0f32);
|
||||
}
|
43
src/test/run-pass/issue-9719.rs
Normal file
43
src/test/run-pass/issue-9719.rs
Normal file
@ -0,0 +1,43 @@
|
||||
// Copyright 2014 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.
|
||||
|
||||
mod a {
|
||||
pub enum Enum<T> {
|
||||
A(T),
|
||||
}
|
||||
|
||||
pub trait X {}
|
||||
impl X for int {}
|
||||
|
||||
pub struct Z<'a>(Enum<&'a X>);
|
||||
fn foo() { let x = 42; let z = Z(A(&x as &X)); let _ = z; }
|
||||
}
|
||||
|
||||
mod b {
|
||||
trait X {}
|
||||
impl X for int {}
|
||||
struct Y<'a>{
|
||||
x:Option<&'a X>,
|
||||
}
|
||||
|
||||
fn bar() {
|
||||
let x = 42;
|
||||
let _y = Y { x: Some(&x as &X) };
|
||||
}
|
||||
}
|
||||
|
||||
mod c {
|
||||
pub trait X { fn f(&self); }
|
||||
impl X for int { fn f(&self) {} }
|
||||
pub struct Z<'a>(Option<&'a X>);
|
||||
fn main() { let x = 42; let z = Z(Some(&x as &X)); let _ = z; }
|
||||
}
|
||||
|
||||
pub fn main() {}
|
Loading…
Reference in New Issue
Block a user