Skip to content

Commit 06d88cd

Browse files
committed
rustc: rename mir::LocalDecl's syntactic_source_info to source_info.
1 parent 6c53972 commit 06d88cd

File tree

19 files changed

+47
-47
lines changed

19 files changed

+47
-47
lines changed

src/librustc/ich/impls_mir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl_stable_hash_for!(struct mir::LocalDecl<'tcx> {
2525
mutability,
2626
ty,
2727
name,
28-
syntactic_source_info,
28+
source_info,
2929
visibility_scope,
3030
internal,
3131
is_user_variable

src/librustc/mir/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ pub struct LocalDecl<'tcx> {
556556
/// `drop(x)`, we want it to refer to `x: u32`.
557557
///
558558
/// To allow both uses to work, we need to have more than a single scope
559-
/// for a local. We have the `syntactic_source_info.scope` represent the
559+
/// for a local. We have the `source_info.scope` represent the
560560
/// "syntactic" lint scope (with a variable being under its let
561561
/// block) while the `visibility_scope` represents the "local variable"
562562
/// scope (where the "rest" of a block is under all prior let-statements).
@@ -570,10 +570,10 @@ pub struct LocalDecl<'tcx> {
570570
/// │ │{ #[allow(unused_mut] } // this is actually split into 2 scopes
571571
/// │ │ // in practice because I'm lazy.
572572
/// │ │
573-
/// │ │← x.syntactic_source_info.scope
573+
/// │ │← x.source_info.scope
574574
/// │ │← `x.parse().unwrap()`
575575
/// │ │
576-
/// │ │ │← y.syntactic_source_info.scope
576+
/// │ │ │← y.source_info.scope
577577
/// │ │
578578
/// │ │ │{ let y: u32 }
579579
/// │ │ │
@@ -584,10 +584,10 @@ pub struct LocalDecl<'tcx> {
584584
/// │ │← x.visibility_scope
585585
/// │ │← `drop(x)` // this accesses `x: u32`
586586
/// ```
587-
pub syntactic_source_info: SourceInfo,
587+
pub source_info: SourceInfo,
588588

589589
/// Source scope within which the local is visible (for debuginfo)
590-
/// (see `syntactic_source_info` for more details).
590+
/// (see `source_info` for more details).
591591
pub visibility_scope: SourceScope,
592592
}
593593

