Update to Rust 2018 edition (#632)

* initial cargo fix run

* Upgrade cranelift-entity crate

* Upgrade bforest crate

* Upgrade the codegen crate

* Upgrade the faerie crate

* Upgrade the filetests crate

* Upgrade the codegen-meta crate

* Upgrade the frontend crate

* Upgrade the cranelift-module crate

* Upgrade the cranelift-native crate

* Upgrade the cranelift-preopt crate

* Upgrade the cranelift-reader crate

* Upgrade the cranelift-serde crate

* Upgrade the cranelift-simplejit crate

* Upgrade the cranelift or cranelift-umbrella crate

* Upgrade the cranelift-wasm crate

* Upgrade cranelift-tools crate

* Use new import style on remaining files

* run format-all.sh

* run test-all.sh, update Readme and travis ci configuration
fixed an AssertionError also

* Remove deprecated functions
This commit is contained in:
Muhammad Mominul Huque
2018-12-26 23:49:05 +06:00
committed by Dan Gohman
parent e3db942b0c
commit effe6c04e4
217 changed files with 963 additions and 1021 deletions

View File

@@ -3,18 +3,19 @@
//! This module provides the `ConcurrentRunner` struct which uses a pool of threads to run tests
//! concurrently.
use crate::runone;
use crate::TestResult;
use cranelift_codegen::dbg::LOG_FILENAME_PREFIX;
use cranelift_codegen::timing;
use file_per_thread_logger;
use log::error;
use num_cpus;
use runone;
use std::panic::catch_unwind;
use std::path::{Path, PathBuf};
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use TestResult;
/// Request sent to worker threads contains jobid and path.
struct Request(usize, PathBuf);

View File

@@ -23,18 +23,9 @@
)
)]
extern crate cranelift_codegen;
extern crate cranelift_preopt;
extern crate cranelift_reader;
extern crate file_per_thread_logger;
extern crate filecheck;
extern crate num_cpus;
#[macro_use]
extern crate log;
use crate::runner::TestRunner;
use cranelift_codegen::timing;
use cranelift_reader::TestCommand;
use runner::TestRunner;
use std::path::Path;
use std::time;

View File

@@ -9,7 +9,7 @@ pub fn match_directive<'a>(comment: &'a str, directive: &str) -> Option<&'a str>
directive.ends_with(':'),
"Directive must include trailing colon"
);
let text = comment.trim_left_matches(';').trim_left();
let text = comment.trim_left_matches(';').trim_start();
if text.starts_with(directive) {
Some(text[directive.len()..].trim())
} else {

View File

@@ -3,15 +3,15 @@
//! This module implements the `TestRunner` struct which manages executing tests as well as
//! scanning directories for tests.
use concurrent::{ConcurrentRunner, Reply};
use crate::concurrent::{ConcurrentRunner, Reply};
use crate::runone;
use crate::TestResult;
use cranelift_codegen::timing;
use runone;
use std::error::Error;
use std::ffi::OsStr;
use std::fmt::{self, Display};
use std::path::{Path, PathBuf};
use std::time;
use TestResult;
/// Timeout in seconds when we're not making progress.
const TIMEOUT_PANIC: usize = 10;

View File

@@ -1,5 +1,7 @@
//! Run the tests in a single test file.
use crate::subtest::{Context, SubTest, SubtestResult};
use crate::{new_subtest, TestResult};
use cranelift_codegen::ir::Function;
use cranelift_codegen::isa::TargetIsa;
use cranelift_codegen::print_errors::pretty_verifier_error;
@@ -8,13 +10,12 @@ use cranelift_codegen::timing;
use cranelift_codegen::verify_function;
use cranelift_reader::parse_test;
use cranelift_reader::IsaSpec;
use log::info;
use std::borrow::Cow;
use std::fs;
use std::io::{self, Read};
use std::path::Path;
use std::time;
use subtest::{Context, SubTest, SubtestResult};
use {new_subtest, TestResult};
/// Read an entire file into a string.
fn read_to_string<P: AsRef<Path>>(path: P) -> io::Result<String> {

View File

@@ -3,6 +3,8 @@
//! The `binemit` test command generates binary machine code for every instruction in the input
//! functions and compares the results to the expected output.
use crate::match_directive::match_directive;
use crate::subtest::{Context, SubTest, SubtestResult};
use cranelift_codegen::binemit;
use cranelift_codegen::binemit::{CodeSink, RegDiversions};
use cranelift_codegen::dbg::DisplayList;
@@ -11,11 +13,9 @@ use cranelift_codegen::ir::entities::AnyEntity;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::settings::OptLevel;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt::Write;
use subtest::{Context, SubTest, SubtestResult};
struct TestBinEmit;

View File

@@ -1,9 +1,9 @@
//! The `cat` subtest.
use crate::subtest::{self, Context, SubTest, SubtestResult};
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{self, Context, SubTest, SubtestResult};
/// Object implementing the `test cat` sub-test.
///

View File

@@ -2,12 +2,13 @@
//!
//! The `compile` test command runs each function through the full code generator pipeline
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::{binemit, ir};
use cranelift_reader::TestCommand;
use log::info;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestCompile;

View File

@@ -5,12 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestDCE;

View File

@@ -12,16 +12,16 @@
//! We verify that the dominator tree annotations are complete and correct.
//!
use crate::match_directive::match_directive;
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen::dominator_tree::{DominatorTree, DominatorTreePreorder};
use cranelift_codegen::flowgraph::ControlFlowGraph;
use cranelift_codegen::ir::entities::AnyEntity;
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::{Borrow, Cow};
use std::collections::HashMap;
use std::fmt::{self, Write};
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestDomtree;

View File

@@ -3,12 +3,12 @@
//! The `test legalizer` test command runs each function through `legalize_function()` and sends
//! the result to filecheck.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestLegalizer;

View File

@@ -5,12 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestLICM;

View File

@@ -2,12 +2,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestPostopt;

View File

@@ -5,13 +5,13 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_preopt::optimize;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestPreopt;

View File

@@ -5,10 +5,10 @@
use std::borrow::Cow;
use crate::subtest::{self, Context, SubTest, SubtestResult};
use cranelift_codegen::cfg_printer::CFGPrinter;
use cranelift_codegen::ir::Function;
use cranelift_reader::TestCommand;
use subtest::{self, Context, SubTest, SubtestResult};
/// Object implementing the `test print-cfg` sub-test.
struct TestPrintCfg;

View File

@@ -5,12 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestRegalloc;

View File

@@ -5,12 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestShrink;

View File

@@ -5,12 +5,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestSimpleGVN;

View File

@@ -2,12 +2,12 @@
//!
//! The resulting function is sent to `filecheck`.
use crate::subtest::{run_filecheck, Context, SubTest, SubtestResult};
use cranelift_codegen;
use cranelift_codegen::ir::Function;
use cranelift_codegen::print_errors::pretty_error;
use cranelift_reader::TestCommand;
use std::borrow::Cow;
use subtest::{run_filecheck, Context, SubTest, SubtestResult};
struct TestSimplePreopt;

View File

@@ -9,13 +9,13 @@
//! This annotation means that the verifier is expected to given an error for the jump instruction
//! containing the substring "jump to non-existent EBB".
use crate::match_directive::match_directive;
use crate::subtest::{Context, SubTest, SubtestResult};
use cranelift_codegen::ir::Function;
use cranelift_codegen::verify_function;
use cranelift_reader::TestCommand;
use match_directive::match_directive;
use std::borrow::{Borrow, Cow};
use std::fmt::Write;
use subtest::{Context, SubTest, SubtestResult};
struct TestVerifier;