Rollup merge of #23402 - tamird:needstest-tests, r=jakub-
@alexcrichton @jakub-
This commit is contained in:
commit
a4b57bebd0
17 changed files with 274 additions and 6 deletions
11
src/test/auxiliary/pub_static_array.rs
Normal file
11
src/test/auxiliary/pub_static_array.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 static ARRAY: &'static [u8] = &[1];
|
||||
|
|
@ -22,5 +22,5 @@ impl Foo for isize {
|
|||
|
||||
pub fn main() {
|
||||
let x: isize = Foo::<A=usize>::bar();
|
||||
//~^ERROR unexpected binding of associated item in expression path
|
||||
//~^ ERROR unexpected binding of associated item in expression path
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,11 +24,11 @@ pub fn main() {
|
|||
s.as_bytes()[3_usize];
|
||||
s.as_bytes()[3];
|
||||
s.as_bytes()[3u8]; //~ERROR the trait `core::ops::Index<u8>` is not implemented
|
||||
//~^ERROR the trait `core::ops::Index<u8>` is not implemented
|
||||
//~^ ERROR the trait `core::ops::Index<u8>` is not implemented
|
||||
s.as_bytes()[3i8]; //~ERROR the trait `core::ops::Index<i8>` is not implemented
|
||||
//~^ERROR the trait `core::ops::Index<i8>` is not implemented
|
||||
//~^ ERROR the trait `core::ops::Index<i8>` is not implemented
|
||||
s.as_bytes()[3u32]; //~ERROR the trait `core::ops::Index<u32>` is not implemented
|
||||
//~^ERROR the trait `core::ops::Index<u32>` is not implemented
|
||||
//~^ ERROR the trait `core::ops::Index<u32>` is not implemented
|
||||
s.as_bytes()[3i32]; //~ERROR the trait `core::ops::Index<i32>` is not implemented
|
||||
//~^ERROR the trait `core::ops::Index<i32>` is not implemented
|
||||
//~^ ERROR the trait `core::ops::Index<i32>` is not implemented
|
||||
}
|
||||
|
|
|
|||
19
src/test/compile-fail/issue-13407.rs
Normal file
19
src/test/compile-fail/issue-13407.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2015 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 {
|
||||
struct C;
|
||||
}
|
||||
|
||||
fn main() {
|
||||
A::C = 1;
|
||||
//~^ ERROR: illegal left-hand side expression
|
||||
//~| ERROR: mismatched types
|
||||
}
|
||||
20
src/test/compile-fail/issue-16922.rs
Normal file
20
src/test/compile-fail/issue-16922.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2015 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::any::Any;
|
||||
|
||||
fn foo<T: Any>(value: &T) -> Box<Any> {
|
||||
Box::new(value) as Box<Any>
|
||||
//~^ ERROR: cannot infer an appropriate lifetime
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = foo(&5);
|
||||
}
|
||||
17
src/test/compile-fail/issue-18919.rs
Normal file
17
src/test/compile-fail/issue-18919.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
type FuncType<'f> = Fn(&isize) -> isize + 'f;
|
||||
|
||||
fn ho_func(f: Option<FuncType>) {
|
||||
//~^ ERROR: the trait `core::marker::Sized` is not implemented for the type
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
17
src/test/compile-fail/issue-19982.rs
Normal file
17
src/test/compile-fail/issue-19982.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2015 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(unboxed_closures)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl Fn<(&(),)> for Foo { } //~ ERROR missing lifetime specifier
|
||||
|
||||
fn main() {}
|
||||
22
src/test/compile-fail/issue-20225.rs
Normal file
22
src/test/compile-fail/issue-20225.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2015 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(unboxed_closures)]
|
||||
|
||||
struct Foo;
|
||||
|
||||
impl<'a, T> Fn<(&'a T,)> for Foo {
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call(&self, (_,): (T,)) {}
|
||||
//~^ ERROR: has an incompatible type for trait: expected &-ptr
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
17
src/test/compile-fail/issue-20261.rs
Normal file
17
src/test/compile-fail/issue-20261.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2015 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() {
|
||||
for (ref i,) in [].iter() { //~ ERROR: type mismatch resolving
|
||||
i.clone();
|
||||
//~^ ERROR: the type of this value must be known in this context
|
||||
//~| ERROR: reached the recursion limit while auto-dereferencing
|
||||
}
|
||||
}
|
||||
15
src/test/compile-fail/issue-20714.rs
Normal file
15
src/test/compile-fail/issue-20714.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2015 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 G;
|
||||
|
||||
fn main() {
|
||||
let g = G(); //~ ERROR: expected function, found `G`
|
||||
}
|
||||
20
src/test/compile-fail/static-array-across-crate.rs
Normal file
20
src/test/compile-fail/static-array-across-crate.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2015 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:pub_static_array.rs
|
||||
|
||||
extern crate "pub_static_array" as array;
|
||||
|
||||
use array::ARRAY;
|
||||
|
||||
static X: &'static u8 = &ARRAY[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static, use a constant
|
||||
|
||||
pub fn main() {}
|
||||
|
|
@ -15,7 +15,7 @@ trait Foo {
|
|||
// This should emit the less confusing error, not the more confusing one.
|
||||
|
||||
fn foo(_x: Foo + Send) {
|
||||
//~^ERROR the trait `core::marker::Sized` is not implemented
|
||||
//~^ ERROR the trait `core::marker::Sized` is not implemented
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
|||
19
src/test/run-pass/issue-11820.rs
Normal file
19
src/test/run-pass/issue-11820.rs
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright 2015 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 NoClone;
|
||||
|
||||
fn main() {
|
||||
let rnc = &NoClone;
|
||||
let rsnc = &Some(NoClone);
|
||||
|
||||
let _: &NoClone = rnc.clone();
|
||||
let _: &Option<NoClone> = rsnc.clone();
|
||||
}
|
||||
18
src/test/run-pass/issue-16922.rs
Normal file
18
src/test/run-pass/issue-16922.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2015 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::any::Any;
|
||||
|
||||
fn foo(_: &u8) {
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let _ = &foo as &Any;
|
||||
}
|
||||
22
src/test/run-pass/issue-19982.rs
Normal file
22
src/test/run-pass/issue-19982.rs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2015 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(core,unboxed_closures)]
|
||||
|
||||
#[allow(dead_code)]
|
||||
struct Foo;
|
||||
|
||||
impl<'a> Fn<(&'a (),)> for Foo {
|
||||
type Output = ();
|
||||
|
||||
extern "rust-call" fn call(&self, (_,): (&(),)) {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
23
src/test/run-pass/issue-20396.rs
Normal file
23
src/test/run-pass/issue-20396.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
trait Foo<T> {
|
||||
fn noop(&self, _: T);
|
||||
}
|
||||
|
||||
enum Bar<T> { Bla(T) }
|
||||
|
||||
struct Baz<'a> {
|
||||
inner: for<'b> Foo<Bar<&'b ()>> + 'a,
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
28
src/test/run-pass/issue-9951.rs
Normal file
28
src/test/run-pass/issue-9951.rs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2015 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.
|
||||
|
||||
#![allow(unused_variables)]
|
||||
|
||||
trait Bar {
|
||||
fn noop(&self);
|
||||
}
|
||||
impl Bar for u8 {
|
||||
fn noop(&self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let (a, b) = (&5u8 as &Bar, &9u8 as &Bar);
|
||||
let (c, d): (&Bar, &Bar) = (a, b);
|
||||
|
||||
let (a, b) = (Box::new(5u8) as Box<Bar>, Box::new(9u8) as Box<Bar>);
|
||||
let (c, d): (&Bar, &Bar) = (&*a, &*b);
|
||||
|
||||
let (c, d): (&Bar, &Bar) = (&5, &9);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue