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. ;)
This commit is contained in:
bors 2022-04-09 16:45:09 +00:00
commit a4a667b3ce
17 changed files with 8 additions and 25 deletions

View File

@ -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

View File

@ -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"

View File

@ -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;

View File

@ -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 {

View File

@ -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;

View File

@ -1,4 +1,3 @@
use std::convert::{TryFrom, TryInto};
use std::mem;
use std::num::NonZeroUsize;
use std::time::Duration;

View File

@ -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> {

View File

@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::env;
use std::ffi::{OsStr, OsString};
use std::io::ErrorKind;

View File

@ -1,8 +1,4 @@
use std::{
collections::hash_map::Entry,
convert::{TryFrom, TryInto},
iter,
};
use std::{collections::hash_map::Entry, iter};
use log::trace;

View File

@ -1,4 +1,3 @@
use std::convert::TryInto;
use std::iter;
use log::trace;

View File

@ -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};

View File

@ -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,
};

View File

@ -1,5 +1,3 @@
use std::convert::TryInto;
use crate::*;
use rustc_middle::ty::layout::LayoutOf;
use rustc_target::spec::abi::Abi;

View File

@ -1,4 +1,3 @@
use std::convert::TryFrom;
use std::time::{Duration, Instant, SystemTime};
use crate::*;

View File

@ -1,5 +1,4 @@
use std::collections::{hash_map::Entry, HashMap, VecDeque};
use std::convert::TryFrom;
use std::num::NonZeroU32;
use std::ops::Not;

View File

@ -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};

View File

@ -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