Fix some warnings

This commit is contained in:
bjorn3 2019-08-12 16:00:10 +02:00
parent 314141392a
commit f5b0a68fbf
4 changed files with 10 additions and 12 deletions

View File

@ -9,7 +9,6 @@
extern crate mini_core;
use mini_core::*;
use mini_core::libc::*;
macro_rules! assert_eq {
($l:expr, $r: expr) => {

View File

@ -430,6 +430,7 @@ pub trait Drop {
fn drop(&mut self);
}
#[allow(unions_with_drop_fields)]
pub union MaybeUninit<T> {
pub uninit: (),
pub value: T,

View File

@ -149,7 +149,7 @@ fn main() {
let world: Box<&str> = box "World!\0";
puts(*world as *const str as *const u8);
world as Box<SomeTrait>;
world as Box<dyn SomeTrait>;
assert_eq!(intrinsics::bitreverse(0b10101000u8), 0b00010101u8);
@ -212,7 +212,7 @@ fn main() {
let _ = box NoisyDrop {
text: "Boxed outer got dropped!\0",
inner: NoisyDropInner,
} as Box<SomeTrait>;
} as Box<dyn SomeTrait>;
const FUNC_REF: Option<fn()> = Some(main);
match FUNC_REF {
@ -249,5 +249,5 @@ fn main() {
unsafe { assert_eq!(ABC as usize, 0); }
&mut (|| Some(0 as *const ())) as &mut FnMut() -> Option<*const ()>;
&mut (|| Some(0 as *const ())) as &mut dyn FnMut() -> Option<*const ()>;
}

View File

@ -2,12 +2,10 @@
use std::arch::x86_64::*;
use std::io::Write;
use std::intrinsics;
fn main() {
let mutex = std::sync::Mutex::new(());
mutex.lock().unwrap();
let _guard = mutex.lock().unwrap();
let _ = ::std::iter::repeat('a' as u8).take(10).collect::<Vec<_>>();
let stderr = ::std::io::stderr();
@ -19,10 +17,10 @@ fn main() {
println!("cargo:rustc-link-lib=z");
static ONCE: std::sync::Once = std::sync::ONCE_INIT;
static ONCE: std::sync::Once = std::sync::Once::new();
ONCE.call_once(|| {});
LoopState::Continue(()) == LoopState::Break(());
let _eq = LoopState::Continue(()) == LoopState::Break(());
// Make sure ByValPair values with differently sized components are correctly passed
map(None::<(u8, Box<Instruction>)>);
@ -41,8 +39,8 @@ fn main() {
assert_eq!(0b0000000000000000000000000010000010000000000000000000000000000000_0000000000100000000000000000000000001000000000000100000000000000u128.leading_zeros(), 26);
assert_eq!(0b0000000000000000000000000010000000000000000000000000000000000000_0000000000000000000000000000000000001000000000000000000010000000u128.trailing_zeros(), 7);
0i128.checked_div(2i128);
0u128.checked_div(2u128);
let _d = 0i128.checked_div(2i128);
let _d = 0u128.checked_div(2u128);
assert_eq!(1u128 + 2, 3);
assert_eq!(0b100010000000000000000000000000000u128 >> 10, 0b10001000000000000000000u128);
@ -165,7 +163,7 @@ unsafe fn test_mm_add_pd() {
fn assert_eq_m128i(x: std::arch::x86_64::__m128i, y: std::arch::x86_64::__m128i) {
unsafe {
assert_eq!(std::mem::transmute::<_, [u8; 16]>(x), std::mem::transmute::<_, [u8; 16]>(x));
assert_eq!(std::mem::transmute::<_, [u8; 16]>(x), std::mem::transmute::<_, [u8; 16]>(y));
}
}