Skip to content

Commit

Permalink
Make librustc_mir compile.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Feb 16, 2020
1 parent 4b57cb3 commit 1637aab
Show file tree
Hide file tree
Showing 23 changed files with 55 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/constraint_generation.rs
@@ -1,4 +1,3 @@
use rustc::infer::InferCtxt;
use rustc::mir::visit::TyContext;
use rustc::mir::visit::Visitor;
use rustc::mir::{
Expand All @@ -8,6 +7,7 @@ use rustc::mir::{
use rustc::ty::fold::TypeFoldable;
use rustc::ty::subst::SubstsRef;
use rustc::ty::{self, RegionVid, Ty};
use rustc_infer::infer::InferCtxt;

use crate::borrow_check::{
borrow_set::BorrowSet, facts::AllFacts, location::LocationTable, nll::ToRegionVid,
Expand Down
Expand Up @@ -3,14 +3,14 @@ use rustc::mir::{
FakeReadCause, Local, LocalDecl, LocalInfo, LocalKind, Location, Operand, Place, PlaceRef,
ProjectionElem, Rvalue, Statement, StatementKind, TerminatorKind, VarBindingForm,
};
use rustc::traits::error_reporting::suggest_constraining_type_param;
use rustc::ty::{self, Ty};
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{AsyncGeneratorKind, GeneratorKind};
use rustc_index::vec::Idx;
use rustc_infer::traits::error_reporting::suggest_constraining_type_param;
use rustc_span::source_map::DesugaringKind;
use rustc_span::Span;

Expand Down
Expand Up @@ -2,7 +2,6 @@

use std::collections::VecDeque;

use rustc::infer::NLLRegionVariableOrigin;
use rustc::mir::{
Body, CastKind, ConstraintCategory, FakeReadCause, Local, Location, Operand, Place, Rvalue,
Statement, StatementKind, TerminatorKind,
Expand All @@ -12,6 +11,7 @@ use rustc::ty::{self, RegionVid, TyCtxt};
use rustc_data_structures::fx::FxHashSet;
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_index::vec::IndexVec;
use rustc_infer::infer::NLLRegionVariableOrigin;
use rustc_span::symbol::Symbol;
use rustc_span::Span;

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/borrow_check/diagnostics/region_errors.rs
@@ -1,11 +1,11 @@
//! Error reporting machinery for lifetime errors.

use rustc::infer::{
error_reporting::nice_region_error::NiceRegionError, opaque_types, NLLRegionVariableOrigin,
};
use rustc::mir::ConstraintCategory;
use rustc::ty::{self, RegionVid, Ty};
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_infer::infer::{
error_reporting::nice_region_error::NiceRegionError, opaque_types, NLLRegionVariableOrigin,
};
use rustc_span::symbol::kw;
use rustc_span::Span;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/member_constraints.rs
@@ -1,5 +1,5 @@
use crate::rustc::ty::{self, Ty};
use rustc::infer::region_constraints::MemberConstraint;
use rustc::infer::MemberConstraint;
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_index::vec::IndexVec;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/mod.rs
@@ -1,6 +1,5 @@
//! This query borrow-checks the MIR to (further) ensure it is not broken.

use rustc::infer::InferCtxt;
use rustc::lint::builtin::MUTABLE_BORROW_RESERVATION_CONFLICT;
use rustc::lint::builtin::UNUSED_MUT;
use rustc::mir::{
Expand All @@ -20,6 +19,7 @@ use rustc_hir as hir;
use rustc_hir::{def_id::DefId, HirId, Node};
use rustc_index::bit_set::BitSet;
use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};

use either::Either;
use smallvec::SmallVec;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/nll.rs
@@ -1,6 +1,5 @@
//! The entry point of the NLL borrow checker.

use rustc::infer::InferCtxt;
use rustc::mir::{
BasicBlock, Body, BodyAndCache, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind,
Location, Promoted, ReadOnlyBodyAndCache,
Expand All @@ -10,6 +9,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_errors::Diagnostic;
use rustc_hir::def_id::DefId;
use rustc_index::vec::IndexVec;
use rustc_infer::infer::InferCtxt;
use rustc_span::symbol::sym;
use std::env;
use std::fmt::Debug;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/region_infer/dump_mir.rs
Expand Up @@ -4,7 +4,7 @@
//! context internal state.

use super::{OutlivesConstraint, RegionInferenceContext};
use rustc::infer::NLLRegionVariableOrigin;
use rustc_infer::infer::NLLRegionVariableOrigin;
use std::io::{self, Write};

// Room for "'_#NNNNr" before things get misaligned.
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir/borrow_check/region_infer/mod.rs
@@ -1,9 +1,6 @@
use std::collections::VecDeque;
use std::rc::Rc;

use rustc::infer::canonical::QueryOutlivesConstraint;
use rustc::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin};
use rustc::mir::{
Body, ClosureOutlivesRequirement, ClosureOutlivesSubject, ClosureRegionRequirements,
ConstraintCategory, Local, Location,
Expand All @@ -15,6 +12,9 @@ use rustc_data_structures::graph::scc::Sccs;
use rustc_hir::def_id::DefId;
use rustc_index::bit_set::BitSet;
use rustc_index::vec::IndexVec;
use rustc_infer::infer::canonical::QueryOutlivesConstraint;
use rustc_infer::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin};
use rustc_span::Span;

use crate::borrow_check::{
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/region_infer/opaque_types.rs
@@ -1,7 +1,7 @@
use rustc::infer::InferCtxt;
use rustc::ty::{self, TyCtxt, TypeFoldable};
use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def_id::DefId;
use rustc_infer::infer::InferCtxt;
use rustc_span::Span;

use super::RegionInferenceContext;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/renumber.rs
@@ -1,9 +1,9 @@
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
use rustc::mir::visit::{MutVisitor, TyContext};
use rustc::mir::{BodyAndCache, Location, PlaceElem, Promoted};
use rustc::ty::subst::SubstsRef;
use rustc::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc_index::vec::IndexVec;
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};

/// Replaces all free regions appearing in the MIR with fresh
/// inference variables, returning the number of variables created.
Expand Down
@@ -1,12 +1,12 @@
use rustc::infer::canonical::QueryOutlivesConstraint;
use rustc::infer::canonical::QueryRegionConstraints;
use rustc::infer::outlives::env::RegionBoundPairs;
use rustc::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
use rustc::infer::region_constraints::{GenericKind, VerifyBound};
use rustc::infer::{self, InferCtxt, SubregionOrigin};
use rustc::mir::ConstraintCategory;
use rustc::ty::subst::GenericArgKind;
use rustc::ty::{self, TyCtxt};
use rustc_infer::infer::canonical::QueryOutlivesConstraint;
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
use rustc_infer::infer::region_constraints::{GenericKind, VerifyBound};
use rustc_infer::infer::{self, InferCtxt, SubregionOrigin};
use rustc_span::DUMMY_SP;

use crate::borrow_check::{
Expand Down
@@ -1,12 +1,12 @@
use rustc::infer::canonical::QueryRegionConstraints;
use rustc::infer::region_constraints::GenericKind;
use rustc::infer::InferCtxt;
use rustc::mir::ConstraintCategory;
use rustc::traits::query::outlives_bounds::{self, OutlivesBound};
use rustc::traits::query::type_op::{self, TypeOp};
use rustc::ty::free_region_map::FreeRegionRelations;
use rustc::ty::{self, RegionVid, Ty, TyCtxt};
use rustc_data_structures::transitive_relation::TransitiveRelation;
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::region_constraints::GenericKind;
use rustc_infer::infer::InferCtxt;
use rustc_infer::traits::query::outlives_bounds::{self, OutlivesBound};
use rustc_infer::traits::query::type_op::{self, TypeOp};
use rustc_span::DUMMY_SP;
use std::rc::Rc;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/type_check/input_output.rs
Expand Up @@ -7,9 +7,9 @@
//! `RETURN_PLACE` the MIR arguments) are always fully normalized (and
//! contain revealed `impl Trait` values).

use rustc::infer::LateBoundRegionConversionTime;
use rustc::mir::*;
use rustc::ty::Ty;
use rustc_infer::infer::LateBoundRegionConversionTime;

use rustc_index::vec::Idx;
use rustc_span::Span;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/borrow_check/type_check/liveness/trace.rs
@@ -1,11 +1,11 @@
use rustc::infer::canonical::QueryRegionConstraints;
use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, ReadOnlyBodyAndCache};
use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
use rustc::traits::query::type_op::outlives::DropckOutlives;
use rustc::traits::query::type_op::TypeOp;
use rustc::ty::{Ty, TypeFoldable};
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_index::bit_set::HybridBitSet;
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::traits::query::dropck_outlives::DropckOutlivesResult;
use rustc_infer::traits::query::type_op::outlives::DropckOutlives;
use rustc_infer::traits::query::type_op::TypeOp;
use std::rc::Rc;

use crate::dataflow::generic::ResultsCursor;
Expand Down
20 changes: 11 additions & 9 deletions src/librustc_mir/borrow_check/type_check/mod.rs
Expand Up @@ -5,19 +5,10 @@ use std::{fmt, iter, mem};

use either::Either;

use rustc::infer::canonical::QueryRegionConstraints;
use rustc::infer::opaque_types::GenerateMemberConstraints;
use rustc::infer::outlives::env::RegionBoundPairs;
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin};
use rustc::mir::tcx::PlaceTy;
use rustc::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor};
use rustc::mir::AssertKind;
use rustc::mir::*;
use rustc::traits::query::type_op;
use rustc::traits::query::type_op::custom::CustomTypeOp;
use rustc::traits::query::{Fallible, NoSolution};
use rustc::traits::{self, ObligationCause, PredicateObligations};
use rustc::ty::adjustment::PointerCast;
use rustc::ty::cast::CastTy;
use rustc::ty::fold::TypeFoldable;
Expand All @@ -32,6 +23,17 @@ use rustc_errors::struct_span_err;
use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::canonical::QueryRegionConstraints;
use rustc_infer::infer::opaque_types::GenerateMemberConstraints;
use rustc_infer::infer::outlives::env::RegionBoundPairs;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_infer::infer::{
InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin,
};
use rustc_infer::traits::query::type_op;
use rustc_infer::traits::query::type_op::custom::CustomTypeOp;
use rustc_infer::traits::query::{Fallible, NoSolution};
use rustc_infer::traits::{self, ObligationCause, PredicateObligations};
use rustc_span::{Span, DUMMY_SP};

use crate::dataflow::generic::ResultsCursor;
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_mir/borrow_check/type_check/relate_tys.rs
@@ -1,10 +1,10 @@
use rustc::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
use rustc::mir::ConstraintCategory;
use rustc::traits::query::Fallible;
use rustc::traits::DomainGoal;
use rustc::ty::relate::TypeRelation;
use rustc::ty::{self, Ty};
use rustc_infer::infer::nll_relate::{NormalizationStrategy, TypeRelating, TypeRelatingDelegate};
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
use rustc_infer::traits::query::Fallible;
use rustc_infer::traits::DomainGoal;

use crate::borrow_check::constraints::OutlivesConstraint;
use crate::borrow_check::type_check::{BorrowCheckContext, Locations};
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/borrow_check/universal_regions.rs
Expand Up @@ -13,7 +13,6 @@
//! just returns them for other code to use.

use either::Either;
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin};
use rustc::middle::lang_items;
use rustc::ty::fold::TypeFoldable;
use rustc::ty::subst::{InternalSubsts, Subst, SubstsRef};
Expand All @@ -24,6 +23,7 @@ use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{BodyOwnerKind, HirId};
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::{InferCtxt, NLLRegionVariableOrigin};
use std::iter;

use crate::borrow_check::nll::ToRegionVid;
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_mir/transform/check_consts/validation.rs
Expand Up @@ -3,12 +3,13 @@
use rustc::middle::lang_items;
use rustc::mir::visit::{MutatingUseContext, NonMutatingUseContext, PlaceContext, Visitor};
use rustc::mir::*;
use rustc::traits::{self, TraitEngine};
use rustc::ty::cast::CastTy;
use rustc::ty::{self, TyCtxt};
use rustc_errors::struct_span_err;
use rustc_hir::{def_id::DefId, HirId};
use rustc_index::bit_set::BitSet;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::{self, TraitEngine};
use rustc_span::symbol::sym;
use rustc_span::Span;

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/transform/const_prop.rs
Expand Up @@ -14,7 +14,6 @@ use rustc::mir::{
SourceInfo, SourceScope, SourceScopeData, Statement, StatementKind, Terminator, TerminatorKind,
UnOp, RETURN_PLACE,
};
use rustc::traits;
use rustc::ty::layout::{
HasDataLayout, HasTyCtxt, LayoutError, LayoutOf, Size, TargetDataLayout, TyLayout,
};
Expand All @@ -25,6 +24,7 @@ use rustc_hir::def::DefKind;
use rustc_hir::def_id::DefId;
use rustc_hir::HirId;
use rustc_index::vec::IndexVec;
use rustc_infer::traits;
use rustc_span::Span;
use syntax::ast::Mutability;

Expand Down
1 change: 1 addition & 0 deletions src/librustc_mir_build/build/mod.rs
Expand Up @@ -12,6 +12,7 @@ use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::{GeneratorKind, HirIdMap, Node};
use rustc_index::vec::{Idx, IndexVec};
use rustc_infer::infer::TyCtxtInferExt;
use rustc_span::symbol::kw;
use rustc_span::Span;
use rustc_target::spec::abi::Abi;
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir_build/hair/cx/mod.rs
Expand Up @@ -5,7 +5,6 @@
use crate::hair::util::UserAnnotatedTyHelpers;
use crate::hair::*;

use rustc::infer::InferCtxt;
use rustc::middle::region;
use rustc::mir::interpret::{LitToConstError, LitToConstInput};
use rustc::ty::layout::VariantIdx;
Expand All @@ -16,6 +15,7 @@ use rustc_hir as hir;
use rustc_hir::def_id::DefId;
use rustc_hir::Node;
use rustc_index::vec::Idx;
use rustc_infer::infer::InferCtxt;
use rustc_span::symbol::{sym, Symbol};
use syntax::ast;
use syntax::attr;
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_mir_build/hair/pattern/const_to_pat.rs
@@ -1,10 +1,10 @@
use rustc::infer::InferCtxt;
use rustc::lint;
use rustc::mir::Field;
use rustc::traits::predicate_for_trait_def;
use rustc::traits::{self, ObligationCause, PredicateObligation};
use rustc::ty::{self, Ty, TyCtxt};
use rustc_hir as hir;
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
use rustc_infer::traits::predicate_for_trait_def;
use rustc_infer::traits::{self, ObligationCause, PredicateObligation};

use rustc_index::vec::Idx;

Expand Down

0 comments on commit 1637aab

Please sign in to comment.