Move some tests to more suitable subdirs

This commit is contained in:
Yuki Okushi 2021-03-05 18:34:12 +09:00
parent 45b3c28518
commit eb9abea295
35 changed files with 1 additions and 46 deletions

View file

@ -1,10 +0,0 @@
use std::sync::atomic;
pub const C1: usize = 1;
pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
pub const C3: fn() = { fn foo() {} foo };
pub const C4: usize = C1 * C1 + C1 / C1;
pub const C5: &'static usize = &C4;
pub static S1: usize = 3;
pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0);

View file

@ -1,11 +0,0 @@
// build-pass
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
// pretty-expanded FIXME #23616
static mut n_mut: usize = 0;
static n: &'static usize = unsafe{ &n_mut };
fn main() {}

View file

@ -1,75 +0,0 @@
// run-pass
#![allow(dead_code)]
// aux-build:issue-17718-aux.rs
extern crate issue_17718_aux as other;
use std::sync::atomic::{AtomicUsize, Ordering};
const C1: usize = 1;
const C2: AtomicUsize = AtomicUsize::new(0);
const C3: fn() = foo;
const C4: usize = C1 * C1 + C1 / C1;
const C5: &'static usize = &C4;
const C6: usize = {
const C: usize = 3;
C
};
static S1: usize = 3;
static S2: AtomicUsize = AtomicUsize::new(0);
mod test {
static A: usize = 4;
static B: &'static usize = &A;
static C: &'static usize = &(A);
}
fn foo() {}
fn main() {
assert_eq!(C1, 1);
assert_eq!(C3(), ());
assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(C4, 2);
assert_eq!(*C5, 2);
assert_eq!(C6, 3);
assert_eq!(S1, 3);
assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 1);
match 1 {
C1 => {}
_ => unreachable!(),
}
let _a = C1;
let _a = C2;
let _a = C3;
let _a = C4;
let _a = C5;
let _a = C6;
let _a = S1;
assert_eq!(other::C1, 1);
assert_eq!(other::C3(), ());
assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(other::C4, 2);
assert_eq!(*other::C5, 2);
assert_eq!(other::S1, 3);
assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 0);
assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 1);
let _a = other::C1;
let _a = other::C2;
let _a = other::C3;
let _a = other::C4;
let _a = other::C5;
match 1 {
other::C1 => {}
_ => unreachable!(),
}
}

View file

@ -1,19 +0,0 @@
// run-pass
// Test that param substitutions from the correct environment are
// used when codegenning unboxed closure calls.
// pretty-expanded FIXME #23616
pub fn inside<F: Fn()>(c: F) {
c();
}
// Use different number of type parameters and closure type to trigger
// an obvious ICE when param environments are mixed up
pub fn outside<A,B>() {
inside(|| {});
}
fn main() {
outside::<(),()>();
}

View file

@ -1,13 +0,0 @@
enum Chan { }
trait Channel<T> {
fn send(&self, v: T);
}
// `Chan` is not a trait, it's an enum
impl Chan for isize { //~ ERROR expected trait, found enum `Chan`
fn send(&self, v: isize) { panic!() }
}
fn main() {
}

View file

