]> git.lizzy.rs Git - rust.git/commitdiff
rustc: rename mir::LocalDecl's syntactic_source_info to source_info.
authorEduard-Mihai Burtescu <edy.burt@gmail.com>
Tue, 29 May 2018 18:31:33 +0000 (21:31 +0300)
committerEduard-Mihai Burtescu <edy.burt@gmail.com>
Wed, 30 May 2018 17:30:10 +0000 (20:30 +0300)
19 files changed:
src/librustc/ich/impls_mir.rs
src/librustc/mir/mod.rs
src/librustc/mir/visit.rs
src/librustc_codegen_llvm/mir/mod.rs
src/librustc_mir/borrow_check/error_reporting.rs
src/librustc_mir/borrow_check/mod.rs
src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs
src/librustc_mir/borrow_check/nll/type_check/mod.rs
src/librustc_mir/build/expr/into.rs
src/librustc_mir/build/matches/mod.rs
src/librustc_mir/build/mod.rs
src/librustc_mir/dataflow/move_paths/builder.rs
src/librustc_mir/shim.rs
src/librustc_mir/transform/check_unsafety.rs
src/librustc_mir/transform/generator.rs
src/librustc_mir/transform/inline.rs
src/librustc_mir/transform/promote_consts.rs
src/librustc_mir/transform/qualify_consts.rs
src/librustc_mir/util/pretty.rs

index 15240570a7ae224ade77cff6ba2558b615e2122f..f43ac7ad0dd5a4afd5afab40ee23b21e4889cf72 100644 (file)
@@ -25,7 +25,7 @@
     mutability,
     ty,
     name,
-    syntactic_source_info,
+    source_info,
     visibility_scope,
     internal,
     is_user_variable
index 998af9ebcfe7dfd95a597045216e1addd120bf39..b2ff36cb87c78f8876a6613c5e5038ecaa39b777 100644 (file)
@@ -556,7 +556,7 @@ pub struct LocalDecl<'tcx> {
     /// `drop(x)`, we want it to refer to `x: u32`.
     ///
     /// To allow both uses to work, we need to have more than a single scope
-    /// for a local. We have the `syntactic_source_info.scope` represent the
+    /// for a local. We have the `source_info.scope` represent the
     /// "syntactic" lint scope (with a variable being under its let
     /// block) while the `visibility_scope` represents the "local variable"
     /// scope (where the "rest" of a block is under all prior let-statements).
@@ -570,10 +570,10 @@ pub struct LocalDecl<'tcx> {
     ///  │ │{ #[allow(unused_mut] } // this is actually split into 2 scopes
     ///  │ │                        // in practice because I'm lazy.
     ///  │ │
-    ///  │ │← x.syntactic_source_info.scope
+    ///  │ │← x.source_info.scope
     ///  │ │← `x.parse().unwrap()`
     ///  │ │
-    ///  │ │ │← y.syntactic_source_info.scope
+    ///  │ │ │← y.source_info.scope
     ///  │ │
     ///  │ │ │{ let y: u32 }
     ///  │ │ │
@@ -584,10 +584,10 @@ pub struct LocalDecl<'tcx> {
     ///  │ │← x.visibility_scope
     ///  │ │← `drop(x)` // this accesses `x: u32`
     /// ```
-    pub syntactic_source_info: SourceInfo,
+    pub source_info: SourceInfo,
 
     /// Source scope within which the local is visible (for debuginfo)
-    /// (see `syntactic_source_info` for more details).
+    /// (see `source_info` for more details).
     pub visibility_scope: SourceScope,
 }
 
