Merge pull request #535 from RalfJung/tests-edition-2018

Use edition 2018 for tests
This commit is contained in:
Ralf Jung 2018-11-20 15:00:22 +01:00 committed by GitHub
commit 669b9ea5bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 13 deletions

View file

@ -8,7 +8,7 @@ mod rusti {
pub fn main() {
unsafe {
use rusti::*;
use crate::rusti::*;
ctlz_nonzero(0u8); //~ ERROR constant evaluation error: ctlz_nonzero called on 0
}

View file

@ -8,7 +8,7 @@ mod rusti {
pub fn main() {
unsafe {
use rusti::*;
use crate::rusti::*;
cttz_nonzero(0u8); //~ ERROR constant evaluation error: cttz_nonzero called on 0
}

View file

@ -62,6 +62,7 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, need_fullm
let mut flags = Vec::new();
flags.push(format!("--sysroot {}", sysroot.display()));
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
flags.push("--edition 2018".to_owned());
if opt {
// Optimizing too aggressivley makes UB detection harder, but test at least
// the default value.
@ -98,6 +99,7 @@ fn miri_pass(sysroot: &Path, path: &str, target: &str, host: &str, need_fullmir:
let mut flags = Vec::new();
flags.push(format!("--sysroot {}", sysroot.display()));
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
flags.push("--edition 2018".to_owned());
if opt {
// FIXME: We use opt level 1 because MIR inlining defeats the validation
// whitelist.

View file

@ -9,14 +9,16 @@
// except according to those terms.
//ignore-windows: Uses POSIX APIs
#![feature(libc)]
#![feature(libc, extern_crate_item_prelude)]
#![allow(unused_extern_crates)] // rustc bug https://github.com/rust-lang/rust/issues/56098
extern crate libc;
use std::ffi::CString;
mod mlibc {
use libc::{c_char, size_t};
extern {
#[link_name = "strlen"]
pub fn my_strlen(str: *const c_char) -> size_t;

View file

@ -1,6 +1,5 @@
#![feature(slice_internals)]
extern crate core;
use core::slice::memchr::{memchr, memrchr};
// test fallback implementations on all platforms

View file

@ -23,7 +23,7 @@ mod rusti {
pub fn main() {
unsafe {
use rusti::*;
use crate::rusti::*;
assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0);
assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0);

View file

@ -68,13 +68,11 @@ fn mut_shr_raw() {
// That should work.
fn mut_raw_then_mut_shr() {
let mut x = 2;
{
let xref = &mut x;
let xraw = &mut *xref as *mut _;
let xshr = &*xref;
assert_eq!(*xshr, 2);
unsafe { *xraw = 4; }
}
let xref = &mut x;
let xraw = &mut *xref as *mut _;
let xshr = &*xref;
assert_eq!(*xshr, 2);
unsafe { *xraw = 4; }
assert_eq!(x, 4);
}