Skip to content

Commit

Permalink
Auto merge of #2061 - RalfJung:edition, r=RalfJung
Browse files Browse the repository at this point in the history
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. ;)
  • Loading branch information
bors committed Apr 9, 2022
2 parents c568f32 + 507c09f commit a4a667b
Show file tree
Hide file tree
Showing 17 changed files with 8 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name = "miri"
repository = "https://github.com/rust-lang/miri"
version = "0.1.0"
default-run = "miri"
edition = "2018"
edition = "2021"

[lib]
test = true # we have unit tests
Expand Down
2 changes: 1 addition & 1 deletion cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "MIT OR Apache-2.0"
name = "cargo-miri"
repository = "https://github.com/rust-lang/miri"
version = "0.1.0"
edition = "2018"
edition = "2021"

[[bin]]
name = "cargo-miri"
Expand Down
1 change: 0 additions & 1 deletion src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ extern crate rustc_metadata;
extern crate rustc_middle;
extern crate rustc_session;

use std::convert::TryFrom;
use std::env;
use std::num::NonZeroU64;
use std::path::PathBuf;
Expand Down
8 changes: 4 additions & 4 deletions src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
)
}
},
CreatedCallId(id) => format!("function call with id {}", id),
CreatedAlloc(AllocId(id)) => format!("created allocation with id {}", id),
FreedAlloc(AllocId(id)) => format!("freed allocation with id {}", id),
CreatedCallId(id) => format!("function call with id {id}"),
CreatedAlloc(AllocId(id)) => format!("created allocation with id {id}"),
FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"),
RejectedIsolatedOp(ref op) =>
format!("{} was made to return an error due to isolation", op),
format!("{op} was made to return an error due to isolation"),
};

let (title, diag_level) = match e {
Expand Down
1 change: 0 additions & 1 deletion src/eval.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Main evaluator loop and setting up the initial stack frame.
use std::convert::TryFrom;
use std::ffi::OsStr;
use std::iter;

Expand Down
1 change: 0 additions & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::{TryFrom, TryInto};
use std::mem;
use std::num::NonZeroUsize;
use std::time::Duration;
Expand Down
1 change: 0 additions & 1 deletion src/shims/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use rustc_middle::ty::layout::LayoutOf as _;
use rustc_middle::ty::{self, Instance};
use rustc_span::{BytePos, Loc, Symbol};
use rustc_target::{abi::Size, spec::abi::Abi};
use std::convert::TryInto as _;

impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
Expand Down
1 change: 0 additions & 1 deletion src/shims/env.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::env;
use std::ffi::{OsStr, OsString};
use std::io::ErrorKind;
Expand Down
6 changes: 1 addition & 5 deletions src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
use std::{
collections::hash_map::Entry,
convert::{TryFrom, TryInto},
iter,
};
use std::{collections::hash_map::Entry, iter};

use log::trace;

Expand Down
1 change: 0 additions & 1 deletion src/shims/intrinsics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryInto;
use std::iter;

use log::trace;
Expand Down
1 change: 0 additions & 1 deletion src/shims/os_str.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::borrow::Cow;
use std::convert::TryFrom;
use std::ffi::{OsStr, OsString};
use std::iter;
use std::path::{Path, PathBuf};
Expand Down
1 change: 0 additions & 1 deletion src/shims/posix/fs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::convert::{TryFrom, TryInto};
use std::fs::{
read_dir, remove_dir, remove_file, rename, DirBuilder, File, FileType, OpenOptions, ReadDir,
};
Expand Down
2 changes: 0 additions & 2 deletions src/shims/posix/thread.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::TryInto;

use crate::*;
use rustc_middle::ty::layout::LayoutOf;
use rustc_target::spec::abi::Abi;
Expand Down
1 change: 0 additions & 1 deletion src/shims/time.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::time::{Duration, Instant, SystemTime};

use crate::*;
Expand Down
1 change: 0 additions & 1 deletion src/sync.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::collections::{hash_map::Entry, HashMap, VecDeque};
use std::convert::TryFrom;
use std::num::NonZeroU32;
use std::ops::Not;

Expand Down
1 change: 0 additions & 1 deletion src/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
use std::cell::RefCell;
use std::collections::hash_map::Entry;
use std::convert::TryFrom;
use std::num::TryFromIntError;
use std::time::{Duration, Instant, SystemTime};

Expand Down
2 changes: 1 addition & 1 deletion src/vector_clock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustc_index::vec::Idx;
use smallvec::SmallVec;
use std::{cmp::Ordering, convert::TryFrom, fmt::Debug, ops::Index};
use std::{cmp::Ordering, fmt::Debug, ops::Index};

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

0 comments on commit a4a667b

Please sign in to comment.