rustfmt tests/run-pass-valgrind/
.
This commit is contained in:
parent
d161d06241
commit
a78e1202dd
13 changed files with 57 additions and 27 deletions
|
@ -17,7 +17,6 @@ ignore = [
|
||||||
"/tests/incremental/", # These tests are somewhat sensitive to source code layout.
|
"/tests/incremental/", # These tests are somewhat sensitive to source code layout.
|
||||||
"/tests/pretty/", # These tests are very sensitive to source code layout.
|
"/tests/pretty/", # These tests are very sensitive to source code layout.
|
||||||
"/tests/run-make/translation/test.rs", # This test contains syntax errors.
|
"/tests/run-make/translation/test.rs", # This test contains syntax errors.
|
||||||
"/tests/run-pass-valgrind/",
|
|
||||||
"/tests/rustdoc/",
|
"/tests/rustdoc/",
|
||||||
"/tests/rustdoc-gui/",
|
"/tests/rustdoc-gui/",
|
||||||
"/tests/rustdoc-js/",
|
"/tests/rustdoc-js/",
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
|
|
||||||
// check dtor calling order when casting enums.
|
// check dtor calling order when casting enums.
|
||||||
|
|
||||||
|
use std::mem;
|
||||||
use std::sync::atomic;
|
use std::sync::atomic;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::mem;
|
|
||||||
|
|
||||||
enum E {
|
enum E {
|
||||||
A = 0,
|
A = 0,
|
||||||
B = 1,
|
B = 1,
|
||||||
C = 2
|
C = 2,
|
||||||
}
|
}
|
||||||
|
|
||||||
static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
|
static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
|
||||||
|
@ -19,7 +19,7 @@ impl Drop for E {
|
||||||
// avoid dtor loop
|
// avoid dtor loop
|
||||||
unsafe { mem::forget(mem::replace(self, E::B)) };
|
unsafe { mem::forget(mem::replace(self, E::B)) };
|
||||||
|
|
||||||
FLAG.store(FLAG.load(Ordering::SeqCst)+1, Ordering::SeqCst);
|
FLAG.store(FLAG.load(Ordering::SeqCst) + 1, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,12 +7,15 @@ static mut DROP_RAN: bool = false;
|
||||||
struct Foo;
|
struct Foo;
|
||||||
impl Drop for Foo {
|
impl Drop for Foo {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { DROP_RAN = true; }
|
unsafe {
|
||||||
|
DROP_RAN = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trait Trait {
|
||||||
trait Trait { fn dummy(&self) { } }
|
fn dummy(&self) {}
|
||||||
|
}
|
||||||
impl Trait for Foo {}
|
impl Trait for Foo {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -7,9 +7,15 @@ use std::boxed::Box;
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
|
let _: Box<[isize]> = if true { Box::new([1, 2, 3]) } else { Box::new([1]) };
|
||||||
|
|
||||||
let _: Box<[isize]> = match true { true => Box::new([1, 2, 3]), false => Box::new([1]) };
|
let _: Box<[isize]> = match true {
|
||||||
|
true => Box::new([1, 2, 3]),
|
||||||
|
false => Box::new([1]),
|
||||||
|
};
|
||||||
|
|
||||||
// Check we don't get over-keen at propagating coercions in the case of casts.
|
// Check we don't get over-keen at propagating coercions in the case of casts.
|
||||||
let x = if true { 42 } else { 42u8 } as u16;
|
let x = if true { 42 } else { 42u8 } as u16;
|
||||||
let x = match true { true => 42, false => 42u8 } as u16;
|
let x = match true {
|
||||||
|
true => 42,
|
||||||
|
false => 42u8,
|
||||||
|
} as u16;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,20 @@ pub fn main() {
|
||||||
};
|
};
|
||||||
|
|
||||||
let _: Box<[isize]> = match true {
|
let _: Box<[isize]> = match true {
|
||||||
true => { let b: Box<_> = Box::new([1, 2, 3]); b }
|
true => {
|
||||||
false => { let b: Box<_> = Box::new([1]); b }
|
let b: Box<_> = Box::new([1, 2, 3]);
|
||||||
|
b
|
||||||
|
}
|
||||||
|
false => {
|
||||||
|
let b: Box<_> = Box::new([1]);
|
||||||
|
b
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check we don't get over-keen at propagating coercions in the case of casts.
|
// Check we don't get over-keen at propagating coercions in the case of casts.
|
||||||
let x = if true { 42 } else { 42u8 } as u16;
|
let x = if true { 42 } else { 42u8 } as u16;
|
||||||
let x = match true { true => 42, false => 42u8 } as u16;
|
let x = match true {
|
||||||
|
true => 42,
|
||||||
|
false => 42u8,
|
||||||
|
} as u16;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,13 +27,17 @@ impl Drop for Bar {
|
||||||
|
|
||||||
impl Drop for Baz {
|
impl Drop for Baz {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { HIT = true; }
|
unsafe {
|
||||||
|
HIT = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
std::thread::spawn(|| {
|
std::thread::spawn(|| {
|
||||||
FOO.with(|_| {});
|
FOO.with(|_| {});
|
||||||
}).join().unwrap();
|
})
|
||||||
|
.join()
|
||||||
|
.unwrap();
|
||||||
assert!(unsafe { HIT });
|
assert!(unsafe { HIT });
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,19 @@ static mut DROP_RAN: bool = false;
|
||||||
struct Foo;
|
struct Foo;
|
||||||
impl Drop for Foo {
|
impl Drop for Foo {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { DROP_RAN = true; }
|
unsafe {
|
||||||
|
DROP_RAN = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Trait { fn dummy(&self) { } }
|
trait Trait {
|
||||||
|
fn dummy(&self) {}
|
||||||
|
}
|
||||||
impl Trait for Foo {}
|
impl Trait for Foo {}
|
||||||
|
|
||||||
struct Fat<T: ?Sized> {
|
struct Fat<T: ?Sized> {
|
||||||
f: T
|
f: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -3,12 +3,14 @@ static mut DROP_RAN: isize = 0;
|
||||||
struct Foo;
|
struct Foo;
|
||||||
impl Drop for Foo {
|
impl Drop for Foo {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { DROP_RAN += 1; }
|
unsafe {
|
||||||
|
DROP_RAN += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Fat<T: ?Sized> {
|
struct Fat<T: ?Sized> {
|
||||||
f: T
|
f: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -5,11 +5,15 @@ static mut DROP_RAN: bool = false;
|
||||||
struct Foo;
|
struct Foo;
|
||||||
impl Drop for Foo {
|
impl Drop for Foo {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { DROP_RAN = true; }
|
unsafe {
|
||||||
|
DROP_RAN = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trait Trait { fn dummy(&self) { } }
|
trait Trait {
|
||||||
|
fn dummy(&self) {}
|
||||||
|
}
|
||||||
impl Trait for Foo {}
|
impl Trait for Foo {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
|
|
@ -5,7 +5,9 @@ static mut DROP_RAN: isize = 0;
|
||||||
struct Foo;
|
struct Foo;
|
||||||
impl Drop for Foo {
|
impl Drop for Foo {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { DROP_RAN += 1; }
|
unsafe {
|
||||||
|
DROP_RAN += 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,6 @@ impl FnOnce<()> for D {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
|
let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
|
||||||
assert_eq!(x.call_once(()), format!("hello"));
|
assert_eq!(x.call_once(()), format!("hello"));
|
||||||
|
|
|
@ -51,7 +51,6 @@ impl FnOnce<(String, Box<str>)> for D {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
||||||
let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||||
|
|
|
@ -36,7 +36,6 @@ impl Foo for D {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let x = *(Box::new(A) as Box<dyn Foo>);
|
let x = *(Box::new(A) as Box<dyn Foo>);
|
||||||
assert_eq!(x.foo(), format!("hello"));
|
assert_eq!(x.foo(), format!("hello"));
|
||||||
|
|
Loading…
Add table
Reference in a new issue