@@ -599,7 +599,7 @@ impl<'tcx> LocalDecl<'tcx> {
599599
mutability: Mutability::Mut,
600600
ty,
601601
name: None,
602-
syntactic_source_info: SourceInfo {
602+
source_info: SourceInfo {
603603
span,
604604
scope: OUTERMOST_SOURCE_SCOPE
605605
},
@@ -616,7 +616,7 @@ impl<'tcx> LocalDecl<'tcx> {
616616
mutability: Mutability::Mut,
617617
ty,
618618
name: None,
619-
syntactic_source_info: SourceInfo {
619+
source_info: SourceInfo {
620620
span,
621621
scope: OUTERMOST_SOURCE_SCOPE
622622
},
@@ -634,7 +634,7 @@ impl<'tcx> LocalDecl<'tcx> {
634634
LocalDecl {
635635
mutability: Mutability::Mut,
636636
ty: return_ty,
637-
syntactic_source_info: SourceInfo {
637+
source_info: SourceInfo {
638638
span,
639639
scope: OUTERMOST_SOURCE_SCOPE
640640
},
@@ -2191,7 +2191,7 @@ BraceStructTypeFoldableImpl! {
21912191
internal,
21922192
ty,
21932193
name,
2194-
syntactic_source_info,
2194+
source_info,
21952195
visibility_scope,
21962196
}
21972197
}

src/librustc/mir/visit.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -714,17 +714,17 @@ macro_rules! make_mir_visitor {
714714
mutability: _,
715715
ref $($mutability)* ty,
716716
name: _,
717-
ref $($mutability)* syntactic_source_info,
717+
ref $($mutability)* source_info,
718718
ref $($mutability)* visibility_scope,
719719
internal: _,
720720
is_user_variable: _,
721721
} = *local_decl;
722722

723723
self.visit_ty(ty, TyContext::LocalDecl {
724724
local,
725-
source_info: *syntactic_source_info,
725+
source_info: *source_info,
726726
});
727-
self.visit_source_info(syntactic_source_info);
727+
self.visit_source_info(source_info);
728728
self.visit_source_scope(visibility_scope);
729729
}
730730

src/librustc_codegen_llvm/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ pub fn codegen_mir<'a, 'tcx: 'a>(
277277
let place = PlaceRef::alloca(&bx, layout, &name.as_str());
278278
if dbg {
279279
let (scope, span) = fx.debug_loc(mir::SourceInfo {
280-
span: decl.syntactic_source_info.span,
280+
span: decl.source_info.span,
281281
scope: decl.visibility_scope,
282282
});
283283
declare_local(&bx, &fx.debug_context, name, layout.ty, scope,

src/librustc_mir/borrow_check/error_reporting.rs

+1-1
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].syntactic_source_info.span,
401+
Place::Local(local) => self.mir.local_decls[local].source_info.span,
402402
_ => drop_span,
403403
};
404404

src/librustc_mir/borrow_check/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,12 @@ fn do_mir_borrowck<'a, 'gcx, 'tcx>(
306306
None => continue,
307307
}
308308

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

312312
tcx.struct_span_lint_node(
313313
UNUSED_MUT,
314-
vsi[local_decl.syntactic_source_info.scope].lint_root,
314+
vsi[local_decl.source_info.scope].lint_root,
315315
span,
316316
"variable does not need to be mutable"
317317
)

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

+1-1
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].syntactic_source_info.span,
70+
mir.local_decls[local].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

+1-1
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.syntactic_source_info.span;
1204+
let span = local_decl.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

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
246246
mutability: Mutability::Mut,
247247
ty: ptr_ty,
248248
name: None,
249-
syntactic_source_info: source_info,
249+
source_info,
250250
visibility_scope: source_info.scope,
251251
internal: true,
252252
is_user_variable: false

src/librustc_mir/build/matches/mod.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -306,26 +306,26 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
306306
-> Option<SourceScope> {
307307
assert!(!(visibility_scope.is_some() && lint_level.is_explicit()),
308308
"can't have both a visibility and a lint scope at the same time");
309-
let mut syntactic_scope = self.source_scope;
309+
let mut scope = self.source_scope;
310310
self.visit_bindings(pattern, &mut |this, mutability, name, var, span, ty| {
311311
if visibility_scope.is_none() {
312312
visibility_scope = Some(this.new_source_scope(scope_span,
313313
LintLevel::Inherited,
314314
None));
315315
// If we have lints, create a new source scope
316316
// that marks the lints for the locals. See the comment
317-
// on the `syntactic_source_info` field for why this is needed.
317+
// on the `source_info` field for why this is needed.
318318
if lint_level.is_explicit() {
319-
syntactic_scope =
319+
scope =
320320
this.new_source_scope(scope_span, lint_level, None);
321321
}
322322
}
323-
let syntactic_source_info = SourceInfo {
323+
let source_info = SourceInfo {
324324
span,
325-
scope: syntactic_scope,
325+
scope,
326326
};
327327
let visibility_scope = visibility_scope.unwrap();
328-
this.declare_binding(syntactic_source_info, visibility_scope, mutability, name, var,
328+
this.declare_binding(source_info, visibility_scope, mutability, name, var,
329329
ty, has_guard);
330330
});
331331
visibility_scope
@@ -1114,7 +1114,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
11141114
/// `&T`. The second local is a binding for occurrences of `var`
11151115
/// in the arm body, which will have type `T`.
11161116
fn declare_binding(&mut self,
1117-
syntactic_source_info: SourceInfo,
1117+
source_info: SourceInfo,
11181118
visibility_scope: SourceScope,
11191119
mutability: Mutability,
11201120
name: Name,
@@ -1123,15 +1123,15 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
11231123
has_guard: ArmHasGuard)
11241124
{
11251125
debug!("declare_binding(var_id={:?}, name={:?}, var_ty={:?}, visibility_scope={:?}, \
1126-
syntactic_source_info={:?})",
1127-
var_id, name, var_ty, visibility_scope, syntactic_source_info);
1126+
source_info={:?})",
1127+
var_id, name, var_ty, visibility_scope, source_info);
11281128

11291129
let tcx = self.hir.tcx();
11301130
let local = LocalDecl::<'tcx> {
11311131
mutability,
11321132
ty: var_ty.clone(),
11331133
name: Some(name),
1134-
syntactic_source_info,
1134+
source_info,
11351135
visibility_scope,
11361136
internal: false,
11371137
is_user_variable: true,
@@ -1143,7 +1143,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
11431143
mutability,
11441144
ty: tcx.mk_imm_ref(tcx.types.re_empty, var_ty),
11451145
name: Some(name),
1146-
syntactic_source_info,
1146+
source_info,
11471147
visibility_scope,
11481148
internal: false,
11491149
is_user_variable: true,

src/librustc_mir/build/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
664664
self.local_decls.push(LocalDecl {
665665
mutability: Mutability::Mut,
666666
ty,
667-
syntactic_source_info: source_info,
667+
source_info,
668668
visibility_scope: source_info.scope,
669669
name,
670670
internal: false,

src/librustc_mir/dataflow/move_paths/builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
233233
fn gather_args(&mut self) {
234234
for arg in self.mir.args_iter() {
235235
let path = self.data.rev_lookup.locals[arg];
236-
let span = self.mir.local_decls[arg].syntactic_source_info.span;
236+
let span = self.mir.local_decls[arg].source_info.span;
237237

238238
let init = self.data.inits.push(Init {
239239
path, span, kind: InitKind::Deep

src/librustc_mir/shim.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ fn temp_decl(mutability: Mutability, ty: Ty, span: Span) -> LocalDecl {
141141
let source_info = SourceInfo { scope: OUTERMOST_SOURCE_SCOPE, span };
142142
LocalDecl {
143143
mutability, ty, name: None,
144-
syntactic_source_info: source_info,
144+
source_info,
145145
visibility_scope: source_info.scope,
146146
internal: false,
147147
is_user_variable: false

src/librustc_mir/transform/check_unsafety.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl<'a, 'tcx> Visitor<'tcx> for UnsafetyChecker<'a, 'tcx> {
166166
// Internal locals are used in the `move_val_init` desugaring.
167167
// We want to check unsafety against the source info of the
168168
// desugaring, rather than the source info of the RHS.
169-
self.source_info = self.mir.local_decls[local].syntactic_source_info;
169+
self.source_info = self.mir.local_decls[local].source_info;
170170
}
171171
}
172172
let base_ty = base.ty(self.mir, self.tcx).to_ty(self.tcx);

src/librustc_mir/transform/generator.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ fn replace_result_variable<'tcx>(ret_ty: Ty<'tcx>,
300300
mutability: Mutability::Mut,
301301
ty: ret_ty,
302302
name: None,
303-
syntactic_source_info: source_info,
303+
source_info,
304304
visibility_scope: source_info.scope,
305305
internal: false,
306306
is_user_variable: false,
@@ -641,7 +641,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
641641
mutability: Mutability::Mut,
642642
ty: tcx.mk_nil(),
643643
name: None,
644-
syntactic_source_info: source_info,
644+
source_info,
645645
visibility_scope: source_info.scope,
646646
internal: false,
647647
is_user_variable: false,
@@ -657,7 +657,7 @@ fn create_generator_drop_shim<'a, 'tcx>(
657657
mutbl: hir::Mutability::MutMutable,
658658
}),
659659
name: None,
660-
syntactic_source_info: source_info,
660+
source_info,
661661
visibility_scope: source_info.scope,
662662
internal: false,
663663
is_user_variable: false,

src/librustc_mir/transform/inline.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,9 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
398398
for loc in callee_mir.vars_and_temps_iter() {
399399
let mut local = callee_mir.local_decls[loc].clone();
400400

401-
local.syntactic_source_info.scope =
402-
scope_map[local.syntactic_source_info.scope];
403-
local.syntactic_source_info.span = callsite.location.span;
401+
local.source_info.scope =
402+
scope_map[local.source_info.scope];
403+
local.source_info.span = callsite.location.span;
404404
local.visibility_scope = scope_map[local.visibility_scope];
405405

406406
let idx = caller_mir.local_decls.push(local);

src/librustc_mir/transform/promote_consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
210210
let no_stmts = self.source[loc.block].statements.len();
211211
let new_temp = self.promoted.local_decls.push(
212212
LocalDecl::new_temp(self.source.local_decls[temp].ty,
213-
self.source.local_decls[temp].syntactic_source_info.span));
213+
self.source.local_decls[temp].source_info.span));
214214

215215
debug!("promote({:?} @ {:?}/{:?}, {:?})",
216216
temp, loc, no_stmts, self.keep_original);
@@ -334,7 +334,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> {
334334
// This is because `*r` requires `r` to be a local,
335335
// otherwise we would use the `promoted` directly.
336336
let mut promoted_ref = LocalDecl::new_temp(ref_ty, span);
337-
promoted_ref.syntactic_source_info = statement.source_info;
337+
promoted_ref.source_info = statement.source_info;
338338
promoted_ref.visibility_scope = statement.source_info.scope;
339339
let promoted_ref = local_decls.push(promoted_ref);
340340
assert_eq!(self.temps.push(TempState::Unpromotable), promoted_ref);

src/librustc_mir/transform/qualify_consts.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1046,7 +1046,7 @@ This does not pose a problem by itself because they can't be accessed directly."
10461046
// conservatively, that drop elaboration will do.
10471047
let needs_drop = if let Place::Local(local) = *place {
10481048
if self.local_qualif[local].map_or(true, |q| q.intersects(Qualif::NEEDS_DROP)) {
1049-
Some(self.mir.local_decls[local].syntactic_source_info.span)
1049+
Some(self.mir.local_decls[local].source_info.span)
10501050
} else {
10511051
None
10521052
}
@@ -1102,7 +1102,7 @@ This does not pose a problem by itself because they can't be accessed directly."
11021102
let mut err = feature_err(
11031103
&self.tcx.sess.parse_sess,
11041104
"const_let",
1105-
decl.syntactic_source_info.span,
1105+
decl.source_info.span,
11061106
GateIssue::Language,
11071107
"arguments of constant functions can only be immutable by-value bindings"
11081108
);

src/librustc_mir/util/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,8 @@ fn write_scope_tree(
467467
// User variable types (including the user's name in a comment).
468468
for local in mir.vars_iter() {
469469
let var = &mir.local_decls[local];
470-
let (name, source_info) = if var.syntactic_source_info.scope == child {
471-
(var.name.unwrap(), var.syntactic_source_info)
470+
let (name, source_info) = if var.source_info.scope == child {
471+
(var.name.unwrap(), var.source_info)
472472
} else {
473473
// Not a variable or not declared in this scope.
474474
continue;

0 commit comments

Comments
 (0)