Skip to content

Commit ca1ac6b

Browse files
committed
rustc: rename mir::SourceScopeInfo to mir::SourceScopeLocalData.
1 parent 85d44c4 commit ca1ac6b

File tree

8 files changed

+38
-38
lines changed

8 files changed

+38
-38
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ for mir::ProjectionElem<'gcx, V, T>
364364
}
365365

366366
impl_stable_hash_for!(struct mir::SourceScopeData { span, parent_scope });
367-
impl_stable_hash_for!(struct mir::SourceScopeInfo {
367+
impl_stable_hash_for!(struct mir::SourceScopeLocalData {
368368
lint_root, safety
369369
});
370370

src/librustc/mir/mod.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ pub struct Mir<'tcx> {
8484

8585
/// Crate-local information for each source scope, that can't (and
8686
/// needn't) be tracked across crates.
87-
pub source_scope_info: ClearCrossCrate<IndexVec<SourceScope, SourceScopeInfo>>,
87+
pub source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope, SourceScopeLocalData>>,
8888

8989
/// Rvalues promoted from this function, such as borrows of constants.
9090
/// 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);
138138
impl<'tcx> Mir<'tcx> {
139139
pub fn new(basic_blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
140140
source_scopes: IndexVec<SourceScope, SourceScopeData>,
141-
source_scope_info: ClearCrossCrate<IndexVec<SourceScope,
142-
SourceScopeInfo>>,
141+
source_scope_local_data: ClearCrossCrate<IndexVec<SourceScope,
142+
SourceScopeLocalData>>,
143143
promoted: IndexVec<Promoted, Mir<'tcx>>,
144144
yield_ty: Option<Ty<'tcx>>,
145145
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
@@ -154,7 +154,7 @@ impl<'tcx> Mir<'tcx> {
154154
Mir {
155155
basic_blocks,
156156
source_scopes,
157-
source_scope_info,
157+
source_scope_local_data,
158158
promoted,
159159
yield_ty,
160160
generator_drop: None,
@@ -308,14 +308,6 @@ impl<'tcx> Mir<'tcx> {
308308
}
309309
}
310310

311-
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
312-
pub struct SourceScopeInfo {
313-
/// A NodeId with lint levels equivalent to this scope's lint levels.
314-
pub lint_root: ast::NodeId,
315-
/// The unsafe block that contains this node.
316-
pub safety: Safety,
317-
}
318-
319311
#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable)]
320312
pub enum Safety {
321313
Safe,
@@ -330,7 +322,7 @@ pub enum Safety {
330322
impl_stable_hash_for!(struct Mir<'tcx> {
331323
basic_blocks,
332324
source_scopes,
333-
source_scope_info,
325+
source_scope_local_data,
334326
promoted,
335327
yield_ty,
336328
generator_drop,
@@ -1515,6 +1507,14 @@ pub struct SourceScopeData {
15151507
pub parent_scope: Option<SourceScope>,
15161508
}
15171509

1510+
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
1511+
pub struct SourceScopeLocalData {
1512+
/// A NodeId with lint levels equivalent to this scope's lint levels.
1513+
pub lint_root: ast::NodeId,
1514+
/// The unsafe block that contains this node.
1515+
pub safety: Safety,
1516+
}
1517+
15181518
///////////////////////////////////////////////////////////////////////////
15191519
// Operands
15201520

@@ -2155,16 +2155,16 @@ CloneTypeFoldableAndLiftImpls! {
21552155
SourceInfo,
21562156
UpvarDecl,
21572157
ValidationOp,
2158-
SourceScopeData,
21592158
SourceScope,
2160-
SourceScopeInfo,
2159+
SourceScopeData,
2160+
SourceScopeLocalData,
21612161
}
21622162

21632163
BraceStructTypeFoldableImpl! {
21642164
impl<'tcx> TypeFoldable<'tcx> for Mir<'tcx> {
21652165
basic_blocks,
21662166
source_scopes,
2167-
source_scope_info,
2167+
source_scope_local_data,
21682168
promoted,
21692169
yield_ty,
21702170
generator_drop,

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
292292
debug!("mbcx.used_mut: {:?}", mbcx.used_mut);
293293

294294
for local in mbcx.mir.mut_vars_and_args_iter().filter(|local| !mbcx.used_mut.contains(local)) {
295-
if let ClearCrossCrate::Set(ref vsi) = mbcx.mir.source_scope_info {
295+
if let ClearCrossCrate::Set(ref vsi) = mbcx.mir.source_scope_local_data {
296296
let local_decl = &mbcx.mir.local_decls[local];
297297

298298
// Skip implicit `self` argument for closures

src/librustc_mir/build/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ struct Builder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
257257
/// the vector of all scopes that we have created thus far;
258258
/// we track this for debuginfo later
259259
source_scopes: IndexVec<SourceScope, SourceScopeData>,
260-
source_scope_info: IndexVec<SourceScope, SourceScopeInfo>,
260+
source_scope_local_data: IndexVec<SourceScope, SourceScopeLocalData>,
261261
source_scope: SourceScope,
262262

263263
/// the guard-context: each time we build the guard expression for
@@ -595,7 +595,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
595595
scopes: vec![],
596596
source_scopes: IndexVec::new(),
597597
source_scope: OUTERMOST_SOURCE_SCOPE,
598-
source_scope_info: IndexVec::new(),
598+
source_scope_local_data: IndexVec::new(),
599599
guard_context: vec![],
600600
push_unsafe_count: 0,
601601
unpushed_unsafe: safety,
@@ -630,7 +630,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
630630

631631
Mir::new(self.cfg.basic_blocks,
632632
self.source_scopes,
633-
ClearCrossCrate::Set(self.source_scope_info),
633+
ClearCrossCrate::Set(self.source_scope_local_data),
634634
IndexVec::new(),
635635
yield_ty,
636636
self.local_decls,

src/librustc_mir/build/scope.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
323323
let sets = tcx.lint_levels(LOCAL_CRATE);
324324
let parent_hir_id =
325325
tcx.hir.definitions().node_to_hir_id(
326-
self.source_scope_info[source_scope].lint_root
326+
self.source_scope_local_data[source_scope].lint_root
327327
);
328328
let current_hir_id =
329329
tcx.hir.definitions().node_to_hir_id(node_id);
@@ -517,22 +517,22 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
517517
let parent = self.source_scope;
518518
debug!("new_source_scope({:?}, {:?}, {:?}) - parent({:?})={:?}",
519519
span, lint_level, safety,
520-
parent, self.source_scope_info.get(parent));
520+
parent, self.source_scope_local_data.get(parent));
521521
let scope = self.source_scopes.push(SourceScopeData {
522522
span,
523523
parent_scope: Some(parent),
524524
});
525-
let scope_info = SourceScopeInfo {
525+
let scope_local_data = SourceScopeLocalData {
526526
lint_root: if let LintLevel::Explicit(lint_root) = lint_level {
527527
lint_root
528528
} else {
529-
self.source_scope_info[parent].lint_root
529+
self.source_scope_local_data[parent].lint_root
530530
},
531531
safety: safety.unwrap_or_else(|| {
532-
self.source_scope_info[parent].safety
532+
self.source_scope_local_data[parent].safety
533533
})
534534
};
535-
self.source_scope_info.push(scope_info);
535+
self.source_scope_local_data.push(scope_local_data);
536536
scope
537537
}
538538

src/librustc_mir/transform/check_unsafety.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use util;
2727

2828
pub struct UnsafetyChecker<'a, 'tcx: 'a> {
2929
mir: &'a Mir<'tcx>,
30-
source_scope_info: &'a IndexVec<SourceScope, SourceScopeInfo>,
30+
source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>,
3131
violations: Vec<UnsafetyViolation>,
3232
source_info: SourceInfo,
3333
tcx: TyCtxt<'a, 'tcx, 'tcx>,
@@ -38,12 +38,12 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> {
3838

3939
impl<'a, 'gcx, 'tcx> UnsafetyChecker<'a, 'tcx> {
4040
fn new(mir: &'a Mir<'tcx>,
41-
source_scope_info: &'a IndexVec<SourceScope, SourceScopeInfo>,
41+
source_scope_local_data: &'a IndexVec<SourceScope, SourceScopeLocalData>,
4242
tcx: TyCtxt<'a, 'tcx, 'tcx>,
4343
param_env: ty::ParamEnv<'tcx>) -> Self {
4444
Self {
4545
mir,
46-
source_scope_info,
46+
source_scope_local_data,
4747
violations: vec![],
4848
source_info: SourceInfo {
4949
span: mir.span,
@@ -147,7 +147,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
147147
if util::is_disaligned(self.tcx, self.mir, self.param_env, place) {
148148
let source_info = self.source_info;
149149
let lint_root =
150-
self.source_scope_info[source_info.scope].lint_root;
150+
self.source_scope_local_data[source_info.scope].lint_root;
151151
self.register_violations(&[UnsafetyViolation {
152152
source_info,
153153
description: Symbol::intern("borrow of packed field").as_interned_str(),
@@ -212,7 +212,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
212212
} else if self.tcx.is_foreign_item(def_id) {
213213
let source_info = self.source_info;
214214
let lint_root =
215-
self.source_scope_info[source_info.scope].lint_root;
215+
self.source_scope_local_data[source_info.scope].lint_root;
216216
self.register_violations(&[UnsafetyViolation {
217217
source_info,
218218
description: Symbol::intern("use of extern static").as_interned_str(),
@@ -240,7 +240,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> {
240240
fn register_violations(&mut self,
241241
violations: &[UnsafetyViolation],
242242
unsafe_blocks: &[(ast::NodeId, bool)]) {
243-
let within_unsafe = match self.source_scope_info[self.source_info.scope].safety {
243+
let within_unsafe = match self.source_scope_local_data[self.source_info.scope].safety {
244244
Safety::Safe => {
245245
for violation in violations {
246246
if !self.violations.contains(violation) {
@@ -327,7 +327,7 @@ fn unsafety_check_result<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
327327
// `mir_built` force this.
328328
let mir = &tcx.mir_built(def_id).borrow();
329329

330-
let source_scope_info = match mir.source_scope_info {
330+
let source_scope_local_data = match mir.source_scope_local_data {
331331
ClearCrossCrate::Set(ref data) => data,
332332
ClearCrossCrate::Clear => {
333333
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)
340340

341341
let param_env = tcx.param_env(def_id);
342342
let mut checker = UnsafetyChecker::new(
343-
mir, source_scope_info, tcx, param_env);
343+
mir, source_scope_local_data, tcx, param_env);
344344
checker.visit_mir(mir);
345345

346346
check_unused_unsafe(tcx, def_id, &checker.used_unsafe, &mut checker.inherited_blocks);

src/librustc_mir/transform/const_prop.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
338338
.bits();
339339
let right_size = self.tcx.layout_of(self.param_env.and(right.1)).unwrap().size;
340340
if r.to_bits(right_size).ok().map_or(false, |b| b >= left_bits as u128) {
341-
let scope_info = match self.mir.source_scope_info {
341+
let source_scope_local_data = match self.mir.source_scope_local_data {
342342
ClearCrossCrate::Set(ref data) => data,
343343
ClearCrossCrate::Clear => return None,
344344
};
@@ -347,7 +347,7 @@ impl<'b, 'a, 'tcx:'b> ConstPropagator<'b, 'a, 'tcx> {
347347
} else {
348348
"left"
349349
};
350-
let node_id = scope_info[source_info.scope].lint_root;
350+
let node_id = source_scope_local_data[source_info.scope].lint_root;
351351
self.tcx.lint_node(
352352
::rustc::lint::builtin::EXCEEDING_BITSHIFTS,
353353
node_id,

src/librustc_mir/transform/promote_consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>,
425425
// FIXME: maybe try to filter this to avoid blowing up
426426
// memory usage?
427427
mir.source_scopes.clone(),
428-
mir.source_scope_info.clone(),
428+
mir.source_scope_local_data.clone(),
429429
IndexVec::new(),
430430
None,
431431
initial_locals,

0 commit comments

Comments
 (0)