Skip to content

Commit a4a667b

Browse files
committed
Auto merge of #2061 - RalfJung:edition, r=RalfJung
port Miri to edition 2021 `cargo fix --edition` didn't change anything for either of these crates, so this looks like a very simple port. And then we can remove a bunch of annoying imports. :) I thought this also unlocks the named format string stuff, but it seems that works on all editions except for that problem around `panic!`. Whatever. ;)
2 parents c568f32 + 507c09f commit a4a667b

17 files changed

+8
-25
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "miri"
66
repository = "https://github.com/rust-lang/miri"
77
version = "0.1.0"
88
default-run = "miri"
9-
edition = "2018"
9+
edition = "2021"
1010

1111
[lib]
1212
test = true # we have unit tests

cargo-miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = "MIT OR Apache-2.0"
55
name = "cargo-miri"
66
repository = "https://github.com/rust-lang/miri"
77
version = "0.1.0"
8-
edition = "2018"
8+
edition = "2021"
99

1010
[[bin]]
1111
name = "cargo-miri"

src/bin/miri.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ extern crate rustc_metadata;
99
extern crate rustc_middle;
1010
extern crate rustc_session;
1111

12-
use std::convert::TryFrom;
1312
use std::env;
1413
use std::num::NonZeroU64;
1514
use std::path::PathBuf;

src/diagnostics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
414414
)
415415
}
416416
},
417-
CreatedCallId(id) => format!("function call with id {}", id),
418-
CreatedAlloc(AllocId(id)) => format!("created allocation with id {}", id),
419-
FreedAlloc(AllocId(id)) => format!("freed allocation with id {}", id),
417+
CreatedCallId(id) => format!("function call with id {id}"),
418+
CreatedAlloc(AllocId(id)) => format!("created allocation with id {id}"),
419+
FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"),
420420
RejectedIsolatedOp(ref op) =>
421-
format!("{} was made to return an error due to isolation", op),
421+
format!("{op} was made to return an error due to isolation"),
422422
};
423423

424424
let (title, diag_level) = match e {

src/eval.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Main evaluator loop and setting up the initial stack frame.
22
3-
use std::convert::TryFrom;
43
use std::ffi::OsStr;
54
use std::iter;
65

src/helpers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::convert::{TryFrom, TryInto};
21
use std::mem;
32
use std::num::NonZeroUsize;
43
use std::time::Duration;

src/shims/backtrace.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use rustc_middle::ty::layout::LayoutOf as _;
44
use rustc_middle::ty::{self, Instance};
55
use rustc_span::{BytePos, Loc, Symbol};
66
use rustc_target::{abi::Size, spec::abi::Abi};
7-
use std::convert::TryInto as _;
87

98
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
109
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {

src/shims/env.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::convert::TryFrom;
21
use std::env;
32
use std::ffi::{OsStr, OsString};
43
use std::io::ErrorKind;

src/shims/foreign_items.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
use std::{
2-
collections::hash_map::Entry,
3-
convert::{TryFrom, TryInto},
4-
iter,
5-
};
1+
use std::{collections::hash_map::Entry, iter};
62

73
use log::trace;
84

src/shims/intrinsics.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::convert::TryInto;
21
use std::iter;
32

43
use log::trace;

src/shims/os_str.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::borrow::Cow;
2-
use std::convert::TryFrom;
32
use std::ffi::{OsStr, OsString};
43
use std::iter;
54
use std::path::{Path, PathBuf};

src/shims/posix/fs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::borrow::Cow;
22
use std::collections::BTreeMap;
3-
use std::convert::{TryFrom, TryInto};
43
use std::fs::{
54
read_dir, remove_dir, remove_file, rename, DirBuilder, File, FileType, OpenOptions, ReadDir,
65
};

src/shims/posix/thread.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::convert::TryInto;
2-
31
use crate::*;
42
use rustc_middle::ty::layout::LayoutOf;
53
use rustc_target::spec::abi::Abi;

src/shims/time.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::convert::TryFrom;
21
use std::time::{Duration, Instant, SystemTime};
32

43
use crate::*;

src/sync.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use std::collections::{hash_map::Entry, HashMap, VecDeque};
2-
use std::convert::TryFrom;
32
use std::num::NonZeroU32;
43
use std::ops::Not;
54

src/thread.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
33
use std::cell::RefCell;
44
use std::collections::hash_map::Entry;
5-
use std::convert::TryFrom;
65
use std::num::TryFromIntError;
76
use std::time::{Duration, Instant, SystemTime};
87

src/vector_clock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_index::vec::Idx;
22
use smallvec::SmallVec;
3-
use std::{cmp::Ordering, convert::TryFrom, fmt::Debug, ops::Index};
3+
use std::{cmp::Ordering, fmt::Debug, ops::Index};
44

55
/// A vector clock index, this is associated with a thread id
66
/// but in some cases one vector index may be shared with

0 commit comments

Comments
 (0)