@ -1,9 +0,0 @@
error[E0404]: expected trait, found enum `Chan`
--> $DIR/issue-2330.rs:8:6
|
LL | impl Chan for isize {
| ^^^^ not a trait
error: aborting due to previous error
For more information about this error, try `rustc --explain E0404`.

View file

@ -1,14 +0,0 @@
// run-pass
// pretty-expanded FIXME #23616
#![feature(box_syntax)]
fn a_val(x: Box<isize>, y: Box<isize>) -> isize {
*x + *y
}
pub fn main() {
let z: Box<_> = box 22;
a_val(z.clone(), z.clone());
}

View file

@ -1,31 +0,0 @@
// run-pass
#![allow(dead_code)]
#![allow(non_camel_case_types)]
#[derive(Copy, Clone)]
struct cat {
meow: extern "Rust" fn(),
}
fn meow() {
println!("meow")
}
fn cat() -> cat {
cat {
meow: meow,
}
}
#[derive(Copy, Clone)]
struct KittyInfo {kitty: cat}
// Code compiles and runs successfully if we add a + before the first arg
fn nyan(kitty: cat, _kitty_info: KittyInfo) {
(kitty.meow)();
}
pub fn main() {
let kitty = cat();
nyan(kitty, KittyInfo {kitty: kitty});
}

View file

@ -1,12 +0,0 @@
pub trait Foo<RHS=Self> {
type Assoc;
}
pub trait Bar: Foo<Assoc=()> {
fn new(&self, b: &
dyn Bar //~ ERROR the trait `Bar` cannot be made into an object
<Assoc=()>
);
}
fn main() {}

View file

@ -1,20 +0,0 @@
error[E0038]: the trait `Bar` cannot be made into an object
--> $DIR/issue-28576.rs:7:12
|
LL | / dyn Bar
LL | | <Assoc=()>
| |________________________^ `Bar` cannot be made into an object
|
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
--> $DIR/issue-28576.rs:5:16
|
LL | pub trait Bar: Foo<Assoc=()> {
| --- ^^^^^^^^^^^^^
| | | |
| | | ...because it uses `Self` as a type parameter
| | ...because it uses `Self` as a type parameter
| this trait cannot be made into an object...
error: aborting due to previous error
For more information about this error, try `rustc --explain E0038`.

View file

@ -1,107 +0,0 @@
// check-pass
#![warn(order_dependent_trait_objects)]
// Check that traitobject 0.1.0 compiles
//! # traitobject
//!
//! Unsafe helpers for working with raw TraitObjects.
/// A trait implemented for all trait objects.
///
/// Implementations for all traits in std are provided.
pub unsafe trait Trait {}
unsafe impl Trait for dyn (::std::any::Any) + Send { }
unsafe impl Trait for dyn (::std::any::Any) + Sync { }
unsafe impl Trait for dyn (::std::any::Any) + Send + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::Borrow<T>) + Send { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::Borrow<T>) + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::Borrow<T>) + Send + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::BorrowMut<T>) + Send { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::BorrowMut<T>) + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::borrow::BorrowMut<T>) + Send + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsMut<T>) + Send { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsMut<T>) + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsMut<T>) + Send + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsRef<T>) + Send { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsRef<T>) + Sync { }
unsafe impl<T: ?Sized> Trait for dyn (::std::convert::AsRef<T>) + Send + Sync { }
unsafe impl Trait for dyn (::std::error::Error) + Send { }
unsafe impl Trait for dyn (::std::error::Error) + Sync { }
unsafe impl Trait for dyn (::std::error::Error) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Binary) + Send { }
unsafe impl Trait for dyn (::std::fmt::Binary) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Binary) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Debug) + Send { }
unsafe impl Trait for dyn (::std::fmt::Debug) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Debug) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Display) + Send { }
unsafe impl Trait for dyn (::std::fmt::Display) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Display) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send { }
unsafe impl Trait for dyn (::std::fmt::LowerExp) + Sync { }
unsafe impl Trait for dyn (::std::fmt::LowerExp) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send { }
unsafe impl Trait for dyn (::std::fmt::LowerHex) + Sync { }
unsafe impl Trait for dyn (::std::fmt::LowerHex) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Octal) + Send { }
unsafe impl Trait for dyn (::std::fmt::Octal) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Octal) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Pointer) + Send { }
unsafe impl Trait for dyn (::std::fmt::Pointer) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Pointer) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send { }
unsafe impl Trait for dyn (::std::fmt::UpperExp) + Sync { }
unsafe impl Trait for dyn (::std::fmt::UpperExp) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send { }
unsafe impl Trait for dyn (::std::fmt::UpperHex) + Sync { }
unsafe impl Trait for dyn (::std::fmt::UpperHex) + Send + Sync { }
unsafe impl Trait for dyn (::std::fmt::Write) + Send { }
unsafe impl Trait for dyn (::std::fmt::Write) + Sync { }
unsafe impl Trait for dyn (::std::fmt::Write) + Send + Sync { }
unsafe impl Trait for dyn (::std::hash::Hasher) + Send { }
unsafe impl Trait for dyn (::std::hash::Hasher) + Sync { }
unsafe impl Trait for dyn (::std::hash::Hasher) + Send + Sync { }
unsafe impl Trait for dyn (::std::io::BufRead) + Send { }
unsafe impl Trait for dyn (::std::io::BufRead) + Sync { }
unsafe impl Trait for dyn (::std::io::BufRead) + Send + Sync { }
unsafe impl Trait for dyn (::std::io::Read) + Send { }
unsafe impl Trait for dyn (::std::io::Read) + Sync { }
unsafe impl Trait for dyn (::std::io::Read) + Send + Sync { }
unsafe impl Trait for dyn (::std::io::Seek) + Send { }
unsafe impl Trait for dyn (::std::io::Seek) + Sync { }
unsafe impl Trait for dyn (::std::io::Seek) + Send + Sync { }
unsafe impl Trait for dyn (::std::io::Write) + Send { }
unsafe impl Trait for dyn (::std::io::Write) + Sync { }
unsafe impl Trait for dyn (::std::io::Write) + Send + Sync { }
unsafe impl<T, I> Trait for dyn (::std::iter::IntoIterator<IntoIter=I, Item=T>) { }
unsafe impl<T> Trait for dyn (::std::iter::Iterator<Item=T>) + Send { }
unsafe impl<T> Trait for dyn (::std::iter::Iterator<Item=T>) + Sync { }
unsafe impl<T> Trait for dyn (::std::iter::Iterator<Item=T>) + Send + Sync { }
unsafe impl Trait for dyn (::std::marker::Send) + Send { }
unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
//~^ WARNING conflicting implementations of trait `Trait` for type
//~| WARNING this was previously accepted by the compiler but is being phased out
unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
//~^ WARNING conflicting implementations of trait `Trait` for type
//~| WARNING this was previously accepted by the compiler but is being phased out
unsafe impl Trait for dyn (::std::marker::Sync) + Sync { }
unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
//~^ WARNING conflicting implementations of trait `Trait` for type
//~| WARNING this was previously accepted by the compiler but is being phased out
unsafe impl Trait for dyn (::std::ops::Drop) + Send { }
unsafe impl Trait for dyn (::std::ops::Drop) + Sync { }
unsafe impl Trait for dyn (::std::ops::Drop) + Send + Sync { }
unsafe impl Trait for dyn (::std::string::ToString) + Send { }
unsafe impl Trait for dyn (::std::string::ToString) + Sync { }
unsafe impl Trait for dyn (::std::string::ToString) + Send + Sync { }
fn assert_trait<T: Trait + ?Sized>() {}
fn main() {
assert_trait::<dyn Send>();
assert_trait::<dyn Sync>();
assert_trait::<dyn Send + Sync>();
}