@@ -599,7 +599,7 @@ pub fn new_temp(ty: Ty<'tcx>, span: Span) -> Self {
             mutability: Mutability::Mut,
             ty,
             name: None,
-            syntactic_source_info: SourceInfo {
+            source_info: SourceInfo {
                 span,
                 scope: OUTERMOST_SOURCE_SCOPE
             },
@@ -616,7 +616,7 @@ pub fn new_internal(ty: Ty<'tcx>, span: Span) -> Self {
             mutability: Mutability::Mut,
             ty,
             name: None,
-            syntactic_source_info: SourceInfo {
+            source_info: SourceInfo {
                 span,
                 scope: OUTERMOST_SOURCE_SCOPE
             },
@@ -634,7 +634,7 @@ pub fn new_return_place(return_ty: Ty, span: Span) -> LocalDecl {
         LocalDecl {
             mutability: Mutability::Mut,
             ty: return_ty,
-            syntactic_source_info: SourceInfo {
+            source_info: SourceInfo {
                 span,
                 scope: OUTERMOST_SOURCE_SCOPE
             },
@@ -2191,7 +2191,7 @@ impl<'tcx> TypeFoldable<'tcx> for LocalDecl<'tcx> {
         internal,
         ty,
         name,
-        syntactic_source_info,
+        source_info,
         visibility_scope,
     }
 }
index 6cd1271cccff099d857303c08a88d14824d56e7e..758d887cd7b3ef59730f278a56c7007575ee9b65 100644 (file)
@@ -714,7 +714,7 @@ fn super_local_decl(&mut self,
                     mutability: _,
                     ref $($mutability)* ty,
                     name: _,
-                    ref $($mutability)* syntactic_source_info,
+                    ref $($mutability)* source_info,
                     ref $($mutability)* visibility_scope,
                     internal: _,
                     is_user_variable: _,
@@ -722,9 +722,9 @@ fn super_local_decl(&mut self,
 
                 self.visit_ty(ty, TyContext::LocalDecl {
                     local,
-                    source_info: *syntactic_source_info,
+                    source_info: *source_info,
                 });
-                self.visit_source_info(syntactic_source_info);
+                self.visit_source_info(source_info);
                 self.visit_source_scope(visibility_scope);
             }
 
index 26680937d41d59d9466d6d01a84c89387fdd6184..f9be91b4f3f13d93d2ae1ad16f66b31c1e03cbc0 100644 (file)
@@ -277,7 +277,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
                 let place = PlaceRef::alloca(&bx, layout, &name.as_str());
                 if dbg {
                     let (scope, span) = fx.debug_loc(mir::SourceInfo {
-                        span: decl.syntactic_source_info.span,
+                        span: decl.source_info.span,
                         scope: decl.visibility_scope,
                     });
                     declare_local(&bx, &fx.debug_context, name, layout.ty, scope,
index 9b5e266917b57bdc9a8486eb30eda48ca82df370..9061af1b68ca4717c9f4c562d22da3b79fb45013 100644 (file)
@@ -398,7 +398,7 @@ pub(super) fn report_borrowed_value_does_not_live_long_enough(
 
         let borrow_span = self.mir.source_info(borrow.reserve_location).span;
         let proper_span = match *root_place {
-            Place::Local(local) => self.mir.local_decls[local].syntactic_source_info.span,
+            Place::Local(local) => self.mir.local_decls[local].source_info.span,
             _ => drop_span,
         };
 
index 2c5d9156f2e04e5525d5eb7d2269733c33d846da..5efbdeafd1bbfe3144065b41dc8afb31e5dbc160 100644 (file)
@@ -306,12 +306,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
                 None => continue,
             }
 
-            let span = local_decl.syntactic_source_info.span;
+            let span = local_decl.source_info.span;
             let mut_span = tcx.sess.codemap().span_until_non_whitespace(span);
 
             tcx.struct_span_lint_node(
                 UNUSED_MUT,
-                vsi[local_decl.syntactic_source_info.scope].lint_root,
+                vsi[local_decl.source_info.scope].lint_root,
                 span,
                 "variable does not need to be mutable"
             )
index 10a0e4e127d2128a837d8f962082254bd9d4d341..2807a4e8857e0b91421dbf09506b2598f16fb48a 100644 (file)
@@ -67,7 +67,7 @@ pub(in borrow_check) fn explain_why_borrow_contains_point(
                             }
                             None => {
                                 err.span_label(
-                                    mir.local_decls[local].syntactic_source_info.span,
+                                    mir.local_decls[local].source_info.span,
                                     "borrow may end up in a temporary, created here",
                                 );
 
index bad5b40d340d6261ee285e69828ad236494f5192..04f5024b76946602cd2341f393ac30ba921fe7eb 100644 (file)
@@ -1201,7 +1201,7 @@ fn check_local(&mut self, mir: &Mir<'tcx>, local: Local, local_decl: &LocalDecl<
             LocalKind::Var | LocalKind::Temp => {}
         }
 
-        let span = local_decl.syntactic_source_info.span;
+        let span = local_decl.source_info.span;
         let ty = local_decl.ty;
 
         // Erase the regions from `ty` to get a global type.  The
index 398c619c0b1a4419a86710691c48f2635ae83c65..fbd771fbe500d7eb8fab1b18401ad1873a271d2a 100644 (file)
@@ -246,7 +246,7 @@ pub fn into_expr(&mut self,
                         mutability: Mutability::Mut,
                         ty: ptr_ty,
                         name: None,
-                        syntactic_source_info: source_info,
+                        source_info,
                         visibility_scope: source_info.scope,
                         internal: true,
                         is_user_variable: false
index 91812da2534ef9ebaa9a1297d7eabbd96e101a44..062a48a8c434d02e5029eedadb1cb1705ab884af 100644 (file)
@@ -306,7 +306,7 @@ pub fn declare_bindings(&mut self,
                             -> Option<SourceScope> {
         assert!(!(visibility_scope.is_some() && lint_level.is_explicit()),
                 "can't have both a visibility and a lint scope at the same time");
-        let mut syntactic_scope = self.source_scope;
+        let mut scope = self.source_scope;
         self.visit_bindings(pattern, &mut |this, mutability, name, var, span, ty| {
             if visibility_scope.is_none() {
                 visibility_scope = Some(this.new_source_scope(scope_span,
@@ -314,18 +314,18 @@ pub fn declare_bindings(&mut self,
                                                            None));
                 // If we have lints, create a new source scope
                 // that marks the lints for the locals. See the comment
-                // on the `syntactic_source_info` field for why this is needed.
+                // on the `source_info` field for why this is needed.
                 if lint_level.is_explicit() {
-                    syntactic_scope =
+                    scope =
                         this.new_source_scope(scope_span, lint_level, None);
                 }
             }
-            let syntactic_source_info = SourceInfo {
+            let source_info = SourceInfo {
                 span,
-                scope: syntactic_scope,
+                scope,
             };
             let visibility_scope = visibility_scope.unwrap();
-            this.declare_binding(syntactic_source_info, visibility_scope, mutability, name, var,
+            this.declare_binding(source_info, visibility_scope, mutability, name, var,
                                  ty, has_guard);
         });
         visibility_scope
@@ -1114,7 +1114,7 @@ fn bind_matched_candidate_for_arm_body(&mut self,
     /// `&T`. The second local is a binding for occurrences of `var`
     /// in the arm body, which will have type `T`.
     fn declare_binding(&mut self,
-                       syntactic_source_info: SourceInfo,
+                       source_info: SourceInfo,
                        visibility_scope: SourceScope,
                        mutability: Mutability,
                        name: Name,
@@ -1123,15 +1123,15 @@ fn declare_binding(&mut self,
                        has_guard: ArmHasGuard)
     {
         debug!("declare_binding(var_id={:?}, name={:?}, var_ty={:?}, visibility_scope={:?}, \
-                syntactic_source_info={:?})",
-               var_id, name, var_ty, visibility_scope, syntactic_source_info);
+                source_info={:?})",
+               var_id, name, var_ty, visibility_scope, source_info);
 
         let tcx = self.hir.tcx();
         let local = LocalDecl::<'tcx> {
             mutability,
             ty: var_ty.clone(),
             name: Some(name),
-            syntactic_source_info,
+            source_info,
             visibility_scope,
             internal: false,
             is_user_variable: true,
@@ -1143,7 +1143,7 @@ fn declare_binding(&mut self,
                 mutability,
                 ty: tcx.mk_imm_ref(tcx.types.re_empty, var_ty),
                 name: Some(name),
-                syntactic_source_info,
+                source_info,
                 visibility_scope,
                 internal: false,
                 is_user_variable: true,
index ea3a6ae68e79aace48051b367130be4e8cf452a8..ca7a2daf39d2ecb9bef31b465c8710bc89aa3ec6 100644 (file)
@@ -664,7 +664,7 @@ fn args_and_body(&mut self,
             self.local_decls.push(LocalDecl {
                 mutability: Mutability::Mut,
                 ty,
-                syntactic_source_info: source_info,
+                source_info,
                 visibility_scope: source_info.scope,
                 name,
                 internal: false,
index 2c6828d7cf90817f54e2443f89be6e72b22235ef..2ff22842141d9bfc806bff4ae7ca4b3f7f8b46c2 100644 (file)
@@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
     fn gather_args(&mut self) {
         for arg in self.mir.args_iter() {
             let path = self.data.rev_lookup.locals[arg];
-            let span = self.mir.local_decls[arg].syntactic_source_info.span;
+            let span = self.mir.local_decls[arg].source_info.span;
 
             let init = self.data.inits.push(Init {
                 path, span, kind: InitKind::Deep
index 19967cc323f9a7070c2d66cf3af847633f6e201d..d4a9b2cdd1fbf4022b819540a16387dca7211e8a 100644 (file)
@@ -141,7 +141,7 @@ fn temp_decl(mutability: Mutability, ty: Ty, span: Span) -> LocalDecl {
     let source_info = SourceInfo { scope: OUTERMOST_SOURCE_SCOPE, span };
     LocalDecl {
         mutability, ty, name: None,
-        syntactic_source_info: source_info,
+        source_info,
         visibility_scope: source_info.scope,
         internal: false,
         is_user_variable: false
index 38472418aab982d614b15924d78c640b96a8cb64..fedd0774df44cb20595283d211f029877b0c2de4 100644 (file)
@@ -166,7 +166,7 @@ fn visit_place(&mut self,
                         // Internal locals are used in the `move_val_init` desugaring.
                         // We want to check unsafety against the source info of the
                         // desugaring, rather than the source info of the RHS.
-                        self.source_info = self.mir.local_decls[local].syntactic_source_info;
+                        self.source_info = self.mir.local_decls[local].source_info;
                     }
                 }
                 let base_ty = base.ty(self.mir, self.tcx).to_ty(self.tcx);
index d084d09971d46de126d461cbd443f4c897857888..7ac3b7beb06d5358dc797eda9763208e3bc5d11a 100644 (file)
@@ -300,7 +300,7 @@ fn replace_result_variable<'tcx>(ret_ty: Ty<'tcx>,
         mutability: Mutability::Mut,
         ty: ret_ty,
         name: None,
-        syntactic_source_info: source_info,
+        source_info,
         visibility_scope: source_info.scope,
         internal: false,
         is_user_variable: false,
@@ -641,7 +641,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
         mutability: Mutability::Mut,
         ty: tcx.mk_nil(),
         name: None,
-        syntactic_source_info: source_info,
+        source_info,
         visibility_scope: source_info.scope,
         internal: false,
         is_user_variable: false,
@@ -657,7 +657,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
             mutbl: hir::Mutability::MutMutable,
         }),
         name: None,
-        syntactic_source_info: source_info,
+        source_info,
         visibility_scope: source_info.scope,
         internal: false,
         is_user_variable: false,
index cc1da268d68c176ef34c61d96361635db2648f0f..a1845f7ef268cd15a0b304c1ca67d1ad5cd092af 100644 (file)
@@ -398,9 +398,9 @@ fn inline_call(&self,
                 for loc in callee_mir.vars_and_temps_iter() {
                     let mut local = callee_mir.local_decls[loc].clone();
 
-                    local.syntactic_source_info.scope =
-                        scope_map[local.syntactic_source_info.scope];
-                    local.syntactic_source_info.span = callsite.location.span;
+                    local.source_info.scope =
+                        scope_map[local.source_info.scope];
+                    local.source_info.span = callsite.location.span;
                     local.visibility_scope = scope_map[local.visibility_scope];
 
                     let idx = caller_mir.local_decls.push(local);
index c61d5e268a990e11eb7a5ae2b186b1a7fb99ffef..8dc6539b65d6a8178ec2f1d8074991fc7522bae8 100644 (file)
@@ -210,7 +210,7 @@ fn promote_temp(&mut self, temp: Local) -> Local {
         let no_stmts = self.source[loc.block].statements.len();
         let new_temp = self.promoted.local_decls.push(
             LocalDecl::new_temp(self.source.local_decls[temp].ty,
-                                self.source.local_decls[temp].syntactic_source_info.span));
+                                self.source.local_decls[temp].source_info.span));
 
         debug!("promote({:?} @ {:?}/{:?}, {:?})",
                temp, loc, no_stmts, self.keep_original);
@@ -334,7 +334,7 @@ fn interior_base<'a, 'tcx>(place: &'a mut Place<'tcx>)
                             // This is because `*r` requires `r` to be a local,
                             // otherwise we would use the `promoted` directly.
                             let mut promoted_ref = LocalDecl::new_temp(ref_ty, span);
-                            promoted_ref.syntactic_source_info = statement.source_info;
+                            promoted_ref.source_info = statement.source_info;
                             promoted_ref.visibility_scope = statement.source_info.scope;
                             let promoted_ref = local_decls.push(promoted_ref);
                             assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref);
index 828d8fa60e8ba5174ac953cc725da25b0545c71c..719630129440a6defacbbe1cc3928914cb937e92 100644 (file)
@@ -1046,7 +1046,7 @@ fn visit_terminator_kind(&mut self,
                 // conservatively, that drop elaboration will do.
                 let needs_drop = if let Place::Local(local) = *place {
                     if self.local_qualif[local].map_or(true, |q| q.intersects(Qualif::NEEDS_DROP)) {
-                        Some(self.mir.local_decls[local].syntactic_source_info.span)
+                        Some(self.mir.local_decls[local].source_info.span)
                     } else {
                         None
                     }
@@ -1102,7 +1102,7 @@ fn visit_assign(&mut self,
                     let mut err = feature_err(
                         &self.tcx.sess.parse_sess,
                         "const_let",
-                        decl.syntactic_source_info.span,
+                        decl.source_info.span,
                         GateIssue::Language,
                         "arguments of constant functions can only be immutable by-value bindings"
                     );
index 520b7dfac4f7e4a80f6269e2092b4fd1db4fc841..8176c644dd7457b392b1fd07a62af275cd304e24 100644 (file)
@@ -467,8 +467,8 @@ fn write_scope_tree(
         // User variable types (including the user's name in a comment).
         for local in mir.vars_iter() {
             let var = &mir.local_decls[local];
-            let (name, source_info) = if var.syntactic_source_info.scope == child {
-                (var.name.unwrap(), var.syntactic_source_info)
+            let (name, source_info) = if var.source_info.scope == child {
+                (var.name.unwrap(), var.source_info)
             } else {
                 // Not a variable or not declared in this scope.
                 continue;