Skip to content

Commit 0895590

Browse files
committed
rustc: rename mir::LocalDecl's source_info to visibility_source_info.
1 parent b10c157 commit 0895590

File tree

20 files changed

+60
-59
lines changed

20 files changed

+60
-59
lines changed

src/librustc/ich/impls_mir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
2525
mutability,
2626
ty,
2727
name,
28-
source_info,
2928
syntactic_source_info,
29+
visibility_source_info,
3030
internal,
3131
is_user_variable
3232
});

src/librustc/mir/mod.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,6 @@ pub struct LocalDecl<'tcx> {
505505
/// to generate better debuginfo.
506506
pub name: Option<Name>,
507507

508-
/// Source info of the local. The `SourceScope` is the *visibility* one,
509-
/// not the the *syntactic* one (see `syntactic_source_info` for more details).
510-
pub source_info: SourceInfo,
511-
512508
/// The *syntactic* (i.e. not visibility) source scope the local is defined
513509
/// in. If the local was defined in a let-statement, this
514510
/// is *within* the let-statement, rather than outside
@@ -562,7 +558,7 @@ pub struct LocalDecl<'tcx> {
562558
/// To allow both uses to work, we need to have more than a single scope
563559
/// for a local. We have the `syntactic_source_info.scope` represent the
564560
/// "syntactic" lint scope (with a variable being under its let
565-
/// block) while the `source_info.scope` represents the "local variable"
561+
/// block) while the `visibility_source_info.scope` represents the "local variable"
566562
/// scope (where the "rest" of a block is under all prior let-statements).
567563
///
568564
/// The end result looks like this:
@@ -581,14 +577,18 @@ pub struct LocalDecl<'tcx> {
581577
/// │ │
582578
/// │ │ │{ let y: u32 }
583579
/// │ │ │
584-
/// │ │ │← y.source_info.scope
580+
/// │ │ │← y.visibility_source_info.scope
585581
/// │ │ │← `y + 2`
586582
/// │
587583
/// │ │{ let x: u32 }
588-
/// │ │← x.source_info.scope
584+
/// │ │← x.visibility_source_info.scope
589585
/// │ │← `drop(x)` // this accesses `x: u32`
590586
/// ```
591587
pub syntactic_source_info: SourceInfo,
588+
589+
/// Source info of the local. The `SourceScope` is the *visibility* one,
590+
/// not the the *syntactic* one (see `syntactic_source_info` for more details).
591+
pub visibility_source_info: SourceInfo,
592592
}
593593

