Rename static mut to upper case
This commit is contained in:
parent
350b0d8946
commit
72399f2db7
4 changed files with 26 additions and 26 deletions
|
@ -271,22 +271,22 @@ fn test_zip_unzip() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_vec_truncate_drop() {
|
fn test_vec_truncate_drop() {
|
||||||
static mut drops: u32 = 0;
|
static mut DROPS: u32 = 0;
|
||||||
struct Elem(i32);
|
struct Elem(i32);
|
||||||
impl Drop for Elem {
|
impl Drop for Elem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
drops += 1;
|
DROPS += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut v = vec![Elem(1), Elem(2), Elem(3), Elem(4), Elem(5)];
|
let mut v = vec![Elem(1), Elem(2), Elem(3), Elem(4), Elem(5)];
|
||||||
assert_eq!(unsafe { drops }, 0);
|
assert_eq!(unsafe { DROPS }, 0);
|
||||||
v.truncate(3);
|
v.truncate(3);
|
||||||
assert_eq!(unsafe { drops }, 2);
|
assert_eq!(unsafe { DROPS }, 2);
|
||||||
v.truncate(0);
|
v.truncate(0);
|
||||||
assert_eq!(unsafe { drops }, 5);
|
assert_eq!(unsafe { DROPS }, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -695,12 +695,12 @@ fn test_show() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_drop() {
|
fn test_drop() {
|
||||||
static mut drops: i32 = 0;
|
static mut DROPS: i32 = 0;
|
||||||
struct Elem;
|
struct Elem;
|
||||||
impl Drop for Elem {
|
impl Drop for Elem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
drops += 1;
|
DROPS += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -712,17 +712,17 @@ fn test_drop() {
|
||||||
ring.push_front(Elem);
|
ring.push_front(Elem);
|
||||||
drop(ring);
|
drop(ring);
|
||||||
|
|
||||||
assert_eq!(unsafe { drops }, 4);
|
assert_eq!(unsafe { DROPS }, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_drop_with_pop() {
|
fn test_drop_with_pop() {
|
||||||
static mut drops: i32 = 0;
|
static mut DROPS: i32 = 0;
|
||||||
struct Elem;
|
struct Elem;
|
||||||
impl Drop for Elem {
|
impl Drop for Elem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
drops += 1;
|
DROPS += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -735,20 +735,20 @@ fn test_drop_with_pop() {
|
||||||
|
|
||||||
drop(ring.pop_back());
|
drop(ring.pop_back());
|
||||||
drop(ring.pop_front());
|
drop(ring.pop_front());
|
||||||
assert_eq!(unsafe { drops }, 2);
|
assert_eq!(unsafe { DROPS }, 2);
|
||||||
|
|
||||||
drop(ring);
|
drop(ring);
|
||||||
assert_eq!(unsafe { drops }, 4);
|
assert_eq!(unsafe { DROPS }, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_drop_clear() {
|
fn test_drop_clear() {
|
||||||
static mut drops: i32 = 0;
|
static mut DROPS: i32 = 0;
|
||||||
struct Elem;
|
struct Elem;
|
||||||
impl Drop for Elem {
|
impl Drop for Elem {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe {
|
unsafe {
|
||||||
drops += 1;
|
DROPS += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -759,10 +759,10 @@ fn test_drop_clear() {
|
||||||
ring.push_back(Elem);
|
ring.push_back(Elem);
|
||||||
ring.push_front(Elem);
|
ring.push_front(Elem);
|
||||||
ring.clear();
|
ring.clear();
|
||||||
assert_eq!(unsafe { drops }, 4);
|
assert_eq!(unsafe { DROPS }, 4);
|
||||||
|
|
||||||
drop(ring);
|
drop(ring);
|
||||||
assert_eq!(unsafe { drops }, 4);
|
assert_eq!(unsafe { DROPS }, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
|
@ -387,7 +387,7 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn stampede_once() {
|
fn stampede_once() {
|
||||||
static O: Once = Once::new();
|
static O: Once = Once::new();
|
||||||
static mut run: bool = false;
|
static mut RUN: bool = false;
|
||||||
|
|
||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
|
@ -396,10 +396,10 @@ mod tests {
|
||||||
for _ in 0..4 { thread::yield_now() }
|
for _ in 0..4 { thread::yield_now() }
|
||||||
unsafe {
|
unsafe {
|
||||||
O.call_once(|| {
|
O.call_once(|| {
|
||||||
assert!(!run);
|
assert!(!RUN);
|
||||||
run = true;
|
RUN = true;
|
||||||
});
|
});
|
||||||
assert!(run);
|
assert!(RUN);
|
||||||
}
|
}
|
||||||
tx.send(()).unwrap();
|
tx.send(()).unwrap();
|
||||||
});
|
});
|
||||||
|
@ -407,10 +407,10 @@ mod tests {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
O.call_once(|| {
|
O.call_once(|| {
|
||||||
assert!(!run);
|
assert!(!RUN);
|
||||||
run = true;
|
RUN = true;
|
||||||
});
|
});
|
||||||
assert!(run);
|
assert!(RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
for _ in 0..10 {
|
for _ in 0..10 {
|
||||||
|
|
|
@ -44,7 +44,7 @@ pub mod eh_frames {
|
||||||
|
|
||||||
// Scratch space for unwinder's internal book-keeping.
|
// Scratch space for unwinder's internal book-keeping.
|
||||||
// This is defined as `struct object` in $GCC/libgcc/unwind-dw2-fde.h.
|
// This is defined as `struct object` in $GCC/libgcc/unwind-dw2-fde.h.
|
||||||
static mut obj: [isize; 6] = [0; 6];
|
static mut OBJ: [isize; 6] = [0; 6];
|
||||||
|
|
||||||
// Unwind info registration/deregistration routines.
|
// Unwind info registration/deregistration routines.
|
||||||
// See the docs of `unwind` module in libstd.
|
// See the docs of `unwind` module in libstd.
|
||||||
|
@ -56,13 +56,13 @@ pub mod eh_frames {
|
||||||
unsafe fn init() {
|
unsafe fn init() {
|
||||||
// register unwind info on module startup
|
// register unwind info on module startup
|
||||||
rust_eh_register_frames(&__EH_FRAME_BEGIN__ as *const u8,
|
rust_eh_register_frames(&__EH_FRAME_BEGIN__ as *const u8,
|
||||||
&mut obj as *mut _ as *mut u8);
|
&mut OBJ as *mut _ as *mut u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn uninit() {
|
unsafe fn uninit() {
|
||||||
// unregister on shutdown
|
// unregister on shutdown
|
||||||
rust_eh_unregister_frames(&__EH_FRAME_BEGIN__ as *const u8,
|
rust_eh_unregister_frames(&__EH_FRAME_BEGIN__ as *const u8,
|
||||||
&mut obj as *mut _ as *mut u8);
|
&mut OBJ as *mut _ as *mut u8);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MSVC-specific init/uninit routine registration
|
// MSVC-specific init/uninit routine registration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue