Skip to content

Commit 98cc18a

Browse files
committed
rename hir::map::name_by_hir_id to ::name
1 parent 468647c commit 98cc18a

File tree

16 files changed

+25
-25
lines changed

16 files changed

+25
-25
lines changed

src/librustc/hir/map/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ impl<'hir> Map<'hir> {
940940
}
941941
}
942942

943-
pub fn name_by_hir_id(&self, id: HirId) -> Name {
943+
pub fn name(&self, id: HirId) -> Name {
944944
match self.get_by_hir_id(id) {
945945
Node::Item(i) => i.ident.name,
946946
Node::ForeignItem(fi) => fi.ident.name,
@@ -951,7 +951,7 @@ impl<'hir> Map<'hir> {
951951
Node::Lifetime(lt) => lt.name.ident().name,
952952
Node::GenericParam(param) => param.name.ident().name,
953953
Node::Binding(&Pat { node: PatKind::Binding(_, _, l, _), .. }) => l.name,
954-
Node::Ctor(..) => self.name_by_hir_id(self.get_parent_item(id)),
954+
Node::Ctor(..) => self.name(self.get_parent_item(id)),
955955
_ => bug!("no name for {}", self.node_to_string(id))
956956
}
957957
}

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,7 +1583,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
15831583
format!(" for lifetime parameter `{}` in coherence check", name)
15841584
}
15851585
infer::UpvarRegion(ref upvar_id, _) => {
1586-
let var_name = self.tcx.hir().name_by_hir_id(upvar_id.var_path.hir_id);
1586+
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
15871587
format!(" for capture of `{}` by closure", var_name)
15881588
}
15891589
infer::NLL(..) => bug!("NLL variable found in lexical phase"),

src/librustc/infer/error_reporting/note.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
3131
"...so that reference does not outlive borrowed content");
3232
}
3333
infer::ReborrowUpvar(span, ref upvar_id) => {
34-
let var_name = self.tcx.hir().name_by_hir_id(upvar_id.var_path.hir_id);
34+
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
3535
err.span_note(span,
3636
&format!("...so that closure can access `{}`", var_name));
3737
}
@@ -50,7 +50,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
5050
err.span_note(span,
5151
&format!("...so that captured variable `{}` does not outlive the \
5252
enclosing closure",
53-
self.tcx.hir().name_by_hir_id(id)));
53+
self.tcx.hir().name(id)));
5454
}
5555
infer::IndexSlice(span) => {
5656
err.span_note(span, "...so that slice is not indexed outside the lifetime");
@@ -163,7 +163,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
163163
err
164164
}
165165
infer::ReborrowUpvar(span, ref upvar_id) => {
166-
let var_name = self.tcx.hir().name_by_hir_id(upvar_id.var_path.hir_id);
166+
let var_name = self.tcx.hir().name(upvar_id.var_path.hir_id);
167167
let mut err = struct_span_err!(self.tcx.sess,
168168
span,
169169
E0313,
@@ -220,7 +220,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
220220
E0474,
221221
"captured variable `{}` does not outlive the \
222222
enclosing closure",
223-
self.tcx.hir().name_by_hir_id(id));
223+
self.tcx.hir().name(id));
224224
self.tcx.note_and_explain_region(region_scope_tree, &mut err,
225225
"captured variable is valid for ", sup, "");
226226
self.tcx.note_and_explain_region(region_scope_tree, &mut err,

src/librustc/mir/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
25712571

25722572
if let Some(upvars) = tcx.upvars(def_id) {
25732573
for (&var_id, place) in upvars.keys().zip(places) {
2574-
let var_name = tcx.hir().name_by_hir_id(var_id);
2574+
let var_name = tcx.hir().name(var_id);
25752575
struct_fmt.field(&var_name.as_str(), place);
25762576
}
25772577
}
@@ -2590,7 +2590,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
25902590

25912591
if let Some(upvars) = tcx.upvars(def_id) {
25922592
for (&var_id, place) in upvars.keys().zip(places) {
2593-
let var_name = tcx.hir().name_by_hir_id(var_id);
2593+
let var_name = tcx.hir().name(var_id);
25942594
struct_fmt.field(&var_name.as_str(), place);
25952595
}
25962596
}

src/librustc/ty/print/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ pub trait PrettyPrinter<'tcx>:
600600
p!(
601601
write("{}{}:",
602602
sep,
603-
self.tcx().hir().name_by_hir_id(var_id)),
603+
self.tcx().hir().name(var_id)),
604604
print(upvar_ty));
605605
sep = ", ";
606606
}
@@ -643,7 +643,7 @@ pub trait PrettyPrinter<'tcx>:
643643
p!(
644644
write("{}{}:",
645645
sep,
646-
self.tcx().hir().name_by_hir_id(var_id)),
646+
self.tcx().hir().name(var_id)),
647647
print(upvar_ty));
648648
sep = ", ";
649649
}

src/librustc/ty/structural_impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl fmt::Debug for ty::ClosureUpvar<'tcx> {
6262
impl fmt::Debug for ty::UpvarId {
6363
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
6464
let name = ty::tls::with(|tcx| {
65-
tcx.hir().name_by_hir_id(self.var_path.hir_id)
65+
tcx.hir().name(self.var_path.hir_id)
6666
});
6767
write!(f, "UpvarId({:?};`{}`;{:?})",
6868
self.var_path.hir_id,

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,10 +1394,10 @@ impl BorrowckCtxt<'_, 'tcx> {
13941394
out: &mut String) {
13951395
match loan_path.kind {
13961396
LpUpvar(ty::UpvarId { var_path: ty::UpvarPath { hir_id: id }, closure_expr_id: _ }) => {
1397-
out.push_str(&self.tcx.hir().name_by_hir_id(id).as_str());
1397+
out.push_str(&self.tcx.hir().name(id).as_str());
13981398
}
13991399
LpVar(id) => {
1400-
out.push_str(&self.tcx.hir().name_by_hir_id(id).as_str());
1400+
out.push_str(&self.tcx.hir().name(id).as_str());
14011401
}
14021402

14031403
LpDowncast(ref lp_base, variant_def_id) => {

src/librustc_mir/borrow_check/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
853853
format!(
854854
"...but `{}` will be dropped here, when the function `{}` returns",
855855
name,
856-
self.infcx.tcx.hir().name_by_hir_id(fn_hir_id),
856+
self.infcx.tcx.hir().name(fn_hir_id),
857857
),
858858
);
859859

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
349349
let (&var_id, _) = self.infcx.tcx.upvars(def_id).unwrap()
350350
.get_index(field.index()).unwrap();
351351

352-
self.infcx.tcx.hir().name_by_hir_id(var_id).to_string()
352+
self.infcx.tcx.hir().name(var_id).to_string()
353353
}
354354
_ => {
355355
// Might need a revision when the fields in trait RFC is implemented

src/librustc_mir/borrow_check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn do_mir_borrowck<'a, 'tcx>(
130130
ty::UpvarCapture::ByRef(..) => true,
131131
};
132132
let mut upvar = Upvar {
133-
name: tcx.hir().name_by_hir_id(var_hir_id),
133+
name: tcx.hir().name(var_hir_id),
134134
var_hir_id,
135135
by_ref,
136136
mutability: Mutability::Not,

0 commit comments

Comments
 (0)