View file

@ -1,42 +0,0 @@
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
--> $DIR/issue-33140-traitobject-crate.rs:85:1
|
LL | unsafe impl Trait for dyn (::std::marker::Send) + Sync { }
| ------------------------------------------------------ first implementation here
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
note: the lint level is defined here
--> $DIR/issue-33140-traitobject-crate.rs:3:9
|
LL | #![warn(order_dependent_trait_objects)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
--> $DIR/issue-33140-traitobject-crate.rs:88:1
|
LL | unsafe impl Trait for dyn (::std::marker::Send) + Send + Sync { }
| ------------------------------------------------------------- first implementation here
...
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
warning: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`: (E0119)
--> $DIR/issue-33140-traitobject-crate.rs:92:1
|
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send { }
| ------------------------------------------------------ first implementation here
...
LL | unsafe impl Trait for dyn (::std::marker::Sync) + Send + Sync { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #56484 <https://github.com/rust-lang/rust/issues/56484>
warning: 3 warnings emitted

View file

@ -1,47 +0,0 @@
trait Trait {
fn xyz() -> bool;
}
impl Trait for dyn Send + Sync {
fn xyz() -> bool { false }
}
impl Trait for dyn Sync + Send {
//~^ ERROR conflicting implementations
fn xyz() -> bool { true }
}
trait Trait2 {
fn uvw() -> bool;
}
impl Trait2 for dyn Send + Sync {
fn uvw() -> bool { false }
}
impl Trait2 for dyn Sync + Send + Sync {
//~^ ERROR conflicting implementations
fn uvw() -> bool { true }
}
struct Foo<T: ?Sized>(T);
impl Foo<dyn Send + Sync> {
fn abc() -> bool { //~ ERROR duplicate definitions with name `abc`
false
}
}
impl Foo<dyn Sync + Send> {
fn abc() -> bool {
true
}
}
fn main() {
assert_eq!(<dyn Send + Sync>::xyz(), false);
assert_eq!(<dyn Sync + Send>::xyz(), true);
assert_eq!(<dyn Send + Sync>::uvw(), false);
assert_eq!(<dyn Sync + Send+ Sync>::uvw(), true);
assert_eq!(<Foo<dyn Send + Sync>>::abc(), false);
assert_eq!(<Foo<dyn Sync + Send>>::abc(), true);
}

View file

@ -1,31 +0,0 @@
error[E0119]: conflicting implementations of trait `Trait` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:
--> $DIR/issue-33140.rs:9:1
|
LL | impl Trait for dyn Send + Sync {
| ------------------------------ first implementation here
...
LL | impl Trait for dyn Sync + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
error[E0119]: conflicting implementations of trait `Trait2` for type `(dyn std::marker::Send + std::marker::Sync + 'static)`:
--> $DIR/issue-33140.rs:22:1
|
LL | impl Trait2 for dyn Send + Sync {
| ------------------------------- first implementation here
...
LL | impl Trait2 for dyn Sync + Send + Sync {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(dyn std::marker::Send + std::marker::Sync + 'static)`
error[E0592]: duplicate definitions with name `abc`
--> $DIR/issue-33140.rs:29:5
|
LL | fn abc() -> bool {
| ^^^^^^^^^^^^^^^^ duplicate definitions for `abc`
...
LL | fn abc() -> bool {
| ---------------- other definition for `abc`
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0119, E0592.
For more information about an error, try `rustc --explain E0119`.

View file

@ -1,13 +0,0 @@
// run-rustfix
fn main() {
#[allow(non_upper_case_globals)]
const foo: isize = 100;
#[derive(Debug)]
enum Stuff {
Bar = foo
//~^ ERROR attempt to use a non-constant value in a constant
}
println!("{:?}", Stuff::Bar);
}

View file

@ -1,13 +0,0 @@
// run-rustfix
fn main() {
#[allow(non_upper_case_globals)]
let foo: isize = 100;
#[derive(Debug)]
enum Stuff {
Bar = foo
//~^ ERROR attempt to use a non-constant value in a constant
}
println!("{:?}", Stuff::Bar);
}

View file

@ -1,12 +0,0 @@
error[E0435]: attempt to use a non-constant value in a constant
--> $DIR/issue-3521.rs:8:15
|
LL | let foo: isize = 100;
| ------- help: consider using `const` instead of `let`: `const foo`
...
LL | Bar = foo
| ^^^ non-constant value
error: aborting due to previous error
For more information about this error, try `rustc --explain E0435`.

View file

@ -1,8 +0,0 @@
static TAB: [&mut [u8]; 0] = [];
pub unsafe fn test() {
TAB[0].iter_mut();
//~^ ERROR cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item [E0596]
}
pub fn main() {}

View file

@ -1,9 +0,0 @@
error[E0596]: cannot borrow `*TAB[_]` as mutable, as `TAB` is an immutable static item
--> $DIR/issue-42344.rs:4:5
|
LL | TAB[0].iter_mut();
| ^^^^^^ cannot borrow as mutable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0596`.

View file

@ -1,11 +0,0 @@
// check-pass
#![allow(dead_code)]
struct Foo(bool);
struct Container(&'static [&'static Foo]);
static FOO: Foo = Foo(true);
static CONTAINER: Container = Container(&[&FOO]);
fn main() {}

View file

@ -1,5 +0,0 @@
static FOO: u32 = 50;
fn main() {
let _val: &'static [&'static u32] = &[&FOO]; //~ ERROR temporary value dropped while borrowed
}

View file

@ -1,13 +0,0 @@
error[E0716]: temporary value dropped while borrowed
--> $DIR/issue-44373.rs:4:42
|
LL | let _val: &'static [&'static u32] = &[&FOO];
| ----------------------- ^^^^^^ creates a temporary which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
| - temporary value is freed at the end of this statement
error: aborting due to previous error
For more information about this error, try `rustc --explain E0716`.

View file

@ -1,25 +0,0 @@
// Regression test for an NLL-related ICE (#52992) -- computing
// implied bounds was causing outlives relations that were not
// properly handled.
//
// check-pass
fn main() {}
fn fail<'a>() -> Struct<'a, Generic<()>> {
Struct(&Generic(()))
}
struct Struct<'a, T>(&'a T) where
T: Trait + 'a,
T::AT: 'a; // only fails with this bound
struct Generic<T>(T);
trait Trait {
type AT;
}
impl<T> Trait for Generic<T> {
type AT = T; // only fails with a generic AT
}

View file

@ -1,12 +0,0 @@
// run-pass
// pretty-expanded FIXME #23616
#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620
pub fn main() {
const FOO: f64 = 10.0;
match 0.0 {
0.0 ..= FOO => (),
_ => ()
}
}

View file

@ -1,19 +0,0 @@
// check-pass
#![feature(associated_type_defaults)]
use std::io::Read;
trait View {
type Deserializers: Deserializer<Item = Self::RequestParams>;
type RequestParams = DefaultRequestParams;
}
struct DefaultRequestParams;
trait Deserializer {
type Item;
fn deserialize(r: impl Read) -> Self::Item;
}
fn main() {}