Skip to content

Commit dbd73f6

Browse files
authored
Rollup merge of rust-lang#58091 - phansch:compiletest2018, r=Centril
Transition compiletest to Rust 2018 This transitions `src/tools/compiletest` to Rust 2018. cc rust-lang#58099
2 parents a2ec156 + fab032a commit dbd73f6

File tree

9 files changed

+39
-47
lines changed

9 files changed

+39
-47
lines changed

src/tools/compiletest/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
authors = ["The Rust Project Developers"]
33
name = "compiletest"
44
version = "0.0.0"
5+
edition = "2018"
56

67
[dependencies]
78
diff = "0.1.10"

src/tools/compiletest/src/common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55
use std::str::FromStr;
66

77
use test::ColorConfig;
8-
use util::PathBufExt;
8+
use crate::util::PathBufExt;
99

1010
#[derive(Clone, Copy, PartialEq, Debug)]
1111
pub enum Mode {
@@ -66,7 +66,7 @@ impl FromStr for Mode {
6666
}
6767

6868
impl fmt::Display for Mode {
69-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
69+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7070
let s = match *self {
7171
CompileFail => "compile-fail",
7272
RunFail => "run-fail",

src/tools/compiletest/src/errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl FromStr for ErrorKind {
3333
}
3434

3535
impl fmt::Display for ErrorKind {
36-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
36+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3737
match *self {
3838
ErrorKind::Help => write!(f, "help message"),
3939
ErrorKind::Error => write!(f, "error"),

src/tools/compiletest/src/header.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ use std::io::prelude::*;
44
use std::io::BufReader;
55
use std::path::{Path, PathBuf};
66

7-
use common::{self, CompareMode, Config, Mode};
8-
use util;
7+
use crate::common::{self, CompareMode, Config, Mode};
8+
use crate::util;
99

10-
use extract_gdb_version;
10+
use crate::extract_gdb_version;
1111

1212
/// Whether to ignore the test.
1313
#[derive(Clone, Copy, PartialEq, Debug)]

src/tools/compiletest/src/json.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use errors::{Error, ErrorKind};
2-
use runtest::ProcRes;
1+
use crate::errors::{Error, ErrorKind};
2+
use crate::runtest::ProcRes;
33
use serde_json;
44
use std::path::Path;
55
use std::str::FromStr;

src/tools/compiletest/src/main.rs

+8-14
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,21 @@
11
#![crate_name = "compiletest"]
22
#![feature(test)]
3-
#![deny(warnings)]
3+
#![deny(warnings, rust_2018_idioms)]
44

5-
extern crate diff;
6-
extern crate env_logger;
7-
extern crate filetime;
8-
extern crate getopts;
95
#[cfg(unix)]
106
extern crate libc;
117
#[macro_use]
128
extern crate log;
13-
extern crate regex;
149
#[macro_use]
1510
extern crate lazy_static;
1611
#[macro_use]
1712
extern crate serde_derive;
18-
extern crate serde_json;
1913
extern crate test;
20-
extern crate rustfix;
21-
extern crate walkdir;
2214

23-
use common::CompareMode;
24-
use common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
25-
use common::{Config, TestPaths};
26-
use common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
15+
use crate::common::CompareMode;
16+
use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
17+
use crate::common::{Config, TestPaths};
18+
use crate::common::{DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Mode, Pretty};
2719
use filetime::FileTime;
2820
use getopts::Options;
2921
use std::env;
@@ -33,8 +25,10 @@ use std::io::{self, ErrorKind};
3325
use std::path::{Path, PathBuf};
3426
use std::process::Command;
3527
use test::ColorConfig;
36-
use util::logv;
28+
use crate::util::logv;
3729
use walkdir::WalkDir;
30+
use env_logger;
31+
use getopts;
3832

3933
use self::header::{EarlyProps, Ignore};
4034

src/tools/compiletest/src/read2.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,15 @@ mod imp {
100100

101101
#[cfg(windows)]
102102
mod imp {
103-
extern crate miow;
104-
extern crate winapi;
105-
106103
use std::io;
107104
use std::os::windows::prelude::*;
108105
use std::process::{ChildStderr, ChildStdout};
109106
use std::slice;
110107

111-
use self::miow::iocp::{CompletionPort, CompletionStatus};
112-
use self::miow::pipe::NamedPipe;
113-
use self::miow::Overlapped;
114-
use self::winapi::shared::winerror::ERROR_BROKEN_PIPE;
108+
use miow::iocp::{CompletionPort, CompletionStatus};
109+
use miow::pipe::NamedPipe;
110+
use miow::Overlapped;
111+
use winapi::shared::winerror::ERROR_BROKEN_PIPE;
115112

116113
struct Pipe<'a> {
117114
dst: &'a mut Vec<u8>,

src/tools/compiletest/src/runtest.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
use common::CompareMode;
2-
use common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT};
3-
use common::{output_base_dir, output_base_name, output_testname_unique};
4-
use common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc};
5-
use common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind};
6-
use common::{Config, TestPaths};
7-
use common::{Incremental, MirOpt, RunMake, Ui};
1+
use crate::common::CompareMode;
2+
use crate::common::{expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT};
3+
use crate::common::{output_base_dir, output_base_name, output_testname_unique};
4+
use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc};
5+
use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind};
6+
use crate::common::{Config, TestPaths};
7+
use crate::common::{Incremental, MirOpt, RunMake, Ui};
88
use diff;
9-
use errors::{self, Error, ErrorKind};
9+
use crate::errors::{self, Error, ErrorKind};
1010
use filetime::FileTime;
11-
use header::TestProps;
12-
use json;
11+
use crate::header::TestProps;
12+
use crate::json;
1313
use regex::Regex;
1414
use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
15-
use util::{logv, PathBufExt};
15+
use crate::util::{logv, PathBufExt};
1616

1717
use std::collections::hash_map::DefaultHasher;
1818
use std::collections::{HashMap, HashSet, VecDeque};
@@ -27,8 +27,8 @@ use std::path::{Path, PathBuf};
2727
use std::process::{Child, Command, ExitStatus, Output, Stdio};
2828
use std::str;
2929

30-
use extract_gdb_version;
31-
use is_android_gdb_target;
30+
use crate::extract_gdb_version;
31+
use crate::is_android_gdb_target;
3232

3333
#[cfg(windows)]
3434
fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R {
@@ -1937,7 +1937,7 @@ impl<'test> TestCx<'test> {
19371937
}
19381938

19391939
fn make_cmdline(&self, command: &Command, libpath: &str) -> String {
1940-
use util;
1940+
use crate::util;
19411941

19421942
// Linux and mac don't require adjusting the library search path
19431943
if cfg!(unix) {
@@ -3255,7 +3255,7 @@ impl<'test> TestCx<'test> {
32553255
}
32563256

32573257
fn create_stamp(&self) {
3258-
let stamp = ::stamp(&self.config, self.testpaths, self.revision);
3258+
let stamp = crate::stamp(&self.config, self.testpaths, self.revision);
32593259
fs::write(&stamp, compute_stamp_hash(&self.config)).unwrap();
32603260
}
32613261
}
@@ -3311,7 +3311,7 @@ impl<T> fmt::Debug for ExpectedLine<T>
33113311
where
33123312
T: AsRef<str> + fmt::Debug,
33133313
{
3314-
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
3314+
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
33153315
if let &ExpectedLine::Text(ref t) = self {
33163316
write!(formatter, "{:?}", t)
33173317
} else {
@@ -3334,7 +3334,7 @@ fn nocomment_mir_line(line: &str) -> &str {
33343334
}
33353335

33363336
fn read2_abbreviated(mut child: Child) -> io::Result<Output> {
3337-
use read2::read2;
3337+
use crate::read2::read2;
33383338
use std::mem::replace;
33393339

33403340
const HEAD_LEN: usize = 160 * 1024;

src/tools/compiletest/src/util.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::ffi::OsStr;
22
use std::env;
33
use std::path::PathBuf;
4-
use common::Config;
4+
use crate::common::Config;
55

66
/// Conversion table from triple OS name to Rust SYSNAME
77
const OS_TABLE: &'static [(&'static str, &'static str)] = &[

0 commit comments

Comments
 (0)