594594
impl<'tcx> LocalDecl<'tcx> {
@@ -599,11 +599,11 @@ impl<'tcx> LocalDecl<'tcx> {
599599
mutability: Mutability::Mut,
600600
ty,
601601
name: None,
602-
source_info: SourceInfo {
602+
syntactic_source_info: SourceInfo {
603603
span,
604604
scope: OUTERMOST_SOURCE_SCOPE
605605
},
606-
syntactic_source_info: SourceInfo {
606+
visibility_source_info: SourceInfo {
607607
span,
608608
scope: OUTERMOST_SOURCE_SCOPE
609609
},
@@ -619,11 +619,11 @@ impl<'tcx> LocalDecl<'tcx> {
619619
mutability: Mutability::Mut,
620620
ty,
621621
name: None,
622-
source_info: SourceInfo {
622+
syntactic_source_info: SourceInfo {
623623
span,
624624
scope: OUTERMOST_SOURCE_SCOPE
625625
},
626-
syntactic_source_info: SourceInfo {
626+
visibility_source_info: SourceInfo {
627627
span,
628628
scope: OUTERMOST_SOURCE_SCOPE
629629
},
@@ -640,11 +640,11 @@ impl<'tcx> LocalDecl<'tcx> {
640640
LocalDecl {
641641
mutability: Mutability::Mut,
642642
ty: return_ty,
643-
source_info: SourceInfo {
643+
syntactic_source_info: SourceInfo {
644644
span,
645645
scope: OUTERMOST_SOURCE_SCOPE
646646
},
647-
syntactic_source_info: SourceInfo {
647+
visibility_source_info: SourceInfo {
648648
span,
649649
scope: OUTERMOST_SOURCE_SCOPE
650650
},
@@ -2200,8 +2200,8 @@ BraceStructTypeFoldableImpl! {
22002200
internal,
22012201
ty,
22022202
name,
2203-
source_info,
22042203
syntactic_source_info,
2204+
visibility_source_info,
22052205
}
22062206
}
22072207

src/librustc/mir/visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,18 +714,18 @@ macro_rules! make_mir_visitor {
714714
mutability: _,
715715
ref $($mutability)* ty,
716716
name: _,
717-
ref $($mutability)* source_info,
718-
internal: _,
719717
ref $($mutability)* syntactic_source_info,
718+
ref $($mutability)* visibility_source_info,
719+
internal: _,
720720
is_user_variable: _,
721721
} = *local_decl;
722722

723723
self.visit_ty(ty, TyContext::LocalDecl {
724724
local,
725-
source_info: *source_info,
725+
source_info: *visibility_source_info,
726726
});
727727
self.visit_source_info(syntactic_source_info);
728-
self.visit_source_info(source_info);
728+
self.visit_source_info(visibility_source_info);
729729
}
730730

731731
fn super_source_scope(&mut self,

src/librustc_codegen_llvm/debuginfo/create_scope_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn create_mir_scopes(cx: &CodegenCx, mir: &Mir, debug_context: &FunctionDebu
6565
let mut has_variables = BitVector::new(mir.source_scopes.len());
6666
for var in mir.vars_iter() {
6767
let decl = &mir.local_decls[var];
68-
has_variables.insert(decl.source_info.scope.index());
68+
has_variables.insert(decl.visibility_source_info.scope.index());
6969
}
7070

7171
// Instantiate all scopes.

src/librustc_codegen_llvm/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
265265

266266
if let Some(name) = decl.name {
267267
// User variable
268-
let debug_scope = fx.scopes[decl.source_info.scope];
268+
let debug_scope = fx.scopes[decl.visibility_source_info.scope];
269269
let dbg = debug_scope.is_valid() && bx.sess().opts.debuginfo == FullDebugInfo;
270270

271271
if !memory_locals.contains(local.index()) && !dbg {
@@ -276,7 +276,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
276276
debug!("alloc: {:?} ({}) -> place", local, name);
277277
let place = PlaceRef::alloca(&bx, layout, &name.as_str());
278278
if dbg {
279-
let (scope, span) = fx.debug_loc(decl.source_info);
279+
let (scope, span) = fx.debug_loc(decl.visibility_source_info);
280280
declare_local(&bx, &fx.debug_context, name, layout.ty, scope,
281281
VariableAccess::DirectVariable { alloca: place.llval },
282282
VariableKind::LocalVariable, span);

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
398398

399399
let borrow_span = self.mir.source_info(borrow.reserve_location).span;
400400
let proper_span = match *root_place {
401-
Place::Local(local) => self.mir.local_decls[local].source_info.span,
401+
Place::Local(local) => self.mir.local_decls[local].visibility_source_info.span,
402402
_ => drop_span,
403403
};
404404

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
306306
None => continue,
307307
}
308308

309-
let source_info = local_decl.source_info;
309+
let source_info = local_decl.visibility_source_info;
310310
let mut_span = tcx.sess.codemap().span_until_non_whitespace(source_info.span);
311311

312312
tcx.struct_span_lint_node(

src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
6767
}
6868
None => {
6969
err.span_label(
70-
mir.local_decls[local].source_info.span,
70+
mir.local_decls[local].visibility_source_info.span,
7171
"borrow may end up in a temporary, created here",
7272
);
7373

src/librustc_mir/borrow_check/nll/type_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> {
12011201
LocalKind::Var | LocalKind::Temp => {}
12021202
}
12031203

1204-
let span = local_decl.source_info.span;
1204+
let span = local_decl.visibility_source_info.span;
12051205
let ty = local_decl.ty;
12061206

12071207
// Erase the regions from `ty` to get a global type. The

src/librustc_mir/build/expr/into.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
246246
mutability: Mutability::Mut,
247247
ty: ptr_ty,
248248
name: None,
249-
source_info,
250249
syntactic_source_info: source_info,
250+
visibility_source_info: source_info,
251251
internal: true,
252252
is_user_variable: false
253253
});

0 commit comments

Comments
 (0)