Skip to content

Commit 08a00eb

Browse files
committed
Address review comments.
1 parent bb0ae3c commit 08a00eb

File tree

6 files changed

+9
-10
lines changed

6 files changed

+9
-10
lines changed

compiler/rustc_ast_lowering/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
17831783
self.arena.alloc(hir::Path {
17841784
span: self.lower_span(span),
17851785
res,
1786-
segments: arena_vec![self; hir::PathSegment::from_ident(ident, hir_id, res)],
1786+
segments: arena_vec![self; hir::PathSegment::new(ident, hir_id, res)],
17871787
}),
17881788
));
17891789

compiler/rustc_ast_lowering/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14381438
res,
14391439
segments: self
14401440
.arena
1441-
.alloc_from_iter([hir::PathSegment::from_ident(ident, hir_id, res)]),
1441+
.alloc_from_iter([hir::PathSegment::new(ident, hir_id, res)]),
14421442
});
14431443
let ty_id = self.next_id();
14441444
let bounded_ty =

compiler/rustc_ast_lowering/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12671267
None,
12681268
self.arena.alloc(hir::Path {
12691269
res,
1270-
segments: arena_vec![self; hir::PathSegment::from_ident(
1270+
segments: arena_vec![self; hir::PathSegment::new(
12711271
Ident::with_dummy_span(kw::SelfUpper),
12721272
hir_id,
12731273
res
@@ -2203,7 +2203,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22032203
self.arena.alloc(hir::Path {
22042204
span: self.lower_span(span),
22052205
res,
2206-
segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)],
2206+
segments:
2207+
arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)],
22072208
}),
22082209
));
22092210

compiler/rustc_ast_lowering/src/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
262262
self.arena.alloc(hir::Path {
263263
span: self.lower_span(ident.span),
264264
res,
265-
segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)],
265+
segments: arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)],
266266
}),
267267
))
268268
}

compiler/rustc_hir/src/hir.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ impl Path<'_> {
202202
pub struct PathSegment<'hir> {
203203
/// The identifier portion of this path segment.
204204
pub ident: Ident,
205-
206205
pub hir_id: HirId,
207-
208206
pub res: Res,
209207

210208
/// Type/lifetime parameters attached to this path. They come in
@@ -223,12 +221,12 @@ pub struct PathSegment<'hir> {
223221

224222
impl<'hir> PathSegment<'hir> {
225223
/// Converts an identifier to the corresponding segment.
226-
pub fn from_ident(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> {
224+
pub fn new(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> {
227225
PathSegment { ident, hir_id, res, infer_args: true, args: None }
228226
}
229227

230228
pub fn invalid() -> Self {
231-
Self::from_ident(Ident::empty(), HirId::INVALID, Res::Err)
229+
Self::new(Ident::empty(), HirId::INVALID, Res::Err)
232230
}
233231

234232
pub fn args(&self) -> &GenericArgs<'hir> {

compiler/rustc_save_analysis/src/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ impl<'tcx> DumpVisitor<'tcx> {
914914
| Res::SelfTy { .. } => {
915915
self.dump_path_segment_ref(
916916
id,
917-
&hir::PathSegment::from_ident(ident, hir::HirId::INVALID, Res::Err),
917+
&hir::PathSegment::new(ident, hir::HirId::INVALID, Res::Err),
918918
);
919919
}
920920
def => {

0 commit comments

Comments
 (0)