]> git.lizzy.rs Git - rust.git/commitdiff
Address nits
authorJared Roesch <roeschinc@gmail.com>
Fri, 26 Jun 2015 19:23:41 +0000 (12:23 -0700)
committerJared Roesch <roeschinc@gmail.com>
Sun, 28 Jun 2015 02:52:25 +0000 (19:52 -0700)
14 files changed:
src/librustc/middle/astencode.rs
src/librustc/middle/infer/mod.rs
src/librustc/middle/traits/mod.rs
src/librustc/middle/ty.rs
src/librustc_driver/driver.rs
src/librustc_trans/trans/common.rs
src/librustc_typeck/check/compare_method.rs
src/librustc_typeck/check/method/confirm.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/check/regionck.rs
src/librustc_typeck/check/upvar.rs
src/librustc_typeck/check/wf.rs
src/librustc_typeck/check/writeback.rs
src/librustc_typeck/coherence/mod.rs

index f2ae396173bc0c7e2b9ecb62a80f59f75e139be4..d2c79e1d820bf98751cb81b562eda485f0f5006d 100644 (file)
@@ -1051,7 +1051,12 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
                     var_id: var_id,
                     closure_expr_id: id
                 };
-                let upvar_capture = tcx.tables.borrow().upvar_capture_map.get(&upvar_id).unwrap().clone();
+                let upvar_capture = tcx.tables
+                                       .borrow()
+                                       .upvar_capture_map
+                                       .get(&upvar_id)
+                                       .unwrap()
+                                       .clone();
                 var_id.encode(rbml_w);
                 upvar_capture.encode(rbml_w);
             })
index c21ec9fbbb3bf038d59ec315922efec9f6deec31..c355e8b82a6ef9f201b8fe8b982ded75db45cff6 100644 (file)
@@ -87,6 +87,11 @@ pub struct InferCtxt<'a, 'tcx: 'a> {
 
     pub parameter_environment: ty::ParameterEnvironment<'a, 'tcx>,
 
+    // This is a temporary field used for toggling on normalization in the inference context,
+    // as we move towards the approach described here:
+    // https://internals.rust-lang.org/t/flattening-the-contexts-for-fun-and-profit/2293
+    // At a point sometime in the future normalization will be done by the typing context
+    // directly.
     normalize: bool,
 
     err_count_on_creation: usize,
@@ -334,7 +339,7 @@ pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
         float_unification_table: RefCell::new(UnificationTable::new()),
         region_vars: RegionVarBindings::new(tcx),
         parameter_environment: param_env.unwrap_or(tcx.empty_parameter_environment()),
-        normalize: true,
+        normalize: false,
         err_count_on_creation: tcx.sess.err_count()
     }
 }
@@ -487,7 +492,8 @@ fn node_method_origin(&self, method_call: ty::MethodCall)
     }
 
     fn adjustments(&self) -> Ref<NodeMap<ty::AutoAdjustment<'tcx>>> {
-        fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>) -> &'a NodeMap<ty::AutoAdjustment<'tcx>> {
+        fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>)
+                                        -> &'a NodeMap<ty::AutoAdjustment<'tcx>> {
             &tables.adjustments
         }
 
