librustc_mir => 2018

This commit is contained in:
Taiki Endo 2019-02-08 06:28:15 +09:00
parent 626e74d5f6
commit 725af30809
110 changed files with 512 additions and 503 deletions

View File

@ -2,6 +2,7 @@
authors = ["The Rust Project Developers"]
name = "rustc_mir"
version = "0.0.0"
edition = "2018"
[lib]
name = "rustc_mir"
@ -12,7 +13,7 @@ crate-type = ["dylib"]
arena = { path = "../libarena" }
bitflags = "1.0"
either = "1.5.0"
graphviz = { path = "../libgraphviz" }
dot = { path = "../libgraphviz", package = "graphviz" }
log = "0.4"
log_settings = "0.1.1"
polonius-engine = "0.6.2"

View File

@ -1,7 +1,7 @@
use borrow_check::place_ext::PlaceExt;
use borrow_check::nll::ToRegionVid;
use dataflow::indexes::BorrowIndex;
use dataflow::move_paths::MoveData;
use crate::borrow_check::place_ext::PlaceExt;
use crate::borrow_check::nll::ToRegionVid;
use crate::dataflow::indexes::BorrowIndex;
use crate::dataflow::move_paths::MoveData;
use rustc::mir::traversal;
use rustc::mir::visit::{
PlaceContext, Visitor, NonUseContext, MutatingUseContext, NonMutatingUseContext
@ -72,7 +72,7 @@ crate struct BorrowData<'tcx> {
}
impl<'tcx> fmt::Display for BorrowData<'tcx> {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
let kind = match self.kind {
mir::BorrowKind::Shared => "",
mir::BorrowKind::Shallow => "shallow ",

View File

@ -1,7 +1,7 @@
use borrow_check::nll::explain_borrow::BorrowExplanation;
use borrow_check::nll::region_infer::{RegionName, RegionNameSource};
use borrow_check::prefixes::IsPrefixOf;
use borrow_check::WriteKind;
use crate::borrow_check::nll::explain_borrow::BorrowExplanation;
use crate::borrow_check::nll::region_infer::{RegionName, RegionNameSource};
use crate::borrow_check::prefixes::IsPrefixOf;
use crate::borrow_check::WriteKind;
use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc::middle::region::ScopeTree;
@ -22,10 +22,10 @@ use syntax_pos::Span;
use super::borrow_set::BorrowData;
use super::{Context, MirBorrowckCtxt};
use super::{InitializationRequiringAction, PrefixSet};
use dataflow::drop_flag_effects;
use dataflow::move_paths::indexes::MoveOutIndex;
use dataflow::move_paths::MovePathIndex;
use util::borrowck_errors::{BorrowckErrors, Origin};
use crate::dataflow::drop_flag_effects;
use crate::dataflow::move_paths::indexes::MoveOutIndex;
use crate::dataflow::move_paths::MovePathIndex;
use crate::util::borrowck_errors::{BorrowckErrors, Origin};
#[derive(Debug)]
struct MoveSite {
@ -1726,7 +1726,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
}
/// End-user visible description of the `field`nth field of `base`
fn describe_field(&self, base: &Place, field: Field) -> String {
fn describe_field(&self, base: &Place<'_>, field: Field) -> String {
match *base {
Place::Local(local) => {
let local = &self.mir.local_decls[local];
@ -1751,7 +1751,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
}
/// End-user visible description of the `field_index`nth field of `ty`
fn describe_field_from_ty(&self, ty: &ty::Ty, field: Field) -> String {
fn describe_field_from_ty(&self, ty: &ty::Ty<'_>, field: Field) -> String {
if ty.is_box() {
// If the type is a box, the field is described from the boxed type
self.describe_field_from_ty(&ty.boxed_ty(), field)
@ -1860,7 +1860,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
fn annotate_argument_and_return_for_borrow(
&self,
borrow: &BorrowData<'tcx>,
) -> Option<AnnotatedBorrowFnSignature> {
) -> Option<AnnotatedBorrowFnSignature<'_>> {
// Define a fallback for when we can't match a closure.
let fallback = || {
let is_closure = self.infcx.tcx.is_closure(self.mir_def_id);
@ -2081,7 +2081,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
&self,
did: DefId,
sig: ty::PolyFnSig<'tcx>,
) -> Option<AnnotatedBorrowFnSignature> {
) -> Option<AnnotatedBorrowFnSignature<'_>> {
debug!("annotate_fn_sig: did={:?} sig={:?}", did, sig);
let is_closure = self.infcx.tcx.is_closure(did);
let fn_node_id = self.infcx.tcx.hir().as_local_node_id(did)?;
@ -2368,14 +2368,22 @@ impl UseSpans {
}
// Add a span label to the arguments of the closure, if it exists.
pub(super) fn args_span_label(self, err: &mut DiagnosticBuilder, message: impl Into<String>) {
pub(super) fn args_span_label(
self,
err: &mut DiagnosticBuilder<'_>,
message: impl Into<String>,
) {
if let UseSpans::ClosureUse { args_span, .. } = self {
err.span_label(args_span, message);
}
}
// Add a span label to the use of the captured variable, if it exists.
pub(super) fn var_span_label(self, err: &mut DiagnosticBuilder, message: impl Into<String>) {
pub(super) fn var_span_label(
self,
err: &mut DiagnosticBuilder<'_>,
message: impl Into<String>,
) {
if let UseSpans::ClosureUse { var_span, .. } = self {
err.span_label(var_span, message);
}
@ -2563,7 +2571,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
/// Helper to retrieve span(s) of given borrow from the current MIR
/// representation
pub(super) fn retrieve_borrow_spans(&self, borrow: &BorrowData) -> UseSpans {
pub(super) fn retrieve_borrow_spans(&self, borrow: &BorrowData<'_>) -> UseSpans {
let span = self.mir.source_info(borrow.reserve_location).span;
self.borrow_spans(span, borrow.reserve_location)
}

View File

@ -7,16 +7,16 @@ use rustc::mir::{BasicBlock, Location};
use rustc::ty::RegionVid;
use rustc_data_structures::bit_set::BitIter;
use borrow_check::location::LocationIndex;
use crate::borrow_check::location::LocationIndex;
use polonius_engine::Output;
use dataflow::move_paths::indexes::BorrowIndex;
use dataflow::move_paths::HasMoveData;
use dataflow::Borrows;
use dataflow::EverInitializedPlaces;
use dataflow::{FlowAtLocation, FlowsAtLocation};
use dataflow::MaybeUninitializedPlaces;
use crate::dataflow::move_paths::indexes::BorrowIndex;
use crate::dataflow::move_paths::HasMoveData;
use crate::dataflow::Borrows;
use crate::dataflow::EverInitializedPlaces;
use crate::dataflow::{FlowAtLocation, FlowsAtLocation};
use crate::dataflow::MaybeUninitializedPlaces;
use either::Either;
use std::fmt;
use std::rc::Rc;
@ -57,7 +57,7 @@ impl<'b, 'gcx, 'tcx> Flows<'b, 'gcx, 'tcx> {
}
}
crate fn with_outgoing_borrows(&self, op: impl FnOnce(BitIter<BorrowIndex>)) {
crate fn with_outgoing_borrows(&self, op: impl FnOnce(BitIter<'_, BorrowIndex>)) {
self.borrows.with_iter_outgoing(op)
}
}
@ -93,7 +93,7 @@ impl<'b, 'gcx, 'tcx> FlowsAtLocation for Flows<'b, 'gcx, 'tcx> {
}
impl<'b, 'gcx, 'tcx> fmt::Display for Flows<'b, 'gcx, 'tcx> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut s = String::new();
s.push_str("borrows in effect: [");

View File

@ -1,6 +1,6 @@
//! This query borrow-checks the MIR to (further) ensure it is not broken.
use borrow_check::nll::region_infer::RegionInferenceContext;
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use rustc::hir;
use rustc::hir::Node;
use rustc::hir::def_id::DefId;
@ -25,16 +25,16 @@ use std::collections::BTreeMap;
use syntax_pos::Span;
use dataflow::indexes::{BorrowIndex, InitIndex, MoveOutIndex, MovePathIndex};
use dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MoveError};
use dataflow::Borrows;
use dataflow::DataflowResultsConsumer;
use dataflow::FlowAtLocation;
use dataflow::MoveDataParamEnv;
use dataflow::{do_dataflow, DebugFormatted};
use dataflow::EverInitializedPlaces;
use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use util::borrowck_errors::{BorrowckErrors, Origin};
use crate::dataflow::indexes::{BorrowIndex, InitIndex, MoveOutIndex, MovePathIndex};
use crate::dataflow::move_paths::{HasMoveData, LookupResult, MoveData, MoveError};
use crate::dataflow::Borrows;
use crate::dataflow::DataflowResultsConsumer;
use crate::dataflow::FlowAtLocation;
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::{do_dataflow, DebugFormatted};
use crate::dataflow::EverInitializedPlaces;
use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use crate::util::borrowck_errors::{BorrowckErrors, Origin};
use self::borrow_set::{BorrowData, BorrowSet};
use self::flows::Flows;
@ -59,7 +59,7 @@ mod used_muts;
pub(crate) mod nll;
pub fn provide(providers: &mut Providers) {
pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
mir_borrowck,
..*providers
@ -108,7 +108,7 @@ fn mir_borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> BorrowC
}
let opt_closure_req = tcx.infer_ctxt().enter(|infcx| {
let input_mir: &Mir = &input_mir.borrow();
let input_mir: &Mir<'_> = &input_mir.borrow();
do_mir_borrowck(&infcx, input_mir, def_id)
});
debug!("mir_borrowck done");

View File

@ -6,13 +6,13 @@ use rustc::ty;
use rustc_errors::{DiagnosticBuilder,Applicability};
use syntax_pos::Span;
use borrow_check::MirBorrowckCtxt;
use borrow_check::prefixes::PrefixSet;
use dataflow::move_paths::{
use crate::borrow_check::MirBorrowckCtxt;
use crate::borrow_check::prefixes::PrefixSet;
use crate::dataflow::move_paths::{
IllegalMoveOrigin, IllegalMoveOriginKind, InitLocation,
LookupResult, MoveError, MovePathIndex,
};
use util::borrowck_errors::{BorrowckErrors, Origin};
use crate::util::borrowck_errors::{BorrowckErrors, Origin};
// Often when desugaring a pattern match we may have many individual moves in
// MIR that are all part of one operation from the user's point-of-view. For
@ -63,7 +63,7 @@ enum BorrowedContentSource {
}
impl Display for BorrowedContentSource {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
BorrowedContentSource::Arc => write!(f, "an `Arc`"),
BorrowedContentSource::Rc => write!(f, "an `Rc`"),
@ -240,7 +240,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
fn report(&mut self, error: GroupedMoveError<'tcx>) {
let (mut err, err_span) = {
let (span, original_path, kind): (Span, &Place<'tcx>, &IllegalMoveOriginKind) =
let (span, original_path, kind): (Span, &Place<'tcx>, &IllegalMoveOriginKind<'_>) =
match error {
GroupedMoveError::MovesFromPlace {
span,

View File

@ -8,11 +8,11 @@ use rustc_data_structures::indexed_vec::Idx;
use syntax_pos::Span;
use syntax_pos::symbol::keywords;
use dataflow::move_paths::InitLocation;
use borrow_check::MirBorrowckCtxt;
use util::borrowck_errors::{BorrowckErrors, Origin};
use util::collect_writes::FindAssignments;
use util::suggest_ref_mut;
use crate::dataflow::move_paths::InitLocation;
use crate::borrow_check::MirBorrowckCtxt;
use crate::util::borrowck_errors::{BorrowckErrors, Origin};
use crate::util::collect_writes::FindAssignments;
use crate::util::suggest_ref_mut;
use rustc_errors::Applicability;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
@ -611,7 +611,7 @@ fn suggest_ampmut<'cx, 'gcx, 'tcx>(
})
}
fn is_closure_or_generator(ty: ty::Ty) -> bool {
fn is_closure_or_generator(ty: ty::Ty<'_>) -> bool {
ty.is_closure() || ty.is_generator()
}

View File

@ -1,8 +1,8 @@
use borrow_check::borrow_set::BorrowSet;
use borrow_check::location::LocationTable;
use borrow_check::nll::ToRegionVid;
use borrow_check::nll::facts::AllFacts;
use borrow_check::nll::region_infer::values::LivenessValues;
use crate::borrow_check::borrow_set::BorrowSet;
use crate::borrow_check::location::LocationTable;
use crate::borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::facts::AllFacts;
use crate::borrow_check::nll::region_infer::values::LivenessValues;
use rustc::infer::InferCtxt;
use rustc::mir::visit::TyContext;
use rustc::mir::visit::Visitor;

View File

@ -1,6 +1,6 @@
use borrow_check::nll::type_check::Locations;
use borrow_check::nll::constraints::ConstraintIndex;
use borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
use crate::borrow_check::nll::type_check::Locations;
use crate::borrow_check::nll::constraints::ConstraintIndex;
use crate::borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
use rustc::mir::ConstraintCategory;
use rustc::ty::RegionVid;
use rustc_data_structures::graph;

View File

@ -2,7 +2,7 @@ use rustc::mir::ConstraintCategory;
use rustc::ty::RegionVid;
use rustc_data_structures::graph::scc::Sccs;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use borrow_check::nll::type_check::Locations;
use crate::borrow_check::nll::type_check::Locations;
use std::fmt;
use std::ops::Deref;
@ -84,7 +84,7 @@ pub struct OutlivesConstraint {
}
impl fmt::Debug for OutlivesConstraint {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
formatter,
"({:?}: {:?}) due to {:?}",

View File

@ -1,13 +1,13 @@
use std::collections::VecDeque;
use std::rc::Rc;
use borrow_check::nll::region_infer::{Cause, RegionInferenceContext};
use borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::region_infer::{Cause, RegionInferenceContext};
use crate::borrow_check::nll::ToRegionVid;
use crate::util::liveness::{self, DefUse};
use rustc::mir::visit::{MirVisitable, PlaceContext, Visitor};
use rustc::mir::{Local, Location, Mir};
use rustc::ty::{RegionVid, TyCtxt};
use rustc_data_structures::fx::FxHashSet;
use util::liveness::{self, DefUse};
crate fn find<'tcx>(
mir: &Mir<'tcx>,

View File

@ -1,8 +1,8 @@
use borrow_check::borrow_set::BorrowData;
use borrow_check::error_reporting::UseSpans;
use borrow_check::nll::ConstraintDescription;
use borrow_check::nll::region_infer::{Cause, RegionName};
use borrow_check::{Context, MirBorrowckCtxt, WriteKind};
use crate::borrow_check::borrow_set::BorrowData;
use crate::borrow_check::error_reporting::UseSpans;
use crate::borrow_check::nll::ConstraintDescription;
use crate::borrow_check::nll::region_infer::{Cause, RegionName};
use crate::borrow_check::{Context, MirBorrowckCtxt, WriteKind};
use rustc::ty::{self, TyCtxt};
use rustc::mir::{
CastKind, ConstraintCategory, FakeReadCause, Local, Location, Mir, Operand,
@ -14,7 +14,7 @@ use syntax_pos::Span;
mod find_use;
pub(in borrow_check) enum BorrowExplanation {
pub(in crate::borrow_check) enum BorrowExplanation {
UsedLater(LaterUseKind, Span),
UsedLaterInLoop(LaterUseKind, Span),
UsedLaterWhenDropped {
@ -33,7 +33,7 @@ pub(in borrow_check) enum BorrowExplanation {
}
#[derive(Clone, Copy)]
pub(in borrow_check) enum LaterUseKind {
pub(in crate::borrow_check) enum LaterUseKind {
TraitCapture,
ClosureCapture,
Call,
@ -42,13 +42,13 @@ pub(in borrow_check) enum LaterUseKind {
}
impl BorrowExplanation {
pub(in borrow_check) fn is_explained(&self) -> bool {
pub(in crate::borrow_check) fn is_explained(&self) -> bool {
match self {
BorrowExplanation::Unexplained => false,
_ => true,
}
}
pub(in borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>(
pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'cx, 'gcx, 'tcx>(
&self,
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
mir: &Mir<'tcx>,
@ -187,7 +187,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
/// - second half is the place being accessed
///
/// [d]: https://rust-lang.github.io/rfcs/2094-nll.html#leveraging-intuition-framing-errors-in-terms-of-points
pub(in borrow_check) fn explain_why_borrow_contains_point(
pub(in crate::borrow_check) fn explain_why_borrow_contains_point(
&self,
context: Context,
borrow: &BorrowData<'tcx>,

View File

@ -1,5 +1,5 @@
use borrow_check::location::{LocationIndex, LocationTable};
use dataflow::indexes::BorrowIndex;
use crate::borrow_check::location::{LocationIndex, LocationTable};
use crate::dataflow::indexes::BorrowIndex;
use polonius_engine::AllFacts as PoloniusAllFacts;
use polonius_engine::Atom;
use rustc::ty::{RegionVid, TyCtxt};

View File

@ -1,15 +1,15 @@
use borrow_check::borrow_set::BorrowSet;
use borrow_check::location::LocationTable;
use borrow_check::{JustWrite, WriteAndRead};
use borrow_check::{AccessDepth, Deep, Shallow};
use borrow_check::{ReadOrWrite, Activation, Read, Reservation, Write};
use borrow_check::{Context, ContextKind};
use borrow_check::{LocalMutationIsAllowed, MutateMode};
use borrow_check::ArtificialField;
use borrow_check::{ReadKind, WriteKind};
use borrow_check::nll::facts::AllFacts;
use borrow_check::path_utils::*;
use dataflow::move_paths::indexes::BorrowIndex;
use crate::borrow_check::borrow_set::BorrowSet;
use crate::borrow_check::location::LocationTable;
use crate::borrow_check::{JustWrite, WriteAndRead};
use crate::borrow_check::{AccessDepth, Deep, Shallow};
use crate::borrow_check::{ReadOrWrite, Activation, Read, Reservation, Write};
use crate::borrow_check::{Context, ContextKind};
use crate::borrow_check::{LocalMutationIsAllowed, MutateMode};
use crate::borrow_check::ArtificialField;
use crate::borrow_check::{ReadKind, WriteKind};
use crate::borrow_check::nll::facts::AllFacts;
use crate::borrow_check::path_utils::*;
use crate::dataflow::move_paths::indexes::BorrowIndex;
use rustc::ty::TyCtxt;
use rustc::mir::visit::Visitor;
use rustc::mir::{BasicBlock, Location, Mir, Place, Rvalue};

View File

@ -1,13 +1,14 @@
use borrow_check::borrow_set::BorrowSet;
use borrow_check::location::{LocationIndex, LocationTable};
use borrow_check::nll::facts::AllFactsExt;
use borrow_check::nll::type_check::{MirTypeckResults, MirTypeckRegionConstraints};
use borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap;
use borrow_check::nll::region_infer::values::RegionValueElements;
use dataflow::indexes::BorrowIndex;
use dataflow::move_paths::MoveData;
use dataflow::FlowAtLocation;
use dataflow::MaybeInitializedPlaces;
use crate::borrow_check::borrow_set::BorrowSet;
use crate::borrow_check::location::{LocationIndex, LocationTable};
use crate::borrow_check::nll::facts::AllFactsExt;
use crate::borrow_check::nll::type_check::{MirTypeckResults, MirTypeckRegionConstraints};
use crate::borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap;
use crate::borrow_check::nll::region_infer::values::RegionValueElements;
use crate::dataflow::indexes::BorrowIndex;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::FlowAtLocation;
use crate::dataflow::MaybeInitializedPlaces;
use crate::transform::MirSource;
use rustc::hir::def_id::DefId;
use rustc::infer::InferCtxt;
use rustc::mir::{ClosureOutlivesSubject, ClosureRegionRequirements, Mir};
@ -19,12 +20,11 @@ use std::io;
use std::path::PathBuf;
use std::rc::Rc;
use std::str::FromStr;
use transform::MirSource;
use self::mir_util::PassWhere;
use polonius_engine::{Algorithm, Output};
use util as mir_util;
use util::pretty;
use crate::util as mir_util;
use crate::util::pretty;
mod constraint_generation;
pub mod explain_borrow;
@ -45,7 +45,7 @@ use self::universal_regions::UniversalRegions;
/// scraping out the set of universal regions (e.g., region parameters)
/// declared on the function. That set will need to be given to
/// `compute_regions`.
pub(in borrow_check) fn replace_regions_in_mir<'cx, 'gcx, 'tcx>(
pub(in crate::borrow_check) fn replace_regions_in_mir<'cx, 'gcx, 'tcx>(
infcx: &InferCtxt<'cx, 'gcx, 'tcx>,
def_id: DefId,
param_env: ty::ParamEnv<'tcx>,
@ -68,7 +68,7 @@ pub(in borrow_check) fn replace_regions_in_mir<'cx, 'gcx, 'tcx>(
/// Computes the (non-lexical) regions from the input MIR.
///
/// This may result in errors being reported.
pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
pub(in crate::borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>(
infcx: &InferCtxt<'cx, 'gcx, 'tcx>,
def_id: DefId,
universal_regions: UniversalRegions<'tcx>,
@ -211,8 +211,8 @@ fn dump_mir_results<'a, 'gcx, 'tcx>(
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
source: MirSource,
mir: &Mir<'tcx>,
regioncx: &RegionInferenceContext,
closure_region_requirements: &Option<ClosureRegionRequirements>,
regioncx: &RegionInferenceContext<'_>,
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
) {
if !mir_util::dump_enabled(infcx.tcx, "nll", source) {
return;
@ -273,7 +273,7 @@ fn dump_annotation<'a, 'gcx, 'tcx>(
mir: &Mir<'tcx>,
mir_def_id: DefId,
regioncx: &RegionInferenceContext<'tcx>,
closure_region_requirements: &Option<ClosureRegionRequirements>,
closure_region_requirements: &Option<ClosureRegionRequirements<'_>>,
errors_buffer: &mut Vec<Diagnostic>,
) {
let tcx = infcx.tcx;
@ -322,7 +322,7 @@ fn dump_annotation<'a, 'gcx, 'tcx>(
}
fn for_each_region_constraint(
closure_region_requirements: &ClosureRegionRequirements,
closure_region_requirements: &ClosureRegionRequirements<'_>,
with_msg: &mut dyn FnMut(&str) -> io::Result<()>,
) -> io::Result<()> {
for req in &closure_region_requirements.outlives_requirements {

View File

@ -1,8 +1,9 @@
use borrow_check::nll::constraints::OutlivesConstraint;
use borrow_check::nll::region_infer::RegionInferenceContext;
use borrow_check::nll::type_check::Locations;
use borrow_check::nll::universal_regions::DefiningTy;
use borrow_check::nll::ConstraintDescription;
use crate::borrow_check::nll::constraints::OutlivesConstraint;
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use crate::borrow_check::nll::type_check::Locations;
use crate::borrow_check::nll::universal_regions::DefiningTy;
use crate::borrow_check::nll::ConstraintDescription;
use crate::util::borrowck_errors::{BorrowckErrors, Origin};
use rustc::hir::def_id::DefId;
use rustc::infer::error_reporting::nice_region_error::NiceRegionError;
use rustc::infer::InferCtxt;
@ -15,7 +16,6 @@ use std::collections::VecDeque;
use syntax::errors::Applicability;
use syntax::symbol::keywords;
use syntax_pos::Span;
use util::borrowck_errors::{BorrowckErrors, Origin};
mod region_name;
mod var_name;

View File

@ -1,7 +1,7 @@
use std::fmt::{self, Display};
use borrow_check::nll::region_infer::RegionInferenceContext;
use borrow_check::nll::universal_regions::DefiningTy;
use borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use crate::borrow_check::nll::universal_regions::DefiningTy;
use crate::borrow_check::nll::ToRegionVid;
use rustc::hir;
use rustc::hir::def_id::DefId;
use rustc::infer::InferCtxt;
@ -109,7 +109,7 @@ impl RegionName {
}
impl Display for RegionName {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.name)
}
}

View File

@ -1,5 +1,5 @@
use borrow_check::nll::region_infer::RegionInferenceContext;
use borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use crate::borrow_check::nll::ToRegionVid;
use rustc::mir::{Local, Mir};
use rustc::ty::{RegionVid, TyCtxt};
use rustc_data_structures::indexed_vec::Idx;

View File

@ -3,8 +3,7 @@
//! data to rendered labels.
use super::*;
use borrow_check::nll::constraints::OutlivesConstraint;
use dot;
use crate::borrow_check::nll::constraints::OutlivesConstraint;
use std::borrow::Cow;
use std::io::{self, Write};

View File

@ -1,9 +1,11 @@
use super::universal_regions::UniversalRegions;
use borrow_check::nll::constraints::graph::NormalConstraintGraph;
use borrow_check::nll::constraints::{ConstraintSccIndex, ConstraintSet, OutlivesConstraint};
use borrow_check::nll::region_infer::values::{PlaceholderIndices, RegionElement, ToElementIndex};
use borrow_check::nll::type_check::free_region_relations::UniversalRegionRelations;
use borrow_check::nll::type_check::Locations;
use crate::borrow_check::nll::constraints::graph::NormalConstraintGraph;
use crate::borrow_check::nll::constraints::{ConstraintSccIndex, ConstraintSet, OutlivesConstraint};
use crate::borrow_check::nll::region_infer::values::{
PlaceholderIndices, RegionElement, ToElementIndex
};
use crate::borrow_check::nll::type_check::free_region_relations::UniversalRegionRelations;
use crate::borrow_check::nll::type_check::Locations;
use rustc::hir::def_id::DefId;
use rustc::infer::canonical::QueryRegionConstraint;
use rustc::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};

View File

@ -1,8 +1,8 @@
use borrow_check::nll::constraints::OutlivesConstraint;
use borrow_check::nll::region_infer::TypeTest;
use borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
use borrow_check::nll::universal_regions::UniversalRegions;
use borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::constraints::OutlivesConstraint;
use crate::borrow_check::nll::region_infer::TypeTest;
use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
use crate::borrow_check::nll::universal_regions::UniversalRegions;
use crate::borrow_check::nll::ToRegionVid;
use rustc::infer::canonical::QueryRegionConstraint;
use rustc::infer::outlives::env::RegionBoundPairs;
use rustc::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};

View File

@ -1,7 +1,7 @@
use borrow_check::nll::type_check::constraint_conversion;
use borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
use borrow_check::nll::universal_regions::UniversalRegions;
use borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::type_check::constraint_conversion;
use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
use crate::borrow_check::nll::universal_regions::UniversalRegions;
use crate::borrow_check::nll::ToRegionVid;
use rustc::infer::canonical::QueryRegionConstraint;
use rustc::infer::outlives::free_region_map::FreeRegionRelations;
use rustc::infer::region_constraints::GenericKind;

View File

@ -7,7 +7,7 @@
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
//! contain revealed `impl Trait` values).
use borrow_check::nll::universal_regions::UniversalRegions;
use crate::borrow_check::nll::universal_regions::UniversalRegions;
use rustc::infer::LateBoundRegionConversionTime;
use rustc::mir::*;
use rustc::ty::Ty;

View File

@ -6,13 +6,13 @@
//! liveness code so that it only operates over variables with regions in their
//! types, instead of all variables.
use borrow_check::nll::ToRegionVid;
use borrow_check::nll::facts::{AllFacts, AllFactsExt};
use crate::borrow_check::nll::ToRegionVid;
use crate::borrow_check::nll::facts::{AllFacts, AllFactsExt};
use crate::util::liveness::LiveVariableMap;
use rustc::mir::{Local, Mir};
use rustc::ty::{RegionVid, TyCtxt};
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use util::liveness::LiveVariableMap;
/// Map between Local and LiveVar indices: the purpose of this
/// map is to define the subset of local variables for which we need

View File

@ -1,10 +1,10 @@
use borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements};
use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
use crate::borrow_check::nll::region_infer::values::{PointIndex, RegionValueElements};
use crate::borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
use crate::util::liveness::{categorize, DefUse, LiveVariableMap};
use rustc::mir::visit::{PlaceContext, Visitor};
use rustc::mir::{Local, Location, Mir};
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use rustc_data_structures::vec_linked_list as vll;
use util::liveness::{categorize, DefUse, LiveVariableMap};
/// A map that cross references each local with the locations where it
/// is defined (assigned), used, or dropped. Used during liveness

View File

@ -1,11 +1,11 @@
use borrow_check::location::LocationTable;
use borrow_check::nll::region_infer::values::RegionValueElements;
use borrow_check::nll::constraints::ConstraintSet;
use borrow_check::nll::NllLivenessMap;
use borrow_check::nll::universal_regions::UniversalRegions;
use dataflow::move_paths::MoveData;
use dataflow::MaybeInitializedPlaces;
use dataflow::FlowAtLocation;
use crate::borrow_check::location::LocationTable;
use crate::borrow_check::nll::region_infer::values::RegionValueElements;
use crate::borrow_check::nll::constraints::ConstraintSet;
use crate::borrow_check::nll::NllLivenessMap;
use crate::borrow_check::nll::universal_regions::UniversalRegions;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::MaybeInitializedPlaces;
use crate::dataflow::FlowAtLocation;
use rustc::mir::Mir;
use rustc::ty::RegionVid;
use rustc_data_structures::fx::FxHashSet;

View File

@ -1,12 +1,13 @@
use borrow_check::location::LocationTable;
use borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements};
use borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
use borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap;
use borrow_check::nll::type_check::NormalizeLocation;
use borrow_check::nll::type_check::TypeChecker;
use dataflow::move_paths::indexes::MovePathIndex;
use dataflow::move_paths::MoveData;
use dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces};
use crate::borrow_check::location::LocationTable;
use crate::borrow_check::nll::region_infer::values::{self, PointIndex, RegionValueElements};
use crate::borrow_check::nll::type_check::liveness::liveness_map::{LiveVar, NllLivenessMap};
use crate::borrow_check::nll::type_check::liveness::local_use_map::LocalUseMap;
use crate::borrow_check::nll::type_check::NormalizeLocation;
use crate::borrow_check::nll::type_check::TypeChecker;
use crate::dataflow::move_paths::indexes::MovePathIndex;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces};
use crate::util::liveness::LiveVariableMap;
use rustc::infer::canonical::QueryRegionConstraint;
use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, Mir};
use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
@ -16,7 +17,6 @@ use rustc::ty::{Ty, TypeFoldable};
use rustc_data_structures::bit_set::HybridBitSet;
use rustc_data_structures::fx::FxHashMap;
use std::rc::Rc;
use util::liveness::LiveVariableMap;
/// This is the heart of the liveness computation. For each variable X
/// that requires a liveness computation, it walks over all the uses

View File

@ -2,24 +2,25 @@
#![allow(unreachable_code)]
use borrow_check::borrow_set::BorrowSet;
use borrow_check::location::LocationTable;
use borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
use borrow_check::nll::facts::AllFacts;
use borrow_check::nll::region_infer::values::LivenessValues;
use borrow_check::nll::region_infer::values::PlaceholderIndex;
use borrow_check::nll::region_infer::values::PlaceholderIndices;
use borrow_check::nll::region_infer::values::RegionValueElements;
use borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest};
use borrow_check::nll::renumber;
use borrow_check::nll::type_check::free_region_relations::{
use crate::borrow_check::borrow_set::BorrowSet;
use crate::borrow_check::location::LocationTable;
use crate::borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
use crate::borrow_check::nll::facts::AllFacts;
use crate::borrow_check::nll::region_infer::values::LivenessValues;
use crate::borrow_check::nll::region_infer::values::PlaceholderIndex;
use crate::borrow_check::nll::region_infer::values::PlaceholderIndices;
use crate::borrow_check::nll::region_infer::values::RegionValueElements;
use crate::borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest};
use crate::borrow_check::nll::renumber;
use crate::borrow_check::nll::type_check::free_region_relations::{
CreateResult, UniversalRegionRelations,
};
use borrow_check::nll::universal_regions::{DefiningTy, UniversalRegions};
use borrow_check::nll::ToRegionVid;
use dataflow::move_paths::MoveData;
use dataflow::FlowAtLocation;
use dataflow::MaybeInitializedPlaces;
use crate::borrow_check::nll::universal_regions::{DefiningTy, UniversalRegions};
use crate::borrow_check::nll::ToRegionVid;
use crate::dataflow::move_paths::MoveData;
use crate::dataflow::FlowAtLocation;
use crate::dataflow::MaybeInitializedPlaces;
use crate::transform::{MirPass, MirSource};
use either::Either;
use rustc::hir;
use rustc::hir::def_id::DefId;
@ -46,7 +47,6 @@ use rustc::ty::layout::VariantIdx;
use std::rc::Rc;
use std::{fmt, iter};
use syntax_pos::{Span, DUMMY_SP};
use transform::{MirPass, MirSource};
macro_rules! span_mirbug {
($context:expr, $elem:expr, $($message:tt)*) => ({
@ -210,7 +210,7 @@ fn type_check_internal<'a, 'gcx, 'tcx, R>(
extra(&mut checker)
}
fn translate_outlives_facts(cx: &mut BorrowCheckContext) {
fn translate_outlives_facts(cx: &mut BorrowCheckContext<'_, '_>) {
if let Some(facts) = cx.all_facts {
let location_table = cx.location_table;
facts
@ -235,7 +235,7 @@ fn translate_outlives_facts(cx: &mut BorrowCheckContext) {
}
}
fn mirbug(tcx: TyCtxt, span: Span, msg: &str) {
fn mirbug(tcx: TyCtxt<'_, '_, '_>, span: Span, msg: &str) {
// We sometimes see MIR failures (notably predicate failures) due to
// the fact that we check rvalue sized predicates here. So use `delay_span_bug`
// to avoid reporting bugs in those cases.
@ -266,7 +266,7 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> {
}
}
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext, location: Location) {
fn visit_place(&mut self, place: &Place<'tcx>, context: PlaceContext<'_>, location: Location) {
self.sanitize_place(place, location, context);
}
@ -447,7 +447,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> {
&mut self,
place: &Place<'tcx>,
location: Location,
context: PlaceContext,
context: PlaceContext<'_>,
) -> PlaceTy<'tcx> {
debug!("sanitize_place: {:?}", place);
let place_ty = match *place {

View File

@ -1,5 +1,5 @@
use borrow_check::nll::constraints::OutlivesConstraint;
use borrow_check::nll::type_check::{BorrowCheckContext, Locations};
use crate::borrow_check::nll::constraints::OutlivesConstraint;
use crate::borrow_check::nll::type_check::{BorrowCheckContext, Locations};
use rustc::infer::nll_relate::{TypeRelating, TypeRelatingDelegate, NormalizationStrategy};
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
use rustc::mir::ConstraintCategory;

View File

@ -1,8 +1,8 @@
use borrow_check::borrow_set::{BorrowSet, BorrowData, TwoPhaseActivation};
use borrow_check::places_conflict;
use borrow_check::Context;
use borrow_check::AccessDepth;
use dataflow::indexes::BorrowIndex;
use crate::borrow_check::borrow_set::{BorrowSet, BorrowData, TwoPhaseActivation};
use crate::borrow_check::places_conflict;
use crate::borrow_check::Context;
use crate::borrow_check::AccessDepth;
use crate::dataflow::indexes::BorrowIndex;
use rustc::mir::{BasicBlock, Location, Mir, Place};
use rustc::mir::{ProjectionElem, BorrowKind};
use rustc::ty::TyCtxt;

View File

@ -2,7 +2,7 @@ use rustc::hir;
use rustc::mir::ProjectionElem;
use rustc::mir::{Local, Mir, Place, Mutability};
use rustc::ty::{self, TyCtxt};
use borrow_check::borrow_set::LocalsStateAtExit;
use crate::borrow_check::borrow_set::LocalsStateAtExit;
/// Extension methods for the `Place` type.
crate trait PlaceExt<'tcx> {

View File

@ -1,6 +1,6 @@
use borrow_check::ArtificialField;
use borrow_check::Overlap;
use borrow_check::{Deep, Shallow, AccessDepth};
use crate::borrow_check::ArtificialField;
use crate::borrow_check::Overlap;
use crate::borrow_check::{Deep, Shallow, AccessDepth};
use rustc::hir;
use rustc::mir::{BorrowKind, Mir, Place};
use rustc::mir::{Projection, ProjectionElem};

View File

@ -3,7 +3,7 @@ use rustc::mir::{BasicBlock, Local, Location, Place, Statement, StatementKind, T
use rustc_data_structures::fx::FxHashSet;
use borrow_check::MirBorrowckCtxt;
use crate::borrow_check::MirBorrowckCtxt;
impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
/// Walks the MIR adding to the set of `used_mut` locals that will be ignored for the purposes

View File

@ -1,7 +1,7 @@
use build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use build::ForGuard::OutsideGuard;
use build::matches::ArmHasGuard;
use hair::*;
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use crate::build::ForGuard::OutsideGuard;
use crate::build::matches::ArmHasGuard;
use crate::hair::*;
use rustc::mir::*;
use rustc::hir;
use syntax_pos::Span;

View File

@ -1,6 +1,6 @@
//! Routines for manipulating the control-flow graph.
use build::CFG;
use crate::build::CFG;
use rustc::mir::*;
impl<'tcx> CFG<'tcx> {

View File

@ -1,7 +1,7 @@
//! See docs in build/expr/mod.rs
use build::Builder;
use hair::*;
use crate::build::Builder;
use crate::hair::*;
use rustc::mir::*;
use rustc::ty::CanonicalUserTypeAnnotation;

View File

@ -1,8 +1,8 @@
//! See docs in build/expr/mod.rs
use build::expr::category::Category;
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use crate::build::expr::category::Category;
use crate::build::{BlockAnd, BlockAndExtension, Builder};
use crate::hair::*;
use rustc::middle::region;
use rustc::mir::*;

View File

@ -1,9 +1,9 @@
//! See docs in build/expr/mod.rs
use build::expr::category::Category;
use build::ForGuard::{OutsideGuard, RefWithinGuard};
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use crate::build::expr::category::Category;
use crate::build::ForGuard::{OutsideGuard, RefWithinGuard};
use crate::build::{BlockAnd, BlockAndExtension, Builder};
use crate::hair::*;
use rustc::mir::interpret::EvalErrorKind::BoundsCheck;
use rustc::mir::*;
use rustc::ty::{CanonicalUserTypeAnnotation, Variance};

View File

@ -3,9 +3,9 @@
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use build::expr::category::{Category, RvalueFunc};
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use crate::build::expr::category::{Category, RvalueFunc};
use crate::build::{BlockAnd, BlockAndExtension, Builder};
use crate::hair::*;
use rustc::middle::region;
use rustc::mir::interpret::EvalErrorKind;
use rustc::mir::*;

View File

@ -1,7 +1,7 @@
//! See docs in build/expr/mod.rs
use build::{BlockAnd, BlockAndExtension, Builder};
use hair::*;
use crate::build::{BlockAnd, BlockAndExtension, Builder};
use crate::hair::*;
use rustc::middle::region;
use rustc::mir::*;

View File

@ -1,4 +1,4 @@
use hair::*;
use crate::hair::*;
#[derive(Debug, PartialEq)]
pub enum Category {

View File

@ -1,8 +1,8 @@
//! See docs in build/expr/mod.rs
use build::expr::category::{Category, RvalueFunc};
use build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use hair::*;
use crate::build::expr::category::{Category, RvalueFunc};
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use crate::hair::*;
use rustc::mir::*;
use rustc::ty;

View File

@ -1,6 +1,6 @@
use build::scope::BreakableScope;
use build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use hair::*;
use crate::build::scope::BreakableScope;
use crate::build::{BlockAnd, BlockAndExtension, BlockFrame, Builder};
use crate::hair::*;
use rustc::mir::*;
impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {

View File

@ -4,11 +4,11 @@
//! wrapped up as expressions (e.g., blocks). To make this ergonomic, we use this
//! latter `EvalInto` trait.
use build::{BlockAnd, Builder};
use hair::*;
use crate::build::{BlockAnd, Builder};
use crate::hair::*;
use rustc::mir::*;
pub(in build) trait EvalInto<'tcx> {
pub(in crate::build) trait EvalInto<'tcx> {
fn eval_into<'a, 'gcx>(self,
builder: &mut Builder<'a, 'gcx, 'tcx>,
destination: &Place<'tcx>,

View File

@ -3,11 +3,11 @@
//! includes the high-level algorithm, the submodules contain the
//! details.
use build::scope::{CachedBlock, DropKind};
use build::ForGuard::{self, OutsideGuard, RefWithinGuard, ValWithinGuard};
use build::{BlockAnd, BlockAndExtension, Builder};
use build::{GuardFrame, GuardFrameLocal, LocalsForNode};
use hair::*;
use crate::build::scope::{CachedBlock, DropKind};
use crate::build::ForGuard::{self, OutsideGuard, RefWithinGuard, ValWithinGuard};
use crate::build::{BlockAnd, BlockAndExtension, Builder};
use crate::build::{GuardFrame, GuardFrameLocal, LocalsForNode};
use crate::hair::*;
use rustc::mir::*;
use rustc::ty::{self, CanonicalUserTypeAnnotation, Ty};
use rustc::ty::layout::VariantIdx;

View File

@ -12,9 +12,9 @@
//! sort of test: for example, testing which variant an enum is, or
//! testing a value against a constant.
use build::Builder;
use build::matches::{Ascription, Binding, MatchPair, Candidate};
use hair::*;
use crate::build::Builder;
use crate::build::matches::{Ascription, Binding, MatchPair, Candidate};
use crate::hair::*;
use rustc::ty;
use rustc::ty::layout::{Integer, IntegerExt, Size};
use syntax::attr::{SignedInt, UnsignedInt};

View File

@ -5,10 +5,10 @@
// identify what tests are needed, perform the tests, and then filter
// the candidates based on the result.
use build::Builder;
use build::matches::{Candidate, MatchPair, Test, TestKind};
use hair::*;
use hair::pattern::compare_const_vals;
use crate::build::Builder;
use crate::build::matches::{Candidate, MatchPair, Test, TestKind};
use crate::hair::*;
use crate::hair::pattern::compare_const_vals;
use rustc_data_structures::bit_set::BitSet;
use rustc_data_structures::fx::FxHashMap;
use rustc::ty::{self, Ty};

View File

@ -1,6 +1,6 @@
use build::Builder;
use build::matches::MatchPair;
use hair::*;
use crate::build::Builder;
use crate::build::matches::MatchPair;
use crate::hair::*;
use rustc::mir::*;
use std::u32;
use std::convert::TryInto;

View File

@ -1,7 +1,7 @@
//! Miscellaneous builder routines that are not specific to building any particular
//! kind of thing.
use build::Builder;
use crate::build::Builder;
use rustc::ty::{self, Ty};

View File

@ -1,7 +1,10 @@
use build;
use build::scope::{CachedBlock, DropKind};
use hair::cx::Cx;
use hair::{LintLevel, BindingMode, PatternKind};
use crate::build;
use crate::build::scope::{CachedBlock, DropKind};
use crate::hair::cx::Cx;
use crate::hair::{LintLevel, BindingMode, PatternKind};
use crate::shim;
use crate::transform::MirSource;
use crate::util as mir_util;
use rustc::hir;
use rustc::hir::Node;
use rustc::hir::def_id::DefId;
@ -13,7 +16,6 @@ use rustc::ty::subst::Substs;
use rustc::util::nodemap::NodeMap;
use rustc_target::spec::PanicStrategy;
use rustc_data_structures::indexed_vec::{IndexVec, Idx};
use shim;
use std::mem;
use std::u32;
use rustc_target::spec::abi::Abi;
@ -21,8 +23,6 @@ use syntax::ast;
use syntax::attr::{self, UnwindAttr};
use syntax::symbol::keywords;
use syntax_pos::Span;
use transform::MirSource;
use util as mir_util;
use super::lints;
@ -161,7 +161,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t
};
globalizer.visit_mir(&mut mir);
let mir = unsafe {
mem::transmute::<Mir, Mir<'tcx>>(mir)
mem::transmute::<Mir<'_>, Mir<'tcx>>(mir)
};
mir_util::dump_mir(tcx, None, "mir_map", &0,
@ -241,7 +241,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
};
globalizer.visit_mir(&mut mir);
let mir = unsafe {
mem::transmute::<Mir, Mir<'tcx>>(mir)
mem::transmute::<Mir<'_>, Mir<'tcx>>(mir)
};
mir_util::dump_mir(tcx, None, "mir_map", &0,

View File

@ -77,8 +77,8 @@ should go to.
*/
use build::{BlockAnd, BlockAndExtension, Builder, CFG};
use hair::LintLevel;
use crate::build::{BlockAnd, BlockAndExtension, Builder, CFG};
use crate::hair::LintLevel;
use rustc::middle::region;
use rustc::ty::Ty;
use rustc::hir;

View File

@ -190,7 +190,7 @@ enum ConstEvalError {
}
impl fmt::Display for ConstEvalError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use self::ConstEvalError::*;
match *self {
NeedsRfc(ref msg) => {

View File

@ -4,8 +4,8 @@
use rustc::mir::{BasicBlock, Location};
use rustc_data_structures::bit_set::{BitIter, BitSet, HybridBitSet};
use dataflow::{BitDenotation, BlockSets, DataflowResults};
use dataflow::move_paths::{HasMoveData, MovePathIndex};
use crate::dataflow::{BitDenotation, BlockSets, DataflowResults};
use crate::dataflow::move_paths::{HasMoveData, MovePathIndex};
use std::iter;
@ -115,7 +115,7 @@ where
}
/// Returns an iterator over the elements present in the current state.
pub fn iter_incoming(&self) -> iter::Peekable<BitIter<BD::Idx>> {
pub fn iter_incoming(&self) -> iter::Peekable<BitIter<'_, BD::Idx>> {
self.curr_state.iter().peekable()
}
@ -124,7 +124,7 @@ where
/// Invokes `f` with an iterator over the resulting state.
pub fn with_iter_outgoing<F>(&self, f: F)
where
F: FnOnce(BitIter<BD::Idx>),
F: FnOnce(BitIter<'_, BD::Idx>),
{
let mut curr_state = self.curr_state.clone();
curr_state.union(&self.stmt_gen);

View File

@ -1,6 +1,6 @@
use rustc::mir::{self, Mir, Location};
use rustc::ty::{self, TyCtxt};
use util::elaborate_drops::DropFlagState;
use crate::util::elaborate_drops::DropFlagState;
use super::{MoveDataParamEnv};
use super::indexes::MovePathIndex;

View File

@ -3,8 +3,6 @@
use syntax::ast::NodeId;
use rustc::mir::{BasicBlock, Mir};
use dot;
use std::fs;
use std::io;
use std::marker::PhantomData;
@ -59,7 +57,7 @@ pub type Node = BasicBlock;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Edge { source: BasicBlock, index: usize }
fn outgoing(mir: &Mir, bb: BasicBlock) -> Vec<Edge> {
fn outgoing(mir: &Mir<'_>, bb: BasicBlock) -> Vec<Edge> {
(0..mir[bb].terminator().successors().count())
.map(|index| Edge { source: bb, index: index}).collect()
}
@ -70,18 +68,18 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
{
type Node = Node;
type Edge = Edge;
fn graph_id(&self) -> dot::Id {
fn graph_id(&self) -> dot::Id<'_> {
dot::Id::new(format!("graph_for_node_{}",
self.mbcx.node_id()))
.unwrap()
}
fn node_id(&self, n: &Node) -> dot::Id {
fn node_id(&self, n: &Node) -> dot::Id<'_> {
dot::Id::new(format!("bb_{}", n.index()))
.unwrap()
}
fn node_label(&self, n: &Node) -> dot::LabelText {
fn node_label(&self, n: &Node) -> dot::LabelText<'_> {
// Node label is something like this:
// +---------+----------------------------------+------------------+------------------+
// | ENTRY | MIR | GEN | KILL |
@ -105,7 +103,7 @@ impl<'a, 'tcx, MWF, P> dot::Labeller<'a> for Graph<'a, 'tcx, MWF, P>
}
fn node_shape(&self, _n: &Node) -> Option<dot::LabelText> {
fn node_shape(&self, _n: &Node) -> Option<dot::LabelText<'_>> {
Some(dot::LabelText::label("none"))
}
@ -125,7 +123,7 @@ where MWF: MirWithFlowState<'tcx>,
n: &Node,
w: &mut W,
block: BasicBlock,
mir: &Mir) -> io::Result<()> {
mir: &Mir<'_>) -> io::Result<()> {
// Header rows
const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
const HDR_FMT: &str = "bgcolor=\"grey\"";
@ -150,7 +148,7 @@ where MWF: MirWithFlowState<'tcx>,
n: &Node,
w: &mut W,
block: BasicBlock,
mir: &Mir)
mir: &Mir<'_>)
-> io::Result<()> {
let i = n.index();
@ -200,7 +198,7 @@ where MWF: MirWithFlowState<'tcx>,
n: &Node,
w: &mut W,
block: BasicBlock,
mir: &Mir)
mir: &Mir<'_>)
-> io::Result<()> {
let i = n.index();
@ -241,7 +239,7 @@ impl<'a, 'tcx, MWF, P> dot::GraphWalk<'a> for Graph<'a, 'tcx, MWF, P>
{
type Node = Node;
type Edge = Edge;
fn nodes(&self) -> dot::Nodes<Node> {
fn nodes(&self) -> dot::Nodes<'_, Node> {
self.mbcx.mir()
.basic_blocks()
.indices()
@ -249,7 +247,7 @@ impl<'a, 'tcx, MWF, P> dot::GraphWalk<'a> for Graph<'a, 'tcx, MWF, P>
.into()
}
fn edges(&self) -> dot::Edges<Edge> {
fn edges(&self) -> dot::Edges<'_, Edge> {
let mir = self.mbcx.mir();
mir.basic_blocks()

View File

@ -2,7 +2,7 @@ pub use super::*;
use rustc::mir::*;
use rustc::mir::visit::Visitor;
use dataflow::BitDenotation;
use crate::dataflow::BitDenotation;
/// This calculates if any part of a MIR local could have previously been borrowed.
/// This means that once a local has been borrowed, its bit will be set
@ -38,7 +38,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> {
}
fn statement_effect(&self,
sets: &mut BlockSets<Local>,
sets: &mut BlockSets<'_, Local>,
loc: Location) {
let stmt = &self.mir[loc.block].statements[loc.statement_index];
@ -54,7 +54,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for HaveBeenBorrowedLocals<'a, 'tcx> {
}
fn terminator_effect(&self,
sets: &mut BlockSets<Local>,
sets: &mut BlockSets<'_, Local>,
loc: Location) {
BorrowedLocalsVisitor {
sets,

View File

@ -1,5 +1,5 @@
use borrow_check::borrow_set::{BorrowSet, BorrowData};
use borrow_check::place_ext::PlaceExt;
use crate::borrow_check::borrow_set::{BorrowSet, BorrowData};
use crate::borrow_check::place_ext::PlaceExt;
use rustc::mir::{self, Location, Place, Mir};
use rustc::ty::TyCtxt;
@ -9,11 +9,11 @@ use rustc_data_structures::bit_set::{BitSet, BitSetOperator};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use dataflow::{BitDenotation, BlockSets, InitialFlow};
pub use dataflow::indexes::BorrowIndex;
use borrow_check::nll::region_infer::RegionInferenceContext;
use borrow_check::nll::ToRegionVid;
use borrow_check::places_conflict;
use crate::dataflow::{BitDenotation, BlockSets, InitialFlow};
pub use crate::dataflow::indexes::BorrowIndex;
use crate::borrow_check::nll::region_infer::RegionInferenceContext;
use crate::borrow_check::nll::ToRegionVid;
use crate::borrow_check::places_conflict;
use std::rc::Rc;
@ -163,7 +163,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
/// Add all borrows to the kill set, if those borrows are out of scope at `location`.
/// That means they went out of a nonlexical scope
fn kill_loans_out_of_scope_at_location(&self,
sets: &mut BlockSets<BorrowIndex>,
sets: &mut BlockSets<'_, BorrowIndex>,
location: Location) {
// NOTE: The state associated with a given `location`
// reflects the dataflow on entry to the statement.
@ -184,7 +184,7 @@ impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> {
/// Kill any borrows that conflict with `place`.
fn kill_borrows_on_place(
&self,
sets: &mut BlockSets<BorrowIndex>,
sets: &mut BlockSets<'_, BorrowIndex>,
place: &Place<'tcx>
) {
debug!("kill_borrows_on_place: place={:?}", place);
@ -243,13 +243,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> {
}
fn before_statement_effect(&self,
sets: &mut BlockSets<BorrowIndex>,
sets: &mut BlockSets<'_, BorrowIndex>,
location: Location) {
debug!("Borrows::before_statement_effect sets: {:?} location: {:?}", sets, location);
self.kill_loans_out_of_scope_at_location(sets, location);
}
fn statement_effect(&self, sets: &mut BlockSets<BorrowIndex>, location: Location) {
fn statement_effect(&self, sets: &mut BlockSets<'_, BorrowIndex>, location: Location) {
debug!("Borrows::statement_effect: sets={:?} location={:?}", sets, location);
let block = &self.mir.basic_blocks().get(location.block).unwrap_or_else(|| {
@ -307,13 +307,13 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for Borrows<'a, 'gcx, 'tcx> {
}
fn before_terminator_effect(&self,
sets: &mut BlockSets<BorrowIndex>,
sets: &mut BlockSets<'_, BorrowIndex>,
location: Location) {
debug!("Borrows::before_terminator_effect sets: {:?} location: {:?}", sets, location);
self.kill_loans_out_of_scope_at_location(sets, location);
}
fn terminator_effect(&self, _: &mut BlockSets<BorrowIndex>, _: Location) {}
fn terminator_effect(&self, _: &mut BlockSets<'_, BorrowIndex>, _: Location) {}
fn propagate_call_return(
&self,

View File

@ -9,7 +9,7 @@ use rustc_data_structures::indexed_vec::Idx;
use super::MoveDataParamEnv;
use util::elaborate_drops::DropFlagState;
use crate::util::elaborate_drops::DropFlagState;
use super::move_paths::{HasMoveData, MoveData, MovePathIndex, InitIndex};
use super::move_paths::{LookupResult, InitKind};
@ -251,7 +251,7 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for EverInitializedPlaces<'a, 'gcx, 'tcx>
impl<'a, 'gcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> {
fn update_bits(sets: &mut BlockSets<MovePathIndex>, path: MovePathIndex,
fn update_bits(sets: &mut BlockSets<'_, MovePathIndex>, path: MovePathIndex,
state: DropFlagState)
{
match state {
@ -262,7 +262,7 @@ impl<'a, 'gcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> {
}
impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> {
fn update_bits(sets: &mut BlockSets<MovePathIndex>, path: MovePathIndex,
fn update_bits(sets: &mut BlockSets<'_, MovePathIndex>, path: MovePathIndex,
state: DropFlagState)
{
match state {
@ -273,7 +273,7 @@ impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> {
}
impl<'a, 'gcx, 'tcx> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> {
fn update_bits(sets: &mut BlockSets<MovePathIndex>, path: MovePathIndex,
fn update_bits(sets: &mut BlockSets<'_, MovePathIndex>, path: MovePathIndex,
state: DropFlagState)
{
match state {
@ -300,7 +300,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 't
}
fn statement_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -311,7 +311,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 't
}
fn terminator_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -358,7 +358,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeUninitializedPlaces<'a, 'gcx,
}
fn statement_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -369,7 +369,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for MaybeUninitializedPlaces<'a, 'gcx,
}
fn terminator_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -414,7 +414,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for DefinitelyInitializedPlaces<'a, 'gc
}
fn statement_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -425,7 +425,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for DefinitelyInitializedPlaces<'a, 'gc
}
fn terminator_effect(&self,
sets: &mut BlockSets<MovePathIndex>,
sets: &mut BlockSets<'_, MovePathIndex>,
location: Location)
{
drop_flag_effects_for_location(
@ -464,7 +464,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for EverInitializedPlaces<'a, 'gcx, 'tc
}
fn statement_effect(&self,
sets: &mut BlockSets<InitIndex>,
sets: &mut BlockSets<'_, InitIndex>,
location: Location) {
let (_, mir, move_data) = (self.tcx, self.mir, self.move_data());
let stmt = &mir[location.block].statements[location.statement_index];
@ -511,7 +511,7 @@ impl<'a, 'gcx, 'tcx> BitDenotation<'tcx> for EverInitializedPlaces<'a, 'gcx, 'tc
}
fn terminator_effect(&self,
sets: &mut BlockSets<InitIndex>,
sets: &mut BlockSets<'_, InitIndex>,
location: Location)
{
let (mir, move_data) = (self.mir, self.move_data());

View File

@ -1,7 +1,7 @@
pub use super::*;
use rustc::mir::*;
use dataflow::BitDenotation;
use crate::dataflow::BitDenotation;
#[derive(Copy, Clone)]
pub struct MaybeStorageLive<'a, 'tcx: 'a> {
@ -31,7 +31,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> {
}
fn statement_effect(&self,
sets: &mut BlockSets<Local>,
sets: &mut BlockSets<'_, Local>,
loc: Location) {
let stmt = &self.mir[loc.block].statements[loc.statement_index];
@ -43,7 +43,7 @@ impl<'a, 'tcx> BitDenotation<'tcx> for MaybeStorageLive<'a, 'tcx> {
}
fn terminator_effect(&self,
_sets: &mut BlockSets<Local>,
_sets: &mut BlockSets<'_, Local>,
_loc: Location) {
// Terminators have no effect
}

View File

@ -58,7 +58,7 @@ impl DebugFormatted {
}
impl fmt::Debug for DebugFormatted {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(w, "{}", self.0)
}
}
@ -525,7 +525,7 @@ impl<'a, E:Idx> BlockSets<'a, E> {
impl<E:Idx> AllSets<E> {
pub fn bits_per_block(&self) -> usize { self.bits_per_block }
pub fn for_block(&mut self, block_idx: usize) -> BlockSets<E> {
pub fn for_block(&mut self, block_idx: usize) -> BlockSets<'_, E> {
BlockSets {
on_entry: &mut self.on_entry_sets[block_idx],
gen_set: &mut self.gen_sets[block_idx],
@ -616,7 +616,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator {
/// applied, in that order, before moving for the next
/// statement.
fn before_statement_effect(&self,
_sets: &mut BlockSets<Self::Idx>,
_sets: &mut BlockSets<'_, Self::Idx>,
_location: Location) {}
/// Mutates the block-sets (the flow sets for the given
@ -630,7 +630,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator {
/// `bb_data` is the sequence of statements identified by `bb` in
/// the MIR.
fn statement_effect(&self,
sets: &mut BlockSets<Self::Idx>,
sets: &mut BlockSets<'_, Self::Idx>,
location: Location);
/// Similar to `terminator_effect`, except it applies
@ -645,7 +645,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator {
/// applied, in that order, before moving for the next
/// terminator.
fn before_terminator_effect(&self,
_sets: &mut BlockSets<Self::Idx>,
_sets: &mut BlockSets<'_, Self::Idx>,
_location: Location) {}
/// Mutates the block-sets (the flow sets for the given
@ -659,7 +659,7 @@ pub trait BitDenotation<'tcx>: BitSetOperator {
/// The effects applied here cannot depend on which branch the
/// terminator took.
fn terminator_effect(&self,
sets: &mut BlockSets<Self::Idx>,
sets: &mut BlockSets<'_, Self::Idx>,
location: Location);
/// Mutates the block-sets according to the (flow-dependent)

View File

@ -37,7 +37,7 @@ pub(crate) mod indexes {
}
impl fmt::Debug for $Index {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{}{}", $debug_name, self.index())
}
}
@ -62,7 +62,7 @@ pub use self::indexes::MoveOutIndex;
pub use self::indexes::InitIndex;
impl MoveOutIndex {
pub fn move_path_index(&self, move_data: &MoveData) -> MovePathIndex {
pub fn move_path_index(&self, move_data: &MoveData<'_>) -> MovePathIndex {
move_data.moves[*self].path
}
}
@ -88,7 +88,10 @@ pub struct MovePath<'tcx> {
}
impl<'tcx> MovePath<'tcx> {
pub fn parents(&self, move_paths: &IndexVec<MovePathIndex, MovePath>) -> Vec<MovePathIndex> {
pub fn parents(
&self,
move_paths: &IndexVec<MovePathIndex, MovePath<'_>>,
) -> Vec<MovePathIndex> {
let mut parents = Vec::new();
let mut curr_parent = self.parent;
@ -102,7 +105,7 @@ impl<'tcx> MovePath<'tcx> {
}
impl<'tcx> fmt::Debug for MovePath<'tcx> {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(w, "MovePath {{")?;
if let Some(parent) = self.parent {
write!(w, " parent: {:?},", parent)?;
@ -118,7 +121,7 @@ impl<'tcx> fmt::Debug for MovePath<'tcx> {
}
impl<'tcx> fmt::Display for MovePath<'tcx> {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(w, "{:?}", self.place)
}
}
@ -166,7 +169,7 @@ impl<T> IndexMut<Location> for LocationMap<T> {
}
impl<T> LocationMap<T> where T: Default + Clone {
fn new(mir: &Mir) -> Self {
fn new(mir: &Mir<'_>) -> Self {
LocationMap {
map: mir.basic_blocks().iter().map(|block| {
vec![T::default(); block.statements.len()+1]
@ -190,7 +193,7 @@ pub struct MoveOut {
}
impl fmt::Debug for MoveOut {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}@{:?}", self.path, self.source)
}
}
@ -227,7 +230,7 @@ pub enum InitKind {
}
impl fmt::Debug for Init {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{:?}@{:?} ({:?})", self.path, self.location, self.kind)
}
}

View File

@ -1,6 +1,6 @@
use hair::*;
use hair::cx::Cx;
use hair::cx::to_ref::ToRef;
use crate::hair::*;
use crate::hair::cx::Cx;
use crate::hair::cx::to_ref::ToRef;
use rustc::middle::region;
use rustc::hir;
use rustc::ty;

View File

@ -1,9 +1,9 @@
use hair::*;
use crate::hair::*;
use crate::hair::cx::Cx;
use crate::hair::cx::block;
use crate::hair::cx::to_ref::ToRef;
use crate::hair::util::UserAnnotatedTyHelpers;
use rustc_data_structures::indexed_vec::Idx;
use hair::cx::Cx;
use hair::cx::block;
use hair::cx::to_ref::ToRef;
use hair::util::UserAnnotatedTyHelpers;
use rustc::hir::def::{Def, CtorKind};
use rustc::mir::interpret::{GlobalId, ErrorHandled};
use rustc::ty::{self, AdtKind, Ty};

View File

@ -4,8 +4,8 @@
//! work.
//!
use hair::*;
use hair::util::UserAnnotatedTyHelpers;
use crate::hair::*;
use crate::hair::util::UserAnnotatedTyHelpers;
use rustc_data_structures::indexed_vec::Idx;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
@ -21,7 +21,7 @@ use syntax::attr;
use syntax::symbol::Symbol;
use rustc::hir;
use rustc_data_structures::sync::Lrc;
use hair::constant::{lit_to_const, LitToConstError};
use crate::hair::constant::{lit_to_const, LitToConstError};
#[derive(Clone)]
pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
@ -239,7 +239,7 @@ impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> {
}
}
fn lint_level_for_hir_id(tcx: TyCtxt, mut id: ast::NodeId) -> ast::NodeId {
fn lint_level_for_hir_id(tcx: TyCtxt<'_, '_, '_>, mut id: ast::NodeId) -> ast::NodeId {
// Right now we insert a `with_ignore` node in the dep graph here to
// ignore the fact that `lint_levels` below depends on the entire crate.
// For now this'll prevent false positives of recompiling too much when

View File

@ -1,4 +1,4 @@
use hair::*;
use crate::hair::*;
use rustc::hir;
use syntax::ptr::P;

View File

@ -307,7 +307,7 @@ impl<'p, 'tcx> Matrix<'p, 'tcx> {
/// + _ + [_, _, ..tail] +
/// ++++++++++++++++++++++++++
impl<'p, 'tcx> fmt::Debug for Matrix<'p, 'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "\n")?;
let &Matrix(ref m) = self;
@ -442,7 +442,7 @@ impl<'tcx> Constructor<'tcx> {
VariantIdx::new(0)
}
&ConstantValue(c) => {
::const_eval::const_variant_index(
crate::const_eval::const_variant_index(
cx.tcx,
cx.param_env,
c,
@ -1115,7 +1115,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
} else {
debug!("is_useful - expanding wildcard");
let used_ctors: Vec<Constructor> = rows.iter().flat_map(|row| {
let used_ctors: Vec<Constructor<'_>> = rows.iter().flat_map(|row| {
pat_constructors(cx, row[0], pcx).unwrap_or(vec![])
}).collect();
debug!("used_ctors = {:#?}", used_ctors);
@ -1302,7 +1302,7 @@ fn is_useful_specialized<'p, 'a: 'p, 'tcx: 'a>(
/// Returns None in case of a catch-all, which can't be specialized.
fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt<'_, 'tcx>,
pat: &Pattern<'tcx>,
pcx: PatternContext)
pcx: PatternContext<'_>)
-> Option<Vec<Constructor<'tcx>>>
{
match *pat.kind {

View File

@ -229,7 +229,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
return;
}
let matrix: Matrix = inlined_arms
let matrix: Matrix<'_, '_> = inlined_arms
.iter()
.filter(|&&(_, guard)| guard.is_none())
.flat_map(|arm| &arm.0)
@ -248,7 +248,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
self.tables);
let pattern = patcx.lower_pattern(pat);
let pattern_ty = pattern.ty;
let pats: Matrix = vec![smallvec![
let pats: Matrix<'_, '_> = vec![smallvec![
expand_pattern(cx, pattern)
]].into_iter().collect();
@ -283,7 +283,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
}
}
fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor, pat: &Pat) {
fn check_for_bindings_named_same_as_variants(cx: &MatchVisitor<'_, '_>, pat: &Pat) {
pat.walk(|p| {
if let PatKind::Binding(_, _, _, ident, None) = p.node {
if let Some(&bm) = cx.tables.pat_binding_modes().get(p.hir_id) {
@ -462,7 +462,7 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
}
// Legality of move bindings checking
fn check_legality_of_move_bindings(cx: &MatchVisitor,
fn check_legality_of_move_bindings(cx: &MatchVisitor<'_, '_>,
has_guard: bool,
pats: &[P<Pat>]) {
let mut by_ref_span = None;
@ -541,7 +541,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor,
/// assign.
///
/// FIXME: this should be done by borrowck.
fn check_for_mutation_in_guard(cx: &MatchVisitor, guard: &hir::Guard) {
fn check_for_mutation_in_guard(cx: &MatchVisitor<'_, '_>, guard: &hir::Guard) {
let mut checker = MutationChecker {
cx,
};
@ -561,13 +561,13 @@ struct MutationChecker<'a, 'tcx: 'a> {
}
impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> {
fn matched_pat(&mut self, _: &Pat, _: &cmt_, _: euv::MatchMode) {}
fn consume(&mut self, _: ast::NodeId, _: Span, _: &cmt_, _: ConsumeMode) {}
fn consume_pat(&mut self, _: &Pat, _: &cmt_, _: ConsumeMode) {}
fn matched_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: euv::MatchMode) {}
fn consume(&mut self, _: ast::NodeId, _: Span, _: &cmt_<'_>, _: ConsumeMode) {}
fn consume_pat(&mut self, _: &Pat, _: &cmt_<'_>, _: ConsumeMode) {}
fn borrow(&mut self,
_: ast::NodeId,
span: Span,
_: &cmt_,
_: &cmt_<'_>,
_: ty::Region<'tcx>,
kind:ty:: BorrowKind,
_: LoanCause) {
@ -588,7 +588,7 @@ impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> {
}
}
fn decl_without_init(&mut self, _: ast::NodeId, _: Span) {}
fn mutate(&mut self, _: ast::NodeId, span: Span, _: &cmt_, mode: MutateMode) {
fn mutate(&mut self, _: ast::NodeId, span: Span, _: &cmt_<'_>, mode: MutateMode) {
match mode {
MutateMode::JustWrite | MutateMode::WriteAndRead => {
struct_span_err!(self.cx.tcx.sess, span, E0302, "cannot assign in a pattern guard")
@ -603,7 +603,7 @@ impl<'a, 'tcx> Delegate<'tcx> for MutationChecker<'a, 'tcx> {
/// Forbids bindings in `@` patterns. This is necessary for memory safety,
/// because of the way rvalues are handled in the borrow check. (See issue
/// #14587.)
fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor, pat: &Pat) {
fn check_legality_of_bindings_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat) {
AtBindingPatternVisitor { cx: cx, bindings_allowed: true }.visit_pat(pat);
}

View File

@ -6,10 +6,10 @@ mod check_match;
pub use self::check_match::check_crate;
pub(crate) use self::check_match::check_match;
use const_eval::{const_field, const_variant_index};
use crate::const_eval::{const_field, const_variant_index};
use hair::util::UserAnnotatedTyHelpers;
use hair::constant::*;
use crate::hair::util::UserAnnotatedTyHelpers;
use crate::hair::constant::*;
use rustc::mir::{fmt_const_val, Field, BorrowKind, Mutability};
use rustc::mir::{UserTypeProjection};
@ -176,7 +176,7 @@ pub struct PatternRange<'tcx> {
}
impl<'tcx> fmt::Display for Pattern<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self.kind {
PatternKind::Wild => write!(f, "_"),
PatternKind::AscribeUserType { ref subpattern, .. } =>

View File

@ -322,7 +322,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
) -> EvalResult<'tcx, TyLayout<'tcx>> {
match frame.locals[local].layout.get() {
None => {
let layout = ::interpret::operand::from_known_layout(layout, || {
let layout = crate::interpret::operand::from_known_layout(layout, || {
let local_ty = frame.mir.local_decls[local].ty;
let local_ty = self.monomorphize_with_substs(local_ty, frame.instance.substs);
self.layout_of(local_ty)

View File

@ -25,7 +25,7 @@ use syntax::source_map::Span;
use super::eval_context::{LocalState, StackPopCleanup};
use super::{Frame, Memory, Operand, MemPlace, Place, Immediate, ScalarMaybeUndef, LocalValue};
use const_eval::CompileTimeInterpreter;
use crate::const_eval::CompileTimeInterpreter;
#[derive(Default)]
pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir> {
@ -200,7 +200,7 @@ impl_snapshot_for!(enum ScalarMaybeUndef {
Undef,
});
impl_stable_hash_for!(struct ::interpret::MemPlace {
impl_stable_hash_for!(struct crate::interpret::MemPlace {
ptr,
align,
meta,
@ -211,7 +211,7 @@ impl_snapshot_for!(struct MemPlace {
align -> *align, // just copy alignment verbatim
});
impl_stable_hash_for!(enum ::interpret::Place {
impl_stable_hash_for!(enum crate::interpret::Place {
Ptr(mem_place),
Local { frame, local },
});
@ -232,7 +232,7 @@ impl<'a, Ctx> Snapshot<'a, Ctx> for Place
}
}
impl_stable_hash_for!(enum ::interpret::Immediate {
impl_stable_hash_for!(enum crate::interpret::Immediate {
Scalar(x),
ScalarPair(x, y),
});
@ -241,7 +241,7 @@ impl_snapshot_for!(enum Immediate {
ScalarPair(s, t),
});
impl_stable_hash_for!(enum ::interpret::Operand {
impl_stable_hash_for!(enum crate::interpret::Operand {
Immediate(x),
Indirect(x),
});
@ -250,7 +250,7 @@ impl_snapshot_for!(enum Operand {
Indirect(m),
});
impl_stable_hash_for!(enum ::interpret::LocalValue {
impl_stable_hash_for!(enum crate::interpret::LocalValue {
Dead,
Live(x),
});
@ -298,7 +298,7 @@ impl<'a, Ctx> Snapshot<'a, Ctx> for &'a Allocation
}
}
impl_stable_hash_for!(enum ::interpret::eval_context::StackPopCleanup {
impl_stable_hash_for!(enum crate::interpret::eval_context::StackPopCleanup {
Goto(block),
None { cleanup },
});

View File

@ -112,7 +112,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
let ty = place.layout.ty;
trace!("TerminatorKind::drop: {:?}, type {}", location, ty);
let instance = ::monomorphize::resolve_drop_in_place(*self.tcx, ty);
let instance = crate::monomorphize::resolve_drop_in_place(*self.tcx, ty);
self.drop_in_place(
place,
instance,
@ -326,7 +326,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
// last incoming argument. These two iterators do not have the same type,
// so to keep the code paths uniform we accept an allocation
// (for RustCall ABI only).
let caller_args : Cow<[OpTy<'tcx, M::PointerTag>]> =
let caller_args : Cow<'_, [OpTy<'tcx, M::PointerTag>]> =
if caller_abi == Abi::RustCall && !args.is_empty() {
// Untuple
let (&untuple_arg, args) = args.split_last().unwrap();
@ -335,7 +335,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
.chain((0..untuple_arg.layout.fields.count()).into_iter()
.map(|i| self.operand_field(untuple_arg, i as u64))
)
.collect::<EvalResult<Vec<OpTy<'tcx, M::PointerTag>>>>()?)
.collect::<EvalResult<'_, Vec<OpTy<'tcx, M::PointerTag>>>>()?)
} else {
// Plain arg passing
Cow::from(args)

View File

@ -52,7 +52,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
).with_default_tag();
let tcx = &*self.tcx;
let drop = ::monomorphize::resolve_drop_in_place(*tcx, ty);
let drop = crate::monomorphize::resolve_drop_in_place(*tcx, ty);
let drop = self.memory.create_fn_alloc(drop).with_default_tag();
// no need to do any alignment checks on the memory accesses below, because we know the
// allocation is correctly aligned as we created it above. Also we're only offsetting by

View File

@ -26,7 +26,7 @@ pub trait Value<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>>: Copy
) -> EvalResult<'tcx, OpTy<'tcx, M::PointerTag>>;
/// Create this from an `MPlaceTy`.
fn from_mem_place(MPlaceTy<'tcx, M::PointerTag>) -> Self;
fn from_mem_place(mplace: MPlaceTy<'tcx, M::PointerTag>) -> Self;
/// Project to the given enum variant.
fn project_downcast(

View File

@ -4,7 +4,6 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
*/
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![feature(slice_patterns)]
#![feature(slice_sort_by_cached_key)]
@ -29,28 +28,19 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![recursion_limit="256"]
extern crate arena;
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
#[macro_use]
extern crate bitflags;
#[macro_use] extern crate log;
extern crate either;
extern crate graphviz as dot;
extern crate polonius_engine;
#[macro_use]
extern crate rustc;
#[macro_use] extern crate rustc_data_structures;
extern crate serialize as rustc_serialize;
extern crate rustc_errors;
#[allow(unused_extern_crates)]
extern crate serialize as rustc_serialize; // used by deriving
#[macro_use]
extern crate syntax;
extern crate syntax_pos;
extern crate rustc_target;
extern crate log_settings;
extern crate rustc_apfloat;
extern crate byteorder;
extern crate core;
extern crate smallvec;
// Once we can use edition 2018 in the compiler,
// replace this with real try blocks.
@ -77,7 +67,7 @@ pub mod const_eval;
pub use hair::pattern::check_crate as matchck_crate;
use rustc::ty::query::Providers;
pub fn provide(providers: &mut Providers) {
pub fn provide(providers: &mut Providers<'_>) {
borrow_check::provide(providers);
shim::provide(providers);
transform::provide(providers);

View File

@ -18,7 +18,7 @@ pub fn check(tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fn_kind: FnKind,
fn_kind: FnKind<'_>,
mir: &Mir<'tcx>,
def_id: DefId) {
if let FnKind::Closure(_) = fn_kind {

View File

@ -189,11 +189,11 @@ use rustc::mir::visit::Visitor as MirVisitor;
use rustc::mir::mono::MonoItem;
use rustc::mir::interpret::{Scalar, GlobalId, AllocKind, ErrorHandled};
use monomorphize::{self, Instance};
use crate::monomorphize::{self, Instance};
use rustc::util::nodemap::{FxHashSet, FxHashMap, DefIdMap};
use rustc::util::common::time;
use monomorphize::item::{MonoItemExt, DefPathBasedNames, InstantiationMode};
use crate::monomorphize::item::{MonoItemExt, DefPathBasedNames, InstantiationMode};
use rustc_data_structures::bit_set::GrowableBitSet;
use rustc_data_structures::sync::{MTRef, MTLock, ParallelIterator, par_iter};

View File

@ -1,4 +1,4 @@
use monomorphize::Instance;
use crate::monomorphize::Instance;
use rustc::hir;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::session::config::OptLevel;

View File

@ -111,9 +111,9 @@ use rustc::util::common::time;
use rustc::util::nodemap::{DefIdSet, FxHashMap, FxHashSet};
use rustc::mir::mono::MonoItem;
use monomorphize::collector::InliningMap;
use monomorphize::collector::{self, MonoItemCollectionMode};
use monomorphize::item::{MonoItemExt, InstantiationMode};
use crate::monomorphize::collector::InliningMap;
use crate::monomorphize::collector::{self, MonoItemCollectionMode};
use crate::monomorphize::item::{MonoItemExt, InstantiationMode};
pub use rustc::mir::mono::CodegenUnit;
@ -146,7 +146,7 @@ pub trait CodegenUnitExt<'tcx> {
WorkProductId::from_cgu_name(&self.name().as_str())
}
fn work_product(&self, tcx: TyCtxt) -> WorkProduct {
fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct {
let work_product_id = self.work_product_id();
tcx.dep_graph
.previous_work_product(&work_product_id)
@ -213,7 +213,7 @@ impl<'tcx> CodegenUnitExt<'tcx> for CodegenUnit<'tcx> {
}
// Anything we can't find a proper codegen unit for goes into this.
fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder) -> InternedString {
fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>) -> InternedString {
name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu"))
}
@ -536,7 +536,7 @@ fn mono_item_visibility(
}
}
fn default_visibility(tcx: TyCtxt, id: DefId, is_generic: bool) -> Visibility {
fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> Visibility {
if !tcx.sess.target.target.options.default_hidden_visibility {
return Visibility::Default
}
@ -795,8 +795,8 @@ fn characteristic_def_id_of_mono_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
type CguNameCache = FxHashMap<(DefId, bool), InternedString>;
fn compute_codegen_unit_name(tcx: TyCtxt,
name_builder: &mut CodegenUnitNameBuilder,
fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_, '_>,
name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>,
def_id: DefId,
volatile: bool,
cache: &mut CguNameCache)
@ -855,7 +855,7 @@ fn compute_codegen_unit_name(tcx: TyCtxt,
}).clone()
}
fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder,
fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_, '_>,
index: usize)
-> InternedString {
name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index))
@ -929,7 +929,7 @@ fn collect_and_partition_mono_items<'a, 'tcx>(
tcx.sess.abort_if_errors();
::monomorphize::assert_symbols_are_distinct(tcx, items.iter());
crate::monomorphize::assert_symbols_are_distinct(tcx, items.iter());
let strategy = if tcx.sess.opts.incremental.is_some() {
PartitioningStrategy::PerModule
@ -1013,7 +1013,7 @@ fn collect_and_partition_mono_items<'a, 'tcx>(
(Arc::new(mono_items), Arc::new(codegen_units))
}
pub fn provide(providers: &mut Providers) {
pub fn provide(providers: &mut Providers<'_>) {
providers.collect_and_partition_mono_items =
collect_and_partition_mono_items;

View File

@ -16,12 +16,12 @@ use syntax_pos::Span;
use std::fmt;
use std::iter;
use transform::{add_moves_for_packed_drops, add_call_guards};
use transform::{remove_noop_landing_pads, no_landing_pads, simplify};
use util::elaborate_drops::{self, DropElaborator, DropStyle, DropFlagMode};
use util::patch::MirPatch;
use crate::transform::{add_moves_for_packed_drops, add_call_guards};
use crate::transform::{remove_noop_landing_pads, no_landing_pads, simplify};
use crate::util::elaborate_drops::{self, DropElaborator, DropStyle, DropFlagMode};
use crate::util::patch::MirPatch;
pub fn provide(providers: &mut Providers) {
pub fn provide(providers: &mut Providers<'_>) {
providers.mir_shims = make_shim;
}
@ -138,7 +138,7 @@ enum CallKind {
Direct(DefId),
}
fn temp_decl(mutability: Mutability, ty: Ty, span: Span) -> LocalDecl {
fn temp_decl(mutability: Mutability, ty: Ty<'_>, span: Span) -> LocalDecl<'_> {
let source_info = SourceInfo { scope: OUTERMOST_SOURCE_SCOPE, span };
LocalDecl {
mutability,
@ -259,7 +259,7 @@ pub struct DropShimElaborator<'a, 'tcx: 'a> {
}
impl<'a, 'tcx> fmt::Debug for DropShimElaborator<'a, 'tcx> {
fn fmt(&self, _f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
Ok(())
}
}

View File

@ -1,7 +1,7 @@
use rustc::ty::TyCtxt;
use rustc::mir::*;
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
#[derive(PartialEq)]
pub enum AddCallGuards {
@ -40,7 +40,7 @@ impl MirPass for AddCallGuards {
}
impl AddCallGuards {
pub fn add_call_guards(&self, mir: &mut Mir) {
pub fn add_call_guards(&self, mir: &mut Mir<'_>) {
let pred_count: IndexVec<_, _> =
mir.predecessors().iter().map(|ps| ps.len()).collect();

View File

@ -2,9 +2,9 @@ use rustc::hir::def_id::DefId;
use rustc::mir::*;
use rustc::ty::TyCtxt;
use transform::{MirPass, MirSource};
use util::patch::MirPatch;
use util;
use crate::transform::{MirPass, MirSource};
use crate::util::patch::MirPatch;
use crate::util;
// This pass moves values being dropped that are within a packed
// struct to a separate local before dropping them, to ensure that

View File

@ -6,7 +6,7 @@
use rustc::ty::{self, Ty, TyCtxt};
use rustc::mir::*;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct AddRetag;

View File

@ -17,7 +17,7 @@ use syntax::symbol::Symbol;
use std::ops::Bound;
use util;
use crate::util;
pub struct UnsafetyChecker<'a, 'tcx: 'a> {
mir: &'a Mir<'tcx>,
@ -458,7 +458,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
}
}
pub(crate) fn provide(providers: &mut Providers) {
pub(crate) fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
unsafety_check_result,
unsafe_derive_on_repr_packed,
@ -575,7 +575,7 @@ fn unsafe_derive_on_repr_packed<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: D
}
/// Return the NodeId for an enclosing scope that is also `unsafe`
fn is_enclosed(tcx: TyCtxt,
fn is_enclosed(tcx: TyCtxt<'_, '_, '_>,
used_unsafe: &FxHashSet<ast::NodeId>,
id: ast::NodeId) -> Option<(String, ast::NodeId)> {
let parent_id = tcx.hir().get_parent_node(id);
@ -598,7 +598,9 @@ fn is_enclosed(tcx: TyCtxt,
}
}
fn report_unused_unsafe(tcx: TyCtxt, used_unsafe: &FxHashSet<ast::NodeId>, id: ast::NodeId) {
fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>,
used_unsafe: &FxHashSet<ast::NodeId>,
id: ast::NodeId) {
let span = tcx.sess.source_map().def_span(tcx.hir().span(id));
let msg = "unnecessary `unsafe` block";
let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg);

View File

@ -26,7 +26,7 @@ use rustc::mir::{BasicBlock, FakeReadCause, Local, Location, Mir, Place};
use rustc::mir::{Statement, StatementKind};
use rustc::mir::visit::MutVisitor;
use rustc::ty::TyCtxt;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct CleanAscribeUserType;

View File

@ -18,12 +18,12 @@ use rustc::ty::layout::{
HasTyCtxt, TargetDataLayout, HasDataLayout,
};
use interpret::{self, EvalContext, ScalarMaybeUndef, Immediate, OpTy, MemoryKind};
use const_eval::{
use crate::interpret::{self, EvalContext, ScalarMaybeUndef, Immediate, OpTy, MemoryKind};
use crate::const_eval::{
CompileTimeInterpreter, error_to_const_error, eval_promoted, mk_eval_cx,
lazy_const_to_op,
};
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct ConstProp;
@ -486,7 +486,7 @@ struct CanConstProp {
impl CanConstProp {
/// returns true if `local` can be propagated
fn check(mir: &Mir) -> IndexVec<Local, bool> {
fn check(mir: &Mir<'_>) -> IndexVec<Local, bool> {
let mut cpv = CanConstProp {
can_const_prop: IndexVec::from_elem(true, &mir.local_decls),
found_assignment: IndexVec::from_elem(false, &mir.local_decls),

View File

@ -22,8 +22,8 @@
use rustc::mir::{Constant, Local, LocalKind, Location, Place, Mir, Operand, Rvalue, StatementKind};
use rustc::mir::visit::MutVisitor;
use rustc::ty::TyCtxt;
use transform::{MirPass, MirSource};
use util::def_use::DefUseAnalysis;
use crate::transform::{MirPass, MirSource};
use crate::util::def_use::DefUseAnalysis;
pub struct CopyPropagation;
@ -173,7 +173,7 @@ enum Action<'tcx> {
}
impl<'tcx> Action<'tcx> {
fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis, src_place: &Place<'tcx>)
fn local_copy(mir: &Mir<'tcx>, def_use_analysis: &DefUseAnalysis<'_>, src_place: &Place<'tcx>)
-> Option<Action<'tcx>> {
// The source must be a local.
let src_local = if let Place::Local(local) = *src_place {

View File

@ -1,7 +1,7 @@
use rustc::ty::TyCtxt;
use rustc::mir::*;
use rustc_data_structures::indexed_vec::Idx;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct Deaggregator;

View File

@ -8,8 +8,8 @@ use std::io;
use rustc::mir::Mir;
use rustc::session::config::{OutputFilenames, OutputType};
use rustc::ty::TyCtxt;
use transform::{MirPass, MirSource};
use util as mir_util;
use crate::transform::{MirPass, MirSource};
use crate::util as mir_util;
pub struct Marker(pub &'static str);
@ -31,7 +31,7 @@ pub struct Disambiguator {
}
impl fmt::Display for Disambiguator {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
let title = if self.is_after { "after" } else { "before" };
write!(formatter, "{}", title)
}

View File

@ -1,10 +1,14 @@
use dataflow::move_paths::{HasMoveData, MoveData, MovePathIndex, LookupResult};
use dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use dataflow::{DataflowResults};
use dataflow::{on_all_children_bits, on_all_drop_children_bits};
use dataflow::{drop_flag_effects_for_location, on_lookup_result_bits};
use dataflow::MoveDataParamEnv;
use dataflow::{self, do_dataflow, DebugFormatted};
use crate::dataflow::move_paths::{HasMoveData, MoveData, MovePathIndex, LookupResult};
use crate::dataflow::{MaybeInitializedPlaces, MaybeUninitializedPlaces};
use crate::dataflow::{DataflowResults};
use crate::dataflow::{on_all_children_bits, on_all_drop_children_bits};
use crate::dataflow::{drop_flag_effects_for_location, on_lookup_result_bits};
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::{self, do_dataflow, DebugFormatted};
use crate::transform::{MirPass, MirSource};
use crate::util::patch::MirPatch;
use crate::util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop};
use crate::util::elaborate_drops::{DropElaborator, DropStyle, DropFlagMode};
use rustc::ty::{self, TyCtxt};
use rustc::ty::layout::VariantIdx;
use rustc::mir::*;
@ -13,10 +17,6 @@ use rustc_data_structures::bit_set::BitSet;
use std::fmt;
use syntax::ast;
use syntax_pos::Span;
use transform::{MirPass, MirSource};
use util::patch::MirPatch;
use util::elaborate_drops::{DropFlagState, Unwind, elaborate_drop};
use util::elaborate_drops::{DropElaborator, DropStyle, DropFlagMode};
pub struct ElaborateDrops;
@ -174,7 +174,7 @@ struct Elaborator<'a, 'b: 'a, 'tcx: 'b> {
}
impl<'a, 'b, 'tcx> fmt::Debug for Elaborator<'a, 'b, 'tcx> {
fn fmt(&self, _f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
Ok(())
}
}

View File

@ -8,7 +8,7 @@ use rustc::ty::subst::Substs;
use rustc::ty::{self, Ty, TyCtxt};
use rustc::mir::*;
use rustc::mir::visit::{MutVisitor, TyContext};
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
struct EraseRegionsVisitor<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,

View File

@ -56,19 +56,19 @@ use rustc::mir::visit::{PlaceContext, Visitor, MutVisitor};
use rustc::ty::{self, TyCtxt, AdtDef, Ty};
use rustc::ty::layout::VariantIdx;
use rustc::ty::subst::Substs;
use util::dump_mir;
use util::liveness::{self, IdentityMap};
use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::bit_set::BitSet;
use std::borrow::Cow;
use std::iter::once;
use std::mem;
use transform::{MirPass, MirSource};
use transform::simplify;
use transform::no_landing_pads::no_landing_pads;
use dataflow::{do_dataflow, DebugFormatted, state_for_location};
use dataflow::{MaybeStorageLive, HaveBeenBorrowedLocals};
use crate::transform::{MirPass, MirSource};
use crate::transform::simplify;
use crate::transform::no_landing_pads::no_landing_pads;
use crate::dataflow::{do_dataflow, DebugFormatted, state_for_location};
use crate::dataflow::{MaybeStorageLive, HaveBeenBorrowedLocals};
use crate::util::dump_mir;
use crate::util::liveness::{self, IdentityMap};
pub struct StateTransform;
@ -581,9 +581,9 @@ fn insert_switch<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
fn elaborate_generator_drops<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId,
mir: &mut Mir<'tcx>) {
use util::elaborate_drops::{elaborate_drop, Unwind};
use util::patch::MirPatch;
use shim::DropShimElaborator;
use crate::util::elaborate_drops::{elaborate_drop, Unwind};
use crate::util::patch::MirPatch;
use crate::shim::DropShimElaborator;
// Note that `elaborate_drops` only drops the upvars of a generator, and
// this is ok because `open_drop` can only be reached within that own

View File

@ -13,10 +13,10 @@ use rustc::ty::subst::{Subst,Substs};
use std::collections::VecDeque;
use std::iter;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
use super::simplify::{remove_dead_blocks, CfgSimplifier};
use syntax::{attr};
use syntax::attr;
use rustc_target::spec::abi::Abi;
const DEFAULT_THRESHOLD: usize = 50;
@ -426,7 +426,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
// Place could result in two different locations if `f`
// writes to `i`. To prevent this we need to create a temporary
// borrow of the place and pass the destination as `*temp` instead.
fn dest_needs_borrow(place: &Place) -> bool {
fn dest_needs_borrow(place: &Place<'_>) -> bool {
match *place {
Place::Projection(ref p) => {
match p.elem {

View File

@ -6,7 +6,7 @@ use rustc::ty::{TyCtxt, TyKind};
use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::indexed_vec::Idx;
use std::mem;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct InstCombine;

View File

@ -5,8 +5,7 @@ use rustc::middle::lang_items::LangItem;
use rustc::mir::*;
use rustc::ty::{List, Ty, TyCtxt, TyKind};
use rustc_data_structures::indexed_vec::{Idx};
use transform::{MirPass, MirSource};
use syntax;
use crate::transform::{MirPass, MirSource};
pub struct Lower128Bit;
@ -182,7 +181,7 @@ impl RhsKind {
}
}
fn sign_of_128bit(ty: Ty) -> Option<bool> {
fn sign_of_128bit(ty: Ty<'_>) -> Option<bool> {
match ty.sty {
TyKind::Int(syntax::ast::IntTy::I128) => Some(true),
TyKind::Uint(syntax::ast::UintTy::U128) => Some(false),

View File

@ -1,5 +1,5 @@
use borrow_check::nll::type_check;
use build;
use crate::borrow_check::nll::type_check;
use crate::build;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::mir::{Mir, MirPhase, Promoted};
use rustc::ty::TyCtxt;
@ -38,7 +38,7 @@ pub mod inline;
pub mod lower_128bit;
pub mod uniform_array_move_out;
pub(crate) fn provide(providers: &mut Providers) {
pub(crate) fn provide(providers: &mut Providers<'_>) {
self::qualify_consts::provide(providers);
self::check_unsafety::provide(providers);
*providers = Providers {

View File

@ -4,7 +4,7 @@
use rustc::ty::TyCtxt;
use rustc::mir::*;
use rustc::mir::visit::MutVisitor;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
pub struct NoLandingPads;

View File

@ -130,7 +130,8 @@ impl<'tcx> Visitor<'tcx> for TempCollector<'tcx> {
}
}
pub fn collect_temps(mir: &Mir, rpo: &mut ReversePostorder) -> IndexVec<Local, TempState> {
pub fn collect_temps(mir: &Mir<'_>,
rpo: &mut ReversePostorder<'_, '_>) -> IndexVec<Local, TempState> {
let mut collector = TempCollector {
temps: IndexVec::from_elem(TempState::Undefined, &mir.local_decls),
span: mir.span,

View File

@ -27,7 +27,7 @@ use syntax_pos::{Span, DUMMY_SP};
use std::fmt;
use std::usize;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
use super::promote_consts::{self, Candidate, TempState};
bitflags! {
@ -84,7 +84,7 @@ enum Mode {
}
impl fmt::Display for Mode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self {
Mode::Const => write!(f, "constant"),
Mode::Static | Mode::StaticMut => write!(f, "static"),
@ -1128,7 +1128,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
}
}
pub fn provide(providers: &mut Providers) {
pub fn provide(providers: &mut Providers<'_>) {
*providers = Providers {
mir_const_qualif,
..*providers
@ -1317,7 +1317,7 @@ impl MirPass for QualifyAndPromoteConstants {
}
}
fn args_required_const(tcx: TyCtxt, def_id: DefId) -> Option<FxHashSet<usize>> {
fn args_required_const(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<FxHashSet<usize>> {
let attrs = tcx.get_attrs(def_id);
let attr = attrs.iter().find(|a| a.check_name("rustc_args_required_const"))?;
let mut ret = FxHashSet::default();

View File

@ -1,8 +1,8 @@
use rustc::ty::TyCtxt;
use rustc::mir::*;
use rustc_data_structures::bit_set::BitSet;
use transform::{MirPass, MirSource};
use util::patch::MirPatch;
use crate::transform::{MirPass, MirSource};
use crate::util::patch::MirPatch;
/// A pass that removes no-op landing pads and replaces jumps to them with
/// `None`. This is important because otherwise LLVM generates terrible
@ -34,7 +34,7 @@ impl RemoveNoopLandingPads {
fn is_nop_landing_pad(
&self,
bb: BasicBlock,
mir: &Mir,
mir: &Mir<'_>,
nop_landing_pads: &BitSet<BasicBlock>,
) -> bool {
for stmt in &mir[bb].statements {
@ -86,7 +86,7 @@ impl RemoveNoopLandingPads {
}
}
fn remove_nop_landing_pads(&self, mir: &mut Mir) {
fn remove_nop_landing_pads(&self, mir: &mut Mir<'_>) {
// make sure there's a single resume block
let resume_block = {
let patch = MirPatch::new(mir);

View File

@ -5,18 +5,20 @@ use syntax_pos::Span;
use rustc::ty::{self, TyCtxt};
use rustc::mir::{self, Mir, Location};
use rustc_data_structures::bit_set::BitSet;
use transform::{MirPass, MirSource};
use crate::transform::{MirPass, MirSource};
use dataflow::{do_dataflow, DebugFormatted};
use dataflow::MoveDataParamEnv;
use dataflow::BitDenotation;
use dataflow::DataflowResults;
use dataflow::{DefinitelyInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces};
use dataflow::move_paths::{MovePathIndex, LookupResult};
use dataflow::move_paths::{HasMoveData, MoveData};
use dataflow;
use crate::dataflow::{do_dataflow, DebugFormatted};
use crate::dataflow::MoveDataParamEnv;
use crate::dataflow::BitDenotation;
use crate::dataflow::DataflowResults;
use crate::dataflow::{
DefinitelyInitializedPlaces, MaybeInitializedPlaces, MaybeUninitializedPlaces
};
use crate::dataflow::move_paths::{MovePathIndex, LookupResult};
use crate::dataflow::move_paths::{HasMoveData, MoveData};
use crate::dataflow;
use dataflow::has_rustc_mir_with;
use crate::dataflow::has_rustc_mir_with;
pub struct SanityCheck;

Some files were not shown because too many files have changed in this diff Show More