Add test batch 1
This commit is contained in:
parent
e8a792daf5
commit
2e659f5894
46 changed files with 66 additions and 80 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6738
|
||||||
struct Foo<T> {
|
struct Foo<T> {
|
||||||
x: T,
|
x: T,
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0368]: binary assignment operation `+=` cannot be applied to type `T`
|
error[E0368]: binary assignment operation `+=` cannot be applied to type `T`
|
||||||
--> $DIR/issue-6738.rs:6:9
|
--> $DIR/struct-field-generic-type-binary-assignment-error-6738.rs:7:9
|
||||||
|
|
|
|
||||||
LL | self.x += v.x;
|
LL | self.x += v.x;
|
||||||
| ------^^^^^^^
|
| ------^^^^^^^
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5884
|
||||||
//@ build-pass
|
//@ build-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5550
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(unused_assignments)]
|
#![allow(unused_assignments)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5708
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
/*
|
/*
|
||||||
|
|
@ -10,7 +11,6 @@ This does not occur with concrete types, only with references
|
||||||
to traits.
|
to traits.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// original
|
// original
|
||||||
trait Inner {
|
trait Inner {
|
||||||
fn print(&self);
|
fn print(&self);
|
||||||
|
|
@ -38,7 +38,6 @@ pub fn main() {
|
||||||
outer.inner.print();
|
outer.inner.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// minimal
|
// minimal
|
||||||
pub trait MyTrait<T> {
|
pub trait MyTrait<T> {
|
||||||
fn dummy(&self, t: T) -> T { panic!() }
|
fn dummy(&self, t: T) -> T { panic!() }
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5518
|
||||||
|
//@ run-pass
|
||||||
|
//@ aux-build:aux-5518.rs
|
||||||
|
|
||||||
|
extern crate aux_5518 as other;
|
||||||
|
|
||||||
|
fn main() {}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6557
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6318
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
pub enum Thing {
|
pub enum Thing {
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6153
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
|
|
||||||
fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> {
|
fn swap<F>(f: F) -> Vec<isize> where F: FnOnce(Vec<isize>) -> Vec<isize> {
|
||||||
let x = vec![1, 2, 3];
|
let x = vec![1, 2, 3];
|
||||||
f(x)
|
f(x)
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/7012
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(non_camel_case_types)]
|
#![allow(non_camel_case_types)]
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5900
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5997
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6117
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5997
|
||||||
fn f<Z>() -> bool {
|
fn f<Z>() -> bool {
|
||||||
enum E { V(Z) }
|
enum E { V(Z) }
|
||||||
//~^ ERROR can't use generic parameters from outer item
|
//~^ ERROR can't use generic parameters from outer item
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0401]: can't use generic parameters from outer item
|
error[E0401]: can't use generic parameters from outer item
|
||||||
--> $DIR/issue-5997-enum.rs:2:16
|
--> $DIR/enum-definition-with-outer-generic-parameter-5997.rs:3:16
|
||||||
|
|
|
|
||||||
LL | fn f<Z>() -> bool {
|
LL | fn f<Z>() -> bool {
|
||||||
| - type parameter from outer item
|
| - type parameter from outer item
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
//@ run-pass
|
|
||||||
//@ aux-build:issue-5518.rs
|
|
||||||
|
|
||||||
|
|
||||||
extern crate issue_5518 as other;
|
|
||||||
|
|
||||||
fn main() {}
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
//@aux-build:issue-5844-aux.rs
|
|
||||||
|
|
||||||
extern crate issue_5844_aux;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
issue_5844_aux::rand(); //~ ERROR: requires unsafe
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
fn f<T>() -> bool {
|
|
||||||
struct S(T); //~ ERROR can't use generic parameters from outer item
|
|
||||||
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let b = f::<isize>();
|
|
||||||
assert!(b);
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
error[E0401]: can't use generic parameters from outer item
|
|
||||||
--> $DIR/issue-5997-struct.rs:2:14
|
|
||||||
|
|
|
||||||
LL | fn f<T>() -> bool {
|
|
||||||
| - type parameter from outer item
|
|
||||||
LL | struct S(T);
|
|
||||||
| -^ use of generic parameter from outer item
|
|
||||||
| |
|
|
||||||
| help: try introducing a local generic parameter here: `<T>`
|
|
||||||
|
|
||||||
error: aborting due to 1 previous error
|
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0401`.
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
//@ run-pass
|
|
||||||
#![allow(non_shorthand_field_patterns)]
|
|
||||||
|
|
||||||
struct A { x: usize }
|
|
||||||
|
|
||||||
impl Drop for A {
|
|
||||||
fn drop(&mut self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn main() {
|
|
||||||
let a = A { x: 0 };
|
|
||||||
|
|
||||||
match a {
|
|
||||||
A { x : ref x } => {
|
|
||||||
println!("{}", x)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5741
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(while_true)]
|
#![allow(while_true)]
|
||||||
#![allow(unreachable_code)]
|
#![allow(unreachable_code)]
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5554
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
||||||
pub struct X<T> {
|
pub struct X<T> {
|
||||||
a: T,
|
a: T,
|
||||||
}
|
}
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5718
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
struct Element;
|
struct Element;
|
||||||
|
|
@ -1,8 +1,13 @@
|
||||||
enum Either<T, U> { Left(T), Right(U) }
|
// https://github.com/rust-lang/rust/issues/5358
|
||||||
|
enum Either<T, U> {
|
||||||
|
Left(T),
|
||||||
|
Right(U),
|
||||||
|
}
|
||||||
struct S(Either<usize, usize>);
|
struct S(Either<usize, usize>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match S(Either::Left(5)) { //~ NOTE this expression has type `S`
|
match S(Either::Left(5)) {
|
||||||
|
//~^ NOTE this expression has type `S`
|
||||||
Either::Right(_) => {}
|
Either::Right(_) => {}
|
||||||
//~^ ERROR mismatched types
|
//~^ ERROR mismatched types
|
||||||
//~| NOTE expected `S`, found `Either<_, _>`
|
//~| NOTE expected `S`, found `Either<_, _>`
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/issue-5358-1.rs:6:9
|
--> $DIR/mismatched-types-in-match-5358.rs:11:9
|
||||||
|
|
|
|
||||||
LL | match S(Either::Left(5)) {
|
LL | match S(Either::Left(5)) {
|
||||||
| ------------------ this expression has type `S`
|
| ------------------ this expression has type `S`
|
||||||
|
LL |
|
||||||
LL | Either::Right(_) => {}
|
LL | Either::Right(_) => {}
|
||||||
| ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>`
|
| ^^^^^^^^^^^^^^^^ expected `S`, found `Either<_, _>`
|
||||||
|
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5950
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
|
|
||||||
|
|
||||||
pub use local as local_alias;
|
pub use local as local_alias;
|
||||||
|
|
||||||
pub mod local { }
|
pub mod local { }
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6130
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5572
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6919
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(unused_attributes)]
|
#![allow(unused_attributes)]
|
||||||
//@ aux-build:iss.rs
|
//@ aux-build:iss-6919.rs
|
||||||
|
|
||||||
|
|
||||||
extern crate issue6919_3;
|
extern crate issue6919_3;
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6936
|
||||||
struct T;
|
struct T;
|
||||||
|
|
||||||
mod t1 {
|
mod t1 {
|
||||||
|
|
@ -30,5 +31,4 @@ mod t6 {
|
||||||
impl Foo {} // ok
|
impl Foo {} // ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0428]: the name `Foo` is defined multiple times
|
error[E0428]: the name `Foo` is defined multiple times
|
||||||
--> $DIR/issue-6936.rs:5:5
|
--> $DIR/duplicate-name-in-module-6936.rs:6:5
|
||||||
|
|
|
|
||||||
LL | type Foo = crate::T;
|
LL | type Foo = crate::T;
|
||||||
| -------------------- previous definition of the type `Foo` here
|
| -------------------- previous definition of the type `Foo` here
|
||||||
|
|
@ -9,7 +9,7 @@ LL | mod Foo {}
|
||||||
= note: `Foo` must be defined only once in the type namespace of this module
|
= note: `Foo` must be defined only once in the type namespace of this module
|
||||||
|
|
||||||
error[E0428]: the name `Foo` is defined multiple times
|
error[E0428]: the name `Foo` is defined multiple times
|
||||||
--> $DIR/issue-6936.rs:10:5
|
--> $DIR/duplicate-name-in-module-6936.rs:11:5
|
||||||
|
|
|
|
||||||
LL | type Foo = crate::T;
|
LL | type Foo = crate::T;
|
||||||
| -------------------- previous definition of the type `Foo` here
|
| -------------------- previous definition of the type `Foo` here
|
||||||
|
|
@ -19,7 +19,7 @@ LL | struct Foo;
|
||||||
= note: `Foo` must be defined only once in the type namespace of this module
|
= note: `Foo` must be defined only once in the type namespace of this module
|
||||||
|
|
||||||
error[E0428]: the name `Foo` is defined multiple times
|
error[E0428]: the name `Foo` is defined multiple times
|
||||||
--> $DIR/issue-6936.rs:15:5
|
--> $DIR/duplicate-name-in-module-6936.rs:16:5
|
||||||
|
|
|
|
||||||
LL | type Foo = crate::T;
|
LL | type Foo = crate::T;
|
||||||
| -------------------- previous definition of the type `Foo` here
|
| -------------------- previous definition of the type `Foo` here
|
||||||
|
|
@ -29,7 +29,7 @@ LL | enum Foo {}
|
||||||
= note: `Foo` must be defined only once in the type namespace of this module
|
= note: `Foo` must be defined only once in the type namespace of this module
|
||||||
|
|
||||||
error[E0428]: the name `Bar` is defined multiple times
|
error[E0428]: the name `Bar` is defined multiple times
|
||||||
--> $DIR/issue-6936.rs:25:5
|
--> $DIR/duplicate-name-in-module-6936.rs:26:5
|
||||||
|
|
|
|
||||||
LL | type Bar<T> = T;
|
LL | type Bar<T> = T;
|
||||||
| ---------------- previous definition of the type `Bar` here
|
| ---------------- previous definition of the type `Bar` here
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5917
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(non_upper_case_globals)]
|
#![allow(non_upper_case_globals)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5688
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
/*
|
/*
|
||||||
# Corrupted initialization in the static struct
|
# Corrupted initialization in the static struct
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6344
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
#![allow(non_shorthand_field_patterns)]
|
#![allow(non_shorthand_field_patterns)]
|
||||||
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5439
|
||||||
struct Foo {
|
struct Foo {
|
||||||
foo: isize,
|
foo: isize,
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0560]: struct `Foo` has no field named `nonexistent`
|
error[E0560]: struct `Foo` has no field named `nonexistent`
|
||||||
--> $DIR/issue-5439.rs:11:31
|
--> $DIR/nonexistent-struct-field-error-5439.rs:12:31
|
||||||
|
|
|
|
||||||
LL | return Box::new(Foo { nonexistent: self, foo: i });
|
LL | return Box::new(Foo { nonexistent: self, foo: i });
|
||||||
| ^^^^^^^^^^^ `Foo` does not have this field
|
| ^^^^^^^^^^^ `Foo` does not have this field
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5666
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
struct Dog {
|
struct Dog {
|
||||||
|
|
@ -14,7 +15,6 @@ impl Barks for Dog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let snoopy = Box::new(Dog{name: "snoopy".to_string()});
|
let snoopy = Box::new(Dog{name: "snoopy".to_string()});
|
||||||
let bubbles = Box::new(Dog{name: "bubbles".to_string()});
|
let bubbles = Box::new(Dog{name: "bubbles".to_string()});
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5883
|
||||||
trait A {}
|
trait A {}
|
||||||
|
|
||||||
struct Struct {
|
struct Struct {
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
||||||
--> $DIR/issue-5883.rs:9:6
|
--> $DIR/opaque-trait-size-error-5883.rs:10:6
|
||||||
|
|
|
|
||||||
LL | ) -> Struct {
|
LL | ) -> Struct {
|
||||||
| ^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
|
|
||||||
= help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)`
|
= help: within `Struct`, the trait `Sized` is not implemented for `(dyn A + 'static)`
|
||||||
note: required because it appears within the type `Struct`
|
note: required because it appears within the type `Struct`
|
||||||
--> $DIR/issue-5883.rs:3:8
|
--> $DIR/opaque-trait-size-error-5883.rs:4:8
|
||||||
|
|
|
|
||||||
LL | struct Struct {
|
LL | struct Struct {
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
= note: the return type of a function must have a statically known size
|
= note: the return type of a function must have a statically known size
|
||||||
|
|
||||||
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
|
||||||
--> $DIR/issue-5883.rs:8:8
|
--> $DIR/opaque-trait-size-error-5883.rs:9:8
|
||||||
|
|
|
|
||||||
LL | r: dyn A + 'static
|
LL | r: dyn A + 'static
|
||||||
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
| ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/6898
|
||||||
//@ check-pass
|
//@ check-pass
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5988
|
||||||
//@ run-pass
|
//@ run-pass
|
||||||
|
|
||||||
trait B {
|
trait B {
|
||||||
8
tests/ui/unsafe/extern-function-requires-unsafe-5844.rs
Normal file
8
tests/ui/unsafe/extern-function-requires-unsafe-5844.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
// https://github.com/rust-lang/rust/issues/5844
|
||||||
|
//@aux-build:aux-5844.rs
|
||||||
|
|
||||||
|
extern crate aux_5844;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
aux_5844::rand(); //~ ERROR: requires unsafe
|
||||||
|
}
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block
|
error[E0133]: call to unsafe function `rand` is unsafe and requires unsafe function or block
|
||||||
--> $DIR/issue-5844.rs:6:5
|
--> $DIR/extern-function-requires-unsafe-5844.rs:7:5
|
||||||
|
|
|
|
||||||
LL | issue_5844_aux::rand();
|
LL | aux_5844::rand();
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
|
| ^^^^^^^^^^^^^^^^ call to unsafe function
|
||||||
|
|
|
|
||||||
= note: consult the function's documentation for information on how to avoid undefined behavior
|
= note: consult the function's documentation for information on how to avoid undefined behavior
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue