mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
rustfmt tests/run-pass-valgrind/
.
This commit is contained in:
parent
d161d06241
commit
a78e1202dd
@ -17,7 +17,6 @@ ignore = [
|
||||
"/tests/incremental/", # These tests are somewhat 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-pass-valgrind/",
|
||||
"/tests/rustdoc/",
|
||||
"/tests/rustdoc-gui/",
|
||||
"/tests/rustdoc-js/",
|
||||
|
@ -2,14 +2,14 @@
|
||||
|
||||
// check dtor calling order when casting enums.
|
||||
|
||||
use std::mem;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::mem;
|
||||
|
||||
enum E {
|
||||
A = 0,
|
||||
B = 1,
|
||||
C = 2
|
||||
C = 2,
|
||||
}
|
||||
|
||||
static FLAG: atomic::AtomicUsize = atomic::AtomicUsize::new(0);
|
||||
@ -19,7 +19,7 @@ impl Drop for E {
|
||||
// avoid dtor loop
|
||||
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;
|
||||
impl Drop for Foo {
|
||||
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 {}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -7,9 +7,15 @@ use std::boxed::Box;
|
||||
pub fn main() {
|
||||
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.
|
||||
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 {
|
||||
true => { let b: Box<_> = Box::new([1, 2, 3]); b }
|
||||
false => { let b: Box<_> = Box::new([1]); b }
|
||||
true => {
|
||||
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.
|
||||
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 {
|
||||
fn drop(&mut self) {
|
||||
unsafe { HIT = true; }
|
||||
unsafe {
|
||||
HIT = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
std::thread::spawn(|| {
|
||||
FOO.with(|_| {});
|
||||
}).join().unwrap();
|
||||
})
|
||||
.join()
|
||||
.unwrap();
|
||||
assert!(unsafe { HIT });
|
||||
}
|
||||
|
@ -3,15 +3,19 @@ static mut DROP_RAN: bool = false;
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
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 {}
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
f: T
|
||||
f: T,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -3,12 +3,14 @@ static mut DROP_RAN: isize = 0;
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN += 1; }
|
||||
unsafe {
|
||||
DROP_RAN += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Fat<T: ?Sized> {
|
||||
f: T
|
||||
f: T,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -5,11 +5,15 @@ static mut DROP_RAN: bool = false;
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
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 {}
|
||||
|
||||
pub fn main() {
|
||||
|
@ -5,7 +5,9 @@ static mut DROP_RAN: isize = 0;
|
||||
struct Foo;
|
||||
impl Drop for Foo {
|
||||
fn drop(&mut self) {
|
||||
unsafe { DROP_RAN += 1; }
|
||||
unsafe {
|
||||
DROP_RAN += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@ impl FnOnce<()> for D {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = *(Box::new(A) as Box<dyn FnOnce<(), Output = String>>);
|
||||
assert_eq!(x.call_once(()), format!("hello"));
|
||||
|
@ -51,7 +51,6 @@ impl FnOnce<(String, Box<str>)> for D {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
||||
let x = *(Box::new(A) as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
@ -61,10 +60,10 @@ fn main() {
|
||||
assert_eq!(x.call_once((s1, s2)), format!("42"));
|
||||
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
||||
let x = *(Box::new(C(format!("jumping fox")))
|
||||
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
assert_eq!(x.call_once((s1, s2)), format!("jumping fox"));
|
||||
let (s1, s2) = (format!("s1"), format!("s2").into_boxed_str());
|
||||
let x = *(Box::new(D(Box::new(format!("lazy dog"))))
|
||||
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
as Box<dyn FnOnce<(String, Box<str>), Output = String>>);
|
||||
assert_eq!(x.call_once((s1, s2)), format!("lazy dog"));
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ impl Foo for D {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let x = *(Box::new(A) as Box<dyn Foo>);
|
||||
assert_eq!(x.foo(), format!("hello"));
|
||||
|
Loading…
Reference in New Issue
Block a user