|
1 | 1 | //! This pass type-checks the MIR to ensure it is not broken.
|
2 | 2 |
|
3 |
| -use crate::borrow_check::borrow_set::BorrowSet; |
4 |
| -use crate::borrow_check::location::LocationTable; |
5 |
| -use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConstraint}; |
6 |
| -use crate::borrow_check::nll::member_constraints::MemberConstraintSet; |
7 |
| -use crate::borrow_check::nll::facts::AllFacts; |
8 |
| -use crate::borrow_check::nll::region_infer::values::LivenessValues; |
9 |
| -use crate::borrow_check::nll::region_infer::values::PlaceholderIndex; |
10 |
| -use crate::borrow_check::nll::region_infer::values::PlaceholderIndices; |
11 |
| -use crate::borrow_check::nll::region_infer::values::RegionValueElements; |
12 |
| -use crate::borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest}; |
13 |
| -use crate::borrow_check::nll::renumber; |
14 |
| -use crate::borrow_check::nll::type_check::free_region_relations::{ |
15 |
| - CreateResult, UniversalRegionRelations, |
16 |
| -}; |
17 |
| -use crate::borrow_check::nll::universal_regions::{DefiningTy, UniversalRegions}; |
18 |
| -use crate::borrow_check::nll::ToRegionVid; |
19 |
| -use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute; |
20 |
| -use crate::dataflow::move_paths::MoveData; |
21 |
| -use crate::dataflow::FlowAtLocation; |
22 |
| -use crate::dataflow::MaybeInitializedPlaces; |
| 3 | +use std::{fmt, iter, mem}; |
| 4 | +use std::rc::Rc; |
| 5 | + |
23 | 6 | use either::Either;
|
| 7 | + |
24 | 8 | use rustc::hir;
|
25 | 9 | use rustc::hir::def_id::DefId;
|
| 10 | +use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin}; |
26 | 11 | use rustc::infer::canonical::QueryRegionConstraints;
|
27 | 12 | use rustc::infer::outlives::env::RegionBoundPairs;
|
28 |
| -use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin}; |
29 | 13 | use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
| 14 | +use rustc::mir::*; |
30 | 15 | use rustc::mir::interpret::PanicInfo;
|
31 | 16 | use rustc::mir::tcx::PlaceTy;
|
32 |
| -use rustc::mir::visit::{PlaceContext, Visitor, NonMutatingUseContext}; |
33 |
| -use rustc::mir::*; |
| 17 | +use rustc::mir::visit::{NonMutatingUseContext, PlaceContext, Visitor}; |
| 18 | +use rustc::traits::{self, ObligationCause, PredicateObligations}; |
| 19 | +use rustc::traits::query::{Fallible, NoSolution}; |
34 | 20 | use rustc::traits::query::type_op;
|
35 | 21 | use rustc::traits::query::type_op::custom::CustomTypeOp;
|
36 |
| -use rustc::traits::query::{Fallible, NoSolution}; |
37 |
| -use rustc::traits::{self, ObligationCause, PredicateObligations}; |
38 |
| -use rustc::ty::adjustment::{PointerCast}; |
39 |
| -use rustc::ty::cast::CastTy; |
40 |
| -use rustc::ty::fold::TypeFoldable; |
41 |
| -use rustc::ty::subst::{Subst, SubstsRef, GenericArgKind, UserSubsts}; |
42 | 22 | use rustc::ty::{
|
43 |
| - self, RegionVid, ToPolyTraitRef, Ty, TyCtxt, UserType, |
44 |
| - CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, |
| 23 | + self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef, Ty, |
| 24 | + TyCtxt, UserType, |
45 | 25 | UserTypeAnnotationIndex,
|
46 | 26 | };
|
47 |
| -use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
48 |
| -use rustc_index::vec::{IndexVec, Idx}; |
| 27 | +use rustc::ty::adjustment::PointerCast; |
| 28 | +use rustc::ty::cast::CastTy; |
| 29 | +use rustc::ty::fold::TypeFoldable; |
49 | 30 | use rustc::ty::layout::VariantIdx;
|
50 |
| -use std::rc::Rc; |
51 |
| -use std::{fmt, iter, mem}; |
52 |
| -use syntax_pos::{Span, DUMMY_SP}; |
53 |
| - |
| 31 | +use rustc::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts}; |
| 32 | +use rustc_data_structures::fx::{FxHashMap, FxHashSet}; |
54 | 33 | use rustc_error_codes::*;
|
| 34 | +use rustc_index::vec::{Idx, IndexVec}; |
| 35 | +use syntax_pos::{DUMMY_SP, Span}; |
| 36 | + |
| 37 | +use crate::borrow_check::borrow_set::BorrowSet; |
| 38 | +use crate::borrow_check::location::LocationTable; |
| 39 | +use crate::borrow_check::nll::constraints::{OutlivesConstraint, OutlivesConstraintSet}; |
| 40 | +use crate::borrow_check::nll::facts::AllFacts; |
| 41 | +use crate::borrow_check::nll::member_constraints::MemberConstraintSet; |
| 42 | +use crate::borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest}; |
| 43 | +use crate::borrow_check::nll::region_infer::values::LivenessValues; |
| 44 | +use crate::borrow_check::nll::region_infer::values::PlaceholderIndex; |
| 45 | +use crate::borrow_check::nll::region_infer::values::PlaceholderIndices; |
| 46 | +use crate::borrow_check::nll::region_infer::values::RegionValueElements; |
| 47 | +use crate::borrow_check::nll::renumber; |
| 48 | +use crate::borrow_check::nll::ToRegionVid; |
| 49 | +use crate::borrow_check::nll::type_check::free_region_relations::{ |
| 50 | + CreateResult, UniversalRegionRelations, |
| 51 | +}; |
| 52 | +use crate::borrow_check::nll::universal_regions::{DefiningTy, UniversalRegions}; |
| 53 | +use crate::dataflow::FlowAtLocation; |
| 54 | +use crate::dataflow::MaybeInitializedPlaces; |
| 55 | +use crate::dataflow::move_paths::MoveData; |
| 56 | +use crate::transform::promote_consts::should_suggest_const_in_array_repeat_expressions_attribute; |
55 | 57 |
|
56 | 58 | macro_rules! span_mirbug {
|
57 | 59 | ($context:expr, $elem:expr, $($message:tt)*) => ({
|
@@ -1374,7 +1376,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
1374 | 1376 | self.infcx.tcx
|
1375 | 1377 | }
|
1376 | 1378 |
|
1377 |
| - fn check_stmt(&mut self, body: ReadOnlyBodyCache<'_, 'tcx>, stmt: &Statement<'tcx>, location: Location) { |
| 1379 | + fn check_stmt( |
| 1380 | + &mut self, |
| 1381 | + body: ReadOnlyBodyCache<'_, 'tcx>, |
| 1382 | + stmt: &Statement<'tcx>, |
| 1383 | + location: Location) |
| 1384 | + { |
1378 | 1385 | debug!("check_stmt: {:?}", stmt);
|
1379 | 1386 | let tcx = self.tcx();
|
1380 | 1387 | match stmt.kind {
|
@@ -1985,7 +1992,12 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
1985 | 1992 | }
|
1986 | 1993 | }
|
1987 | 1994 |
|
1988 |
| - fn check_rvalue(&mut self, body: ReadOnlyBodyCache<'_, 'tcx>, rvalue: &Rvalue<'tcx>, location: Location) { |
| 1995 | + fn check_rvalue( |
| 1996 | + &mut self, |
| 1997 | + body: ReadOnlyBodyCache<'_, 'tcx>, |
| 1998 | + rvalue: &Rvalue<'tcx>, |
| 1999 | + location: Location) |
| 2000 | + { |
1989 | 2001 | let tcx = self.tcx();
|
1990 | 2002 |
|
1991 | 2003 | match rvalue {
|
|
0 commit comments