@@ -524,8 +530,7 @@ fn closure_type(&self,
                     substs: &subst::Substs<'tcx>)
                     -> ty::ClosureTy<'tcx>
     {
-        // the substitutions in `substs` are already monomorphized,
-        // but we still must normalize associated types
+
         let closure_ty = self.tables
                              .borrow()
                              .closure_tys
@@ -534,8 +539,15 @@ fn closure_type(&self,
                              .subst(self.tcx, substs);
 
         if self.normalize {
-            // NOTE: this flag is *always* set to false currently
-            panic!("issue XXXX: must finish fulfill refactor") // normalize_associated_type(self.param_env.tcx, &closure_ty)
+            // NOTE: this flag is currently *always* set to false, we are slowly folding
+            // normalization into this trait and will come back to remove this in the near
+            // future.
+
+            // code from NormalizingClosureTyper:
+            // the substitutions in `substs` are already monomorphized,
+            // but we still must normalize associated types
+            // normalize_associated_type(self.param_env.tcx, &closure_ty)
+            panic!("see issue 26597: fufillment context refactor must occur")
         } else {
             closure_ty
         }
@@ -546,13 +558,18 @@ fn closure_upvars(&self,
                       substs: &Substs<'tcx>)
                       -> Option<Vec<ty::ClosureUpvar<'tcx>>>
     {
-        // the substitutions in `substs` are already monomorphized,
-        // but we still must normalize associated types
-        let result = ty::ctxt::closure_upvars(self, def_id, substs)
+        let result = ty::ctxt::closure_upvars(self, def_id, substs);
 
         if self.normalize {
-            // NOTE: this flag is *always* set to false currently
-            panic!("issue XXXX: must finish fulfill refactor") // monomorphize::normalize_associated_type(self.param_env.tcx, &result)
+            // NOTE: this flag is currently *always* set to false, we are slowly folding
+            // normalization into this trait and will come back to remove this in the near
+            // future.
+
+            // code from NormalizingClosureTyper:
+            // the substitutions in `substs` are already monomorphized,
+            // but we still must normalize associated types
+            // monomorphize::normalize_associated_type(self.param_env.tcx, &result)
+            panic!("see issue 26597: fufillment context refactor must occur")
         } else {
             result
         }
@@ -1004,7 +1021,8 @@ pub fn node_ty(&self, id: ast::NodeId) -> Ty<'tcx> {
         match self.tables.borrow().node_types.get(&id) {
             Some(&t) => t,
             // FIXME
-            None if self.tcx.sess.err_count() - self.err_count_on_creation != 0 => self.tcx.types.err,
+            None if self.tcx.sess.err_count() - self.err_count_on_creation != 0 =>
+                self.tcx.types.err,
             None => {
                 self.tcx.sess.bug(
                     &format!("no type for node {}: {} in fcx",
index 69b9762b7b9825e0bdca4656da20b906de014948..9df6ed5d68126cf7923bf2d0a6d02b1f3c7b708b 100644 (file)
@@ -351,7 +351,7 @@ pub fn type_known_to_meet_builtin_bound<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
     }
 }
 
-// TODO: this is gonna need to be removed ...
+// FIXME: this is gonna need to be removed ...
 /// Normalizes the parameter environment, reporting errors if they occur.
 pub fn normalize_param_env_or_error<'a,'tcx>(unnormalized_env: ty::ParameterEnvironment<'a,'tcx>,
                                              cause: ObligationCause<'tcx>)
index 7616879d1025788825f56174acc68d12f54b7541..489ce7bc4cf78c102eb07846f8d5fd17dcec4f97 100644 (file)
@@ -3222,84 +3222,6 @@ fn new(arena: &'tcx TypedArena<TyS<'tcx>>,
     }
 }
 
-/// Create a type context and call the closure with a `&ty::ctxt` reference
-/// to the context. The closure enforces that the type context and any interned
-/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
-/// reference to the context, to allow formatting values that need it.
-pub fn with_ctxt<'tcx, F, R>(s: Session,
-                             arenas: &'tcx CtxtArenas<'tcx>,
-                             def_map: DefMap,
-                             named_region_map: resolve_lifetime::NamedRegionMap,
-                             map: ast_map::Map<'tcx>,
-                             freevars: RefCell<FreevarMap>,
-                             region_maps: RegionMaps,
-                             lang_items: middle::lang_items::LanguageItems,
-                             stability: stability::Index<'tcx>,
-                             f: F) -> (Session, R)
-                             where F: FnOnce(&ctxt<'tcx>) -> R
-{
-    let mut interner = FnvHashMap();
-    let common_types = CommonTypes::new(&arenas.type_, &mut interner);
-
-    tls::enter(ctxt {
-        arenas: arenas,
-        interner: RefCell::new(interner),
-        substs_interner: RefCell::new(FnvHashMap()),
-        bare_fn_interner: RefCell::new(FnvHashMap()),
-        region_interner: RefCell::new(FnvHashMap()),
-        stability_interner: RefCell::new(FnvHashMap()),
-        types: common_types,
-        named_region_map: named_region_map,
-        region_maps: region_maps,
-        free_region_maps: RefCell::new(FnvHashMap()),
-        item_variance_map: RefCell::new(DefIdMap()),
-        variance_computed: Cell::new(false),
-        sess: s,
-        def_map: def_map,
-        tables: RefCell::new(Tables::empty()),
-        impl_trait_refs: RefCell::new(DefIdMap()),
-        trait_defs: RefCell::new(DefIdMap()),
-        predicates: RefCell::new(DefIdMap()),
-        super_predicates: RefCell::new(DefIdMap()),
-        fulfilled_predicates: RefCell::new(traits::FulfilledPredicates::new()),
-        map: map,
-        freevars: freevars,
-        tcache: RefCell::new(DefIdMap()),
-        rcache: RefCell::new(FnvHashMap()),
-        tc_cache: RefCell::new(FnvHashMap()),
-        ast_ty_to_ty_cache: RefCell::new(NodeMap()),
-        enum_var_cache: RefCell::new(DefIdMap()),
-        impl_or_trait_items: RefCell::new(DefIdMap()),
-        trait_item_def_ids: RefCell::new(DefIdMap()),
-        trait_items_cache: RefCell::new(DefIdMap()),
-        ty_param_defs: RefCell::new(NodeMap()),
-        normalized_cache: RefCell::new(FnvHashMap()),
-        lang_items: lang_items,
-        provided_method_sources: RefCell::new(DefIdMap()),
-        struct_fields: RefCell::new(DefIdMap()),
-        destructor_for_type: RefCell::new(DefIdMap()),
-        destructors: RefCell::new(DefIdSet()),
-        inherent_impls: RefCell::new(DefIdMap()),
-        impl_items: RefCell::new(DefIdMap()),
-        used_unsafe: RefCell::new(NodeSet()),
-        used_mut_nodes: RefCell::new(NodeSet()),
-        populated_external_types: RefCell::new(DefIdSet()),
-        populated_external_primitive_impls: RefCell::new(DefIdSet()),
-        extern_const_statics: RefCell::new(DefIdMap()),
-        extern_const_variants: RefCell::new(DefIdMap()),
-        extern_const_fns: RefCell::new(DefIdMap()),
-        dependency_formats: RefCell::new(FnvHashMap()),
-        node_lint_levels: RefCell::new(FnvHashMap()),
-        transmute_restrictions: RefCell::new(Vec::new()),
-        stability: RefCell::new(stability),
-        selection_cache: traits::SelectionCache::new(),
-        repr_hint_cache: RefCell::new(DefIdMap()),
-        const_qualif_map: RefCell::new(NodeMap()),
-        custom_coerce_unsized_kinds: RefCell::new(DefIdMap()),
-        cast_kinds: RefCell::new(NodeMap()),
-   }, f)
-}
-
 struct FlagComputation {
     flags: TypeFlags,
 
index 1ad3f53c328d90b2c24661b86308f4f8972c0b5b..80c4fc28703ac78dd131925ea13376a7d2aefa2e 100644 (file)
@@ -602,7 +602,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: Session,
                                                make_glob_map: resolve::MakeGlobMap,
                                                f: F)
                                                -> (Session, R)
-                                               where F: FnOnce(&ty::ctxt<'tcx>,
+                                               where F: for<'a> FnOnce(&'a ty::ctxt<'tcx>,
                                                                ty::CrateAnalysis) -> R
 {
     let time_passes = sess.time_passes();
index c549d8cd22d64b66e9819db59699dfe4f31608d8..483d82f508f25a8ec84ffbaabe0023fac3a675b9 100644 (file)
@@ -649,7 +649,10 @@ fn node_method_origin(&self, method_call: ty::MethodCall)
     }
 
     fn adjustments<'a>(&'a self) -> Ref<NodeMap<ty::AutoAdjustment<'tcx>>> {
-        fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>) -> &'a NodeMap<ty::AutoAdjustment<'tcx>> {
+        // FIXME (@jroesch): this is becuase we currently have a HR inference problem
+        // in the snapshot that causes this code not to work.
+        fn project_adjustments<'a, 'tcx>(tables: &'a ty::Tables<'tcx>) ->
+            &'a NodeMap<ty::AutoAdjustment<'tcx>> {
             &tables.adjustments
         }
 
index 85f4fdc8932012525cdd40163a5df176a36f7327..f62411e85828de96c2fcabc219d83d19b55052d6 100644 (file)
@@ -240,7 +240,7 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
     let trait_param_env = impl_param_env.with_caller_bounds(hybrid_preds.into_vec());
     let trait_param_env = traits::normalize_param_env_or_error(trait_param_env,
                                                                normalize_cause.clone());
-    // TODO (@jroesch) this seems ugly, but is a temporary change
+    // FIXME(@jroesch) this seems ugly, but is a temporary change
     infcx.parameter_environment = trait_param_env;
 
     debug!("compare_impl_method: trait_bounds={:?}",
@@ -362,7 +362,8 @@ pub fn compare_impl_method<'tcx>(tcx: &ty::ctxt<'tcx>,
     // anyway, so it shouldn't be needed there either. Anyway, we can
     // always add more relations later (it's backwards compat).
     let mut free_regions = FreeRegionMap::new();
-    free_regions.relate_free_regions_from_predicates(tcx, &infcx.parameter_environment.caller_bounds);
+    free_regions.relate_free_regions_from_predicates(tcx,
+                                                     &infcx.parameter_environment.caller_bounds);
 
     infcx.resolve_regions_and_report_errors(&free_regions, impl_m_body_id);
 
index 5601888a1f0734265da956a8eaf4c3b36481a4b9..9c2d1c4a34df1dbd9a3d9337b5054229eb5410fb 100644 (file)
@@ -528,7 +528,8 @@ fn fixup_derefs_on_method_receiver_if_necessary(&self,
                         // expects. This is annoying and horrible. We
                         // ought to recode this routine so it doesn't
                         // (ab)use the normal type checking paths.
-                        let adj = self.fcx.inh.tables.borrow().adjustments.get(&base_expr.id).cloned();
+                        let adj = self.fcx.inh.tables.borrow().adjustments.get(&base_expr.id)
+                                                                          .cloned();
                         let (autoderefs, unsize) = match adj {
                             Some(ty::AdjustDerefRef(adr)) => match adr.autoref {
                                 None => {
index 2dc0b7d326181ef1b12cf60476418f1532507039..7e87dc6540ea517f122b631c29beef3ec5e7a7d0 100644 (file)
@@ -87,8 +87,6 @@
 use middle::astconv_util::{check_path_args, NO_TPS, NO_REGIONS};
 use middle::def;
 use middle::infer;
-use middle::mem_categorization as mc;
-use middle::mem_categorization::McResult;
 use middle::pat_util::{self, pat_id_map};
 use middle::privacy::{AllPublic, LastMod};
 use middle::region::{self, CodeExtent};
@@ -290,32 +288,6 @@ pub struct FnCtxt<'a, 'tcx: 'a> {
     ccx: &'a CrateCtxt<'a, 'tcx>,
 }
 
-impl<'a, 'tcx> mc::Typer<'tcx> for FnCtxt<'a, 'tcx> {
-    fn node_ty(&self, id: ast::NodeId) -> McResult<Ty<'tcx>> {
-        let ty = self.node_ty(id);
-        self.resolve_type_vars_or_error(&ty)
-    }
-
-    fn expr_ty_adjusted(&self, expr: &ast::Expr) -> McResult<Ty<'tcx>> {
-        let ty = self.adjust_expr_ty(expr, self.inh.tables.borrow().adjustments.get(&expr.id));
-        self.resolve_type_vars_or_error(&ty)
-    }
-
-    fn type_moves_by_default(&self, ty: Ty<'tcx>, span: Span) -> bool {
-        let ty = self.infcx().resolve_type_vars_if_possible(&ty);
-        !traits::type_known_to_meet_builtin_bound(self.infcx(), self, ty, ty::BoundCopy, span)
-    }
-
-    fn node_method_ty(&self, method_call: ty::MethodCall)
-                      -> Option<Ty<'tcx>> {
-        self.inh.tables
-                .borrow()
-                .method_map
-                .get(&method_call)
-                .map(|method| method.ty)
-                .map(|ty| self.infcx().resolve_type_vars_if_possible(&ty))
-    }
-
 impl<'a, 'tcx> Inherited<'a, 'tcx> {
     fn new(tcx: &'a ty::ctxt<'tcx>,
            tables: &'a RefCell<ty::Tables<'tcx>>,
@@ -368,7 +340,8 @@ pub fn blank_fn_ctxt<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
     }
 }
 
-fn static_inherited_fields<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>, tables: &'a RefCell<ty::Tables<'tcx>>)
+fn static_inherited_fields<'a, 'tcx>(ccx: &'a CrateCtxt<'a, 'tcx>,
+                                     tables: &'a RefCell<ty::Tables<'tcx>>)
                                     -> Inherited<'a, 'tcx> {
     // It's kind of a kludge to manufacture a fake function context
     // and statement context, but we might as well do write the code only once
@@ -1271,16 +1244,6 @@ fn resolve_type_vars_if_possible(&self, mut ty: Ty<'tcx>) -> Ty<'tcx> {
         ty
     }
 
-    /// Resolves all type variables in `t` and then, if any were left
-    /// unresolved, substitutes an error type. This is used after the
-    /// main checking when doing a second pass before writeback. The
-    /// justification is that writeback will produce an error for
-    /// these unconstrained type variables.
-    fn resolve_type_vars_or_error(&self, ty: &Ty<'tcx>) -> mc::McResult<Ty<'tcx>> {
-        let ty = self.infcx().resolve_type_vars_if_possible(ty);
-        if ty.has_infer_types() || ty.references_error() { Err(()) } else { Ok(ty) }
-    }
-
     fn record_deferred_call_resolution(&self,
                                        closure_def_id: ast::DefId,
                                        r: DeferredCallResolutionHandler<'tcx>) {
@@ -1614,9 +1577,10 @@ pub fn node_ty(&self, id: ast::NodeId) -> Ty<'tcx> {
     }
 
     pub fn item_substs(&self) -> Ref<NodeMap<ty::ItemSubsts<'tcx>>> {
-        // NOTE: @jroesch this is hack that appears to be fixed on nightly, will monitor if it changes
-        // when we upgrade the snapshot compiler
-        fn project_item_susbts<'a, 'tcx>(tables: &'a ty::Tables<'tcx>) -> &'a NodeMap<ty::ItemSubsts<'tcx>> {
+        // NOTE: @jroesch this is hack that appears to be fixed on nightly, will monitor if
+        // it changes when we upgrade the snapshot compiler
+        fn project_item_susbts<'a, 'tcx>(tables: &'a ty::Tables<'tcx>)
+                                        -> &'a NodeMap<ty::ItemSubsts<'tcx>> {
             &tables.item_substs
         }
 
index 796f6d646939f31548ff1dd90c54b6817790a584..a86301907385a1246dc033758bddee9fe4fb9de4 100644 (file)
@@ -125,7 +125,8 @@ pub fn regionck_expr(fcx: &FnCtxt, e: &ast::Expr) {
 pub fn regionck_item(fcx: &FnCtxt, item: &ast::Item) {
     let mut rcx = Rcx::new(fcx, RepeatingScope(item.id), item.id, Subject(item.id));
     let tcx = fcx.tcx();
-    rcx.free_region_map.relate_free_regions_from_predicates(tcx, &fcx.inh.infcx.parameter_environment.caller_bounds);
+    rcx.free_region_map
+       .relate_free_regions_from_predicates(tcx, &fcx.infcx().parameter_environment.caller_bounds);
     rcx.visit_region_obligations(item.id);
     rcx.resolve_regions_and_report_errors();
 }
@@ -144,7 +145,8 @@ pub fn regionck_fn(fcx: &FnCtxt,
     }
 
     let tcx = fcx.tcx();
-    rcx.free_region_map.relate_free_regions_from_predicates(tcx, &fcx.inh.infcx.parameter_environment.caller_bounds);
+    rcx.free_region_map
+       .relate_free_regions_from_predicates(tcx, &fcx.infcx().parameter_environment.caller_bounds);
 
     rcx.resolve_regions_and_report_errors();
 
index 19a0345e8088f8aec6a408ab13d6742a2cbb108b..c7f084e27cda015f456bec5d6d0906b2b445bcf1 100644 (file)
@@ -131,7 +131,8 @@ fn check_closure(&mut self,
         let closure_def_id = ast_util::local_def(expr.id);
         if !self.fcx.inh.tables.borrow().closure_kinds.contains_key(&closure_def_id) {
             self.closures_with_inferred_kinds.insert(expr.id);
-            self.fcx.inh.tables.borrow_mut().closure_kinds.insert(closure_def_id, ty::FnClosureKind);
+            self.fcx.inh.tables.borrow_mut().closure_kinds
+                                            .insert(closure_def_id, ty::FnClosureKind);
             debug!("check_closure: adding closure_id={:?} to closures_with_inferred_kinds",
                    closure_def_id);
         }
@@ -267,7 +268,10 @@ fn adjust_upvar_borrow_kind_for_consume(&self,
                         // to move out of an upvar, this must be a FnOnce closure
                         self.adjust_closure_kind(upvar_id.closure_expr_id, ty::FnOnceClosureKind);
 
-                        let upvar_capture_map = &mut self.fcx.inh.tables.borrow_mut().upvar_capture_map;
+                        let upvar_capture_map = &mut self.fcx
+                                                         .inh
+                                                         .tables.borrow_mut()
+                                                         .upvar_capture_map;
                         upvar_capture_map.insert(upvar_id, ty::UpvarCapture::ByValue);
                     }
                     mc::NoteClosureEnv(upvar_id) => {
index 18e05cd73fb7db85169ee056e5a392fac0b8aa07..df01b99fd9b808cf2748635409dcfc400c6fd70e 100644 (file)
@@ -201,7 +201,10 @@ fn check_item_type(&mut self,
 
             let type_scheme = fcx.tcx().lookup_item_type(local_def(item.id));
             let item_ty = fcx.instantiate_type_scheme(item.span,
-                                                      &fcx.inh.infcx.parameter_environment.free_substs,
+                                                      &fcx.inh
+                                                          .infcx
+                                                          .parameter_environment
+                                                          .free_substs,
                                                       &type_scheme.ty);
 
             bounds_checker.check_traits_in_ty(item_ty, item.span);
@@ -222,7 +225,10 @@ fn check_impl(&mut self,
             // to free.
             let self_ty = fcx.tcx().node_id_to_type(item.id);
             let self_ty = fcx.instantiate_type_scheme(item.span,
-                                                      &fcx.inh.infcx.parameter_environment.free_substs,
+                                                      &fcx.inh
+                                                          .infcx
+                                                          .parameter_environment
+                                                          .free_substs,
                                                       &self_ty);
 
             bounds_checker.check_traits_in_ty(self_ty, item.span);
@@ -235,7 +241,10 @@ fn check_impl(&mut self,
             };
 
             let trait_ref = fcx.instantiate_type_scheme(item.span,
-                                                        &fcx.inh.infcx.parameter_environment.free_substs,
+                                                        &fcx.inh
+                                                            .infcx
+                                                            .parameter_environment
+                                                            .free_substs,
                                                         &trait_ref);
 
             // We are stricter on the trait-ref in an impl than the
@@ -637,7 +646,10 @@ fn struct_variant<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
         .map(|field| {
             let field_ty = fcx.tcx().node_id_to_type(field.node.id);
             let field_ty = fcx.instantiate_type_scheme(field.span,
-                                                       &fcx.inh.infcx.parameter_environment.free_substs,
+                                                       &fcx.inh
+                                                           .infcx
+                                                           .parameter_environment
+                                                           .free_substs,
                                                        &field_ty);
             AdtField { ty: field_ty, span: field.span }
         })
@@ -662,7 +674,10 @@ fn enum_variants<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
                             let arg_ty = arg_tys[index];
                             let arg_ty =
                                 fcx.instantiate_type_scheme(variant.span,
-                                                            &fcx.inh.infcx.parameter_environment.free_substs,
+                                                            &fcx.inh
+                                                                .infcx
+                                                                .parameter_environment
+                                                                .free_substs,
                                                             &arg_ty);
                             AdtField {
                                 ty: arg_ty,
index d990697949659f4887ed9fbe07d8f2505c392395..1fc7224737d2d8b095e848a14d930baf3b536a13 100644 (file)
@@ -217,7 +217,11 @@ fn visit_upvar_borrow_map(&self) {
             debug!("Upvar capture for {:?} resolved to {:?}",
                    upvar_id,
                    new_upvar_capture);
-            self.fcx.tcx().tables.borrow_mut().upvar_capture_map.insert(*upvar_id, new_upvar_capture);
+            self.fcx.tcx()
+                    .tables
+                    .borrow_mut()
+                    .upvar_capture_map
+                    .insert(*upvar_id, new_upvar_capture);
         }
     }
 
index af2c3a32150d83795181f72f7a724754a6f135e2..fbabc287342e9e0ce9d5c59f1f6a18e17203580b 100644 (file)
@@ -540,13 +540,15 @@ fn check_implementations_of_coerce_unsized(&self) {
             fulfill_cx.register_predicate_obligation(&infcx, predicate);
 
             // Check that all transitive obligations are satisfied.
-            if let Err(errors) = fulfill_cx.select_all_or_error(&infcx, &infcx.parameter_environment) {
+            if let Err(errors) = fulfill_cx.select_all_or_error(&infcx,
+                                                                &infcx.parameter_environment) {
                 traits::report_fulfillment_errors(&infcx, &errors);
             }
 
             // Finally, resolve all regions.
             let mut free_regions = FreeRegionMap::new();
-            free_regions.relate_free_regions_from_predicates(tcx, &infcx.parameter_environment.caller_bounds);
+            free_regions.relate_free_regions_from_predicates(tcx, &infcx.parameter_environment
+                                                                        .caller_bounds);
             infcx.resolve_regions_and_report_errors(&free_regions, impl_did.node);
 
             if let Some(kind) = kind {