未验证 提交 dbd73f64 编写于 作者: M Mazdak Farrokhzad 提交者: GitHub

Rollup merge of #58091 - phansch:compiletest2018, r=Centril

Transition compiletest to Rust 2018

This transitions `src/tools/compiletest` to Rust 2018.

cc #58099
......@@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "compiletest"
version = "0.0.0"
edition = "2018"
[dependencies]
diff = "0.1.10"
......
......@@ -5,7 +5,7 @@
use std::str::FromStr;
use test::ColorConfig;
use util::PathBufExt;
use crate::util::PathBufExt;
#[derive(Clone, Copy, PartialEq, Debug)]
pub enum Mode {
......@@ -66,7 +66,7 @@ fn from_str(s: &str) -> Result<Mode, ()> {
}
impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match *self {
CompileFail => "compile-fail",
RunFail => "run-fail",
......
......@@ -33,7 +33,7 @@ fn from_str(s: &str) -> Result<Self, Self::Err> {
}
impl fmt::Display for ErrorKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
ErrorKind::Help => write!(f, "help message"),
ErrorKind::Error => write!(f, "error"),
......
......@@ -4,10 +4,10 @@
use std::io::BufReader;
use std::path::{Path, PathBuf};
use common::{self, CompareMode, Config, Mode};
use util;
use crate::common::{self, CompareMode, Config, Mode};
use crate::util;
use extract_gdb_version;
use crate::extract_gdb_version;
/// Whether to ignore the test.
#[derive(Clone, Copy, PartialEq, Debug)]
......
use errors::{Error, ErrorKind};
use runtest::ProcRes;
use crate::errors::{Error, ErrorKind};
use crate::runtest::ProcRes;
use serde_json;
use std::path::Path;
use std::str::FromStr;
......
#![crate_name = "compiletest"]
#![feature(test)]
#![deny(warnings)]
#![deny(warnings, rust_2018_idioms)]
extern crate diff;
extern crate env_logger;
extern crate filetime;
extern crate getopts;
#[cfg(unix)]
extern crate libc;
#[macro_use]
extern crate log;
extern crate regex;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
extern crate test;
extern crate rustfix;
extern crate walkdir;
use common::CompareMode;
use common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
use common::{Config, TestPaths};
use common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
use crate::common::CompareMode;
use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
use crate::common::{Config, TestPaths};
use crate::common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
use filetime::FileTime;
use getopts::Options;
use std::env;
......@@ -33,8 +25,10 @@
use std::path::{Path, PathBuf};
use std::process::Command;
use test::ColorConfig;
use util::logv;
use crate::util::logv;
use walkdir::WalkDir;
use env_logger;
use getopts;
use self::header::{EarlyProps, Ignore};
......
......@@ -100,18 +100,15 @@ pub fn read2(
#[cfg(windows)]
mod imp {
extern crate miow;
extern crate winapi;
use std::io;
use std::os::windows::prelude::*;
use std::process::{ChildStderr, ChildStdout};
use std::slice;
use self::miow::iocp::{CompletionPort, CompletionStatus};
use self::miow::pipe::NamedPipe;
use self::miow::Overlapped;
use self::winapi::shared::winerror::ERROR_BROKEN_PIPE;
use miow::iocp::{CompletionPort, CompletionStatus};
use miow::pipe::NamedPipe;
use miow::Overlapped;
use winapi::shared::winerror::ERROR_BROKEN_PIPE;
struct Pipe<'a> {
dst: &'a mut Vec<u8>,
......
use common::CompareMode;
use common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT};
use common::{output_base_dir, output_base_name, output_testname_unique};
use common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc};
use common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind};
use common::{Config, TestPaths};
use common::{Incremental, MirOpt, RunMake, Ui};
use crate::common::CompareMode;
use crate::common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT};
use crate::common::{output_base_dir, output_base_name, output_testname_unique};
use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc};
use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind};
use crate::common::{Config, TestPaths};
use crate::common::{Incremental, MirOpt, RunMake, Ui};
use diff;
use errors::{self, Error, ErrorKind};
use crate::errors::{self, Error, ErrorKind};
use filetime::FileTime;
use header::TestProps;
use json;
use crate::header::TestProps;
use crate::json;
use regex::Regex;
use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
use util::{logv, PathBufExt};
use crate::util::{logv, PathBufExt};
use std::collections::hash_map::DefaultHasher;
use std::collections::{HashMap, HashSet, VecDeque};
......@@ -27,8 +27,8 @@
use std::process::{Child, Command, ExitStatus, Output, Stdio};
use std::str;
use extract_gdb_version;
use is_android_gdb_target;
use crate::extract_gdb_version;
use crate::is_android_gdb_target;
#[cfg(windows)]
fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R {
......@@ -1937,7 +1937,7 @@ fn split_maybe_args(&self, argstr: &Option<String>) -> Vec<String> {
}
fn make_cmdline(&self, command: &Command, libpath: &str) -> String {
use util;
use crate::util;
// Linux and mac don't require adjusting the library search path
if cfg!(unix) {
......@@ -3255,7 +3255,7 @@ fn prune_duplicate_outputs(&self, modes: &[CompareMode]) {
}
fn create_stamp(&self) {
let stamp = ::stamp(&self.config, self.testpaths, self.revision);
let stamp = crate::stamp(&self.config, self.testpaths, self.revision);
fs::write(&stamp, compute_stamp_hash(&self.config)).unwrap();
}
}
......@@ -3311,7 +3311,7 @@ impl<T> fmt::Debug for ExpectedLine<T>
where
T: AsRef<str> + fmt::Debug,
{
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
if let &ExpectedLine::Text(ref t) = self {
write!(formatter, "{:?}", t)
} else {
......@@ -3334,7 +3334,7 @@ fn nocomment_mir_line(line: &str) -> &str {
}
fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
use read2::read2;
use crate::read2::read2;
use std::mem::replace;
const HEAD_LEN: usize = 160 * 1024;
......
use std::ffi::OsStr;
use std::env;
use std::path::PathBuf;
use common::Config;
use crate::common::Config;
/// Conversion table from triple OS name to Rust SYSNAME
const OS_TABLE: &'static [(&'static str, &'static str)] = &[
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册