diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-05-28 17:37:48 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2018-05-30 20:30:09 +0300 |
| commit | ca1ac6b6fb820765a678fa3decb343fa9f720737 (patch) | |
| tree | e4e480099b7d500d1c90a42bd5871c8519b0080e | |
| parent | 85d44c42764fb87e1f581fa6206727e82cd7d52d (diff) | |
| download | rust-ca1ac6b6fb820765a678fa3decb343fa9f720737.tar.gz rust-ca1ac6b6fb820765a678fa3decb343fa9f720737.zip | |
rustc: rename mir::SourceScopeInfo to mir::SourceScopeLocalData.
| -rw-r--r-- | src/librustc/ich/impls_mir.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/mod.rs | 32 | ||||
| -rw-r--r-- | src/librustc_mir/borrow_check/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/build/mod.rs | 6 | ||||
| -rw-r--r-- | src/librustc_mir/build/scope.rs | 12 | ||||
| -rw-r--r-- | src/librustc_mir/transform/check_unsafety.rs | 16 | ||||
| -rw-r--r-- | src/librustc_mir/transform/const_prop.rs | 4 | ||||
| -rw-r--r-- | src/librustc_mir/transform/promote_consts.rs | 2 |
8 files changed, 38 insertions, 38 deletions
diff --git a/src/librustc/ich/impls_mir.rs b/src/librustc/ich/impls_mir.rs index d4081d29c25..59d5ce278c6 100644 --- a/src/librustc/ich/impls_mir.rs +++ b/src/librustc/ich/impls_mir.rs @@ -364,7 +364,7 @@ for mir::ProjectionElem<'gcx, V, T> } impl_stable_hash_for!(struct mir::SourceScopeData { span, parent_scope }); -impl_stable_hash_for!(struct mir::SourceScopeInfo { +impl_stable_hash_for!(struct mir::SourceScopeLocalData { lint_root, safety }); diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 3956d150232..b60be21773b 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -84,7 +84,7 @@ pub struct Mir<'tcx> { /// Crate-local information for each source scope, that can't (and /// needn't) be tracked across crates. - pub source_scope_info: ClearCrossCrate<IndexVec<SourceScope, SourceScopeInfo>>, + pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>, /// Rvalues promoted from this function, such as borrows of constants. /// Each of them is the Mir of a constant with the fn's type parameters @@ -138,8 +138,8 @@ pub const START_BLOCK: BasicBlock = BasicBlock(0); impl<'tcx> Mir<'tcx> { pub fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>, source_scopes: IndexVec<SourceScope, SourceScopeData>, - source_scope_info: ClearCrossCrate<IndexVec<SourceScope, - SourceScopeInfo>>, + source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, + SourceScopeLocalData>>, promoted: IndexVec<Promoted, Mir<'tcx>>, yield_ty: Option<Ty<'tcx>>, local_decls: IndexVec<Local, LocalDecl<'tcx>>, @@ -154,7 +154,7 @@ impl<'tcx> Mir<'tcx> { Mir { basic_blocks, source_scopes, - source_scope_info, + source_scope_local_data, promoted, yield_ty, generator_drop: None, @@ -308,14 +308,6 @@ impl<'tcx> Mir<'tcx> { } } -#[derive(Clone, Debug, RustcEncodable, RustcDecodable)] -pub struct SourceScopeInfo { - /// A NodeId with lint levels equivalent to this scope's lint levels. - pub lint_root: ast::NodeId, - /// The unsafe block that contains this node. - pub safety: Safety, -} - #[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)] pub enum Safety { Safe, @@ -330,7 +322,7 @@ pub enum Safety { impl_stable_hash_for!(struct Mir<'tcx> { basic_blocks, source_scopes, - source_scope_info, + source_scope_local_data, promoted, yield_ty, generator_drop, @@ -1515,6 +1507,14 @@ pub struct SourceScopeData { pub parent_scope: Option<SourceScope>, } +#[derive(Clone, Debug, RustcEncodable, RustcDecodable)] +pub struct SourceScopeLocalData { + /// A NodeId with lint levels equivalent to this scope's lint levels. + pub lint_root: ast::NodeId, + /// The unsafe block that contains this node. + pub safety: Safety, +} + /////////////////////////////////////////////////////////////////////////// // Operands @@ -2155,16 +2155,16 @@ CloneTypeFoldableAndLiftImpls! { SourceInfo, UpvarDecl, ValidationOp, - SourceScopeData, SourceScope, - SourceScopeInfo, + SourceScopeData, + SourceScopeLocalData, } BraceStructTypeFoldableImpl! { impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> { basic_blocks, source_scopes, - source_scope_info, + source_scope_local_data, promoted, yield_ty, generator_drop, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index d18c9d72c6d..0257af0c89f 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -292,7 +292,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>( debug!("mbcx.used_mut: {:?}", mbcx.used_mut); for local in mbcx.mir.mut_vars_and_args_iter().filter(|local| !mbcx.used_mut.contains(local)) { - if let ClearCrossCrate::Set(ref vsi) = mbcx.mir.source_scope_info { + if let ClearCrossCrate::Set(ref vsi) = mbcx.mir.source_scope_local_data { let local_decl = &mbcx.mir.local_decls[local]; // Skip implicit `self` argument for closures diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 2bc885fb442..23a266d47cf 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -257,7 +257,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { /// the vector of all scopes that we have created thus far; /// we track this for debuginfo later source_scopes: IndexVec<SourceScope, SourceScopeData>, - source_scope_info: IndexVec<SourceScope, SourceScopeInfo>, + source_scope_local_data: IndexVec<SourceScope, SourceScopeLocalData>, source_scope: SourceScope, /// the guard-context: each time we build the guard expression for @@ -595,7 +595,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { scopes: vec![], source_scopes: IndexVec::new(), source_scope: OUTERMOST_SOURCE_SCOPE, - source_scope_info: IndexVec::new(), + source_scope_local_data: IndexVec::new(), guard_context: vec![], push_unsafe_count: 0, unpushed_unsafe: safety, @@ -630,7 +630,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { Mir::new(self.cfg.basic_blocks, self.source_scopes, - ClearCrossCrate::Set(self.source_scope_info), + ClearCrossCrate::Set(self.source_scope_local_data), IndexVec::new(), yield_ty, self.local_decls, diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index a1eb8bcdf7c..ee0a087a1dd 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -323,7 +323,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let sets = tcx.lint_levels(LOCAL_CRATE); let parent_hir_id = tcx.hir.definitions().node_to_hir_id( - self.source_scope_info[source_scope].lint_root + self.source_scope_local_data[source_scope].lint_root ); let current_hir_id = tcx.hir.definitions().node_to_hir_id(node_id); @@ -517,22 +517,22 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let parent = self.source_scope; debug!("new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}", span, lint_level, safety, - parent, self.source_scope_info.get(parent)); + parent, self.source_scope_local_data.get(parent)); let scope = self.source_scopes.push(SourceScopeData { span, parent_scope: Some(parent), }); - let scope_info = SourceScopeInfo { + let scope_local_data = SourceScopeLocalData { lint_root: if let LintLevel::Explicit(lint_root) = lint_level { lint_root } else { - self.source_scope_info[parent].lint_root + self.source_scope_local_data[parent].lint_root }, safety: safety.unwrap_or_else(|| { - self.source_scope_info[parent].safety + self.source_scope_local_data[parent].safety }) }; - self.source_scope_info.push(scope_info); + self.source_scope_local_data.push(scope_local_data); scope } diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index e5a71c6ac3a..fedd0774df4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -27,7 +27,7 @@ use util; pub struct UnsafetyChecker<'a, 'tcx: 'a> { mir: &'a Mir<'tcx>, - source_scope_info: &'a IndexVec<SourceScope, SourceScopeInfo>, + source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>, violations: Vec<UnsafetyViolation>, source_info: SourceInfo, tcx: TyCtxt<'a, 'tcx, 'tcx>, @@ -38,12 +38,12 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> { fn new(mir: &'a Mir<'tcx>, - source_scope_info: &'a IndexVec<SourceScope, SourceScopeInfo>, + source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>, tcx: TyCtxt<'a, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> Self { Self { mir, - source_scope_info, + source_scope_local_data, violations: vec![], source_info: SourceInfo { span: mir.span, @@ -147,7 +147,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { if util::is_disaligned(self.tcx, self.mir, self.param_env, place) { let source_info = self.source_info; let lint_root = - self.source_scope_info[source_info.scope].lint_root; + self.source_scope_local_data[source_info.scope].lint_root; self.register_violations(&[UnsafetyViolation { source_info, description: Symbol::intern("borrow of packed field").as_interned_str(), @@ -212,7 +212,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> { } else if self.tcx.is_foreign_item(def_id) { let source_info = self.source_info; let lint_root = - self.source_scope_info[source_info.scope].lint_root; + self.source_scope_local_data[source_info.scope].lint_root; self.register_violations(&[UnsafetyViolation { source_info, description: Symbol::intern("use of extern static").as_interned_str(), @@ -240,7 +240,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { fn register_violations(&mut self, violations: &[UnsafetyViolation], unsafe_blocks: &[(ast::NodeId, bool)]) { - let within_unsafe = match self.source_scope_info[self.source_info.scope].safety { + let within_unsafe = match self.source_scope_local_data[self.source_info.scope].safety { Safety::Safe => { for violation in violations { if !self.violations.contains(violation) { @@ -327,7 +327,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) // `mir_built` force this. let mir = &tcx.mir_built(def_id).borrow(); - let source_scope_info = match mir.source_scope_info { + let source_scope_local_data = match mir.source_scope_local_data { ClearCrossCrate::Set(ref data) => data, ClearCrossCrate::Clear => { debug!("unsafety_violations: {:?} - remote, skipping", def_id); @@ -340,7 +340,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) let param_env = tcx.param_env(def_id); let mut checker = UnsafetyChecker::new( - mir, source_scope_info, tcx, param_env); + mir, source_scope_local_data, tcx, param_env); checker.visit_mir(mir); check_unused_unsafe(tcx, def_id, &checker.used_unsafe, &mut checker.inherited_blocks); diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 580b7e208f9..ef61fe099bf 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -338,7 +338,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> { .bits(); let right_size = self.tcx.layout_of(self.param_env.and(right.1)).unwrap().size; if r.to_bits(right_size).ok().map_or(false, |b| b >= left_bits as u128) { - let scope_info = match self.mir.source_scope_info { + let source_scope_local_data = match self.mir.source_scope_local_data { ClearCrossCrate::Set(ref data) => data, ClearCrossCrate::Clear => return None, }; @@ -347,7 +347,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> { } else { "left" }; - let node_id = scope_info[source_info.scope].lint_root; + let node_id = source_scope_local_data[source_info.scope].lint_root; self.tcx.lint_node( ::rustc::lint::builtin::EXCEEDING_BITSHIFTS, node_id, diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index e9face62ad3..19bc4fd03f4 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -425,7 +425,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, // FIXME: maybe try to filter this to avoid blowing up // memory usage? mir.source_scopes.clone(), - mir.source_scope_info.clone(), + mir.source_scope_local_data.clone(), IndexVec::new(), None, initial_locals, |
