Skip to content

Commit 11020f1

Browse files
committed
Address review comments.
1 parent edcb8b0 commit 11020f1

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
@@ -1777,7 +1777,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
17771777
self.arena.alloc(hir::Path {
17781778
span: self.lower_span(span),
17791779
res,
1780-
segments: arena_vec![self; hir::PathSegment::from_ident(ident, hir_id, res)],
1780+
segments: arena_vec![self; hir::PathSegment::new(ident, hir_id, res)],
17811781
}),
17821782
));
17831783

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
@@ -1264,7 +1264,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12641264
None,
12651265
self.arena.alloc(hir::Path {
12661266
res,
1267-
segments: arena_vec![self; hir::PathSegment::from_ident(
1267+
segments: arena_vec![self; hir::PathSegment::new(
12681268
Ident::with_dummy_span(kw::SelfUpper),
12691269
hir_id,
12701270
res
@@ -2200,7 +2200,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
22002200
self.arena.alloc(hir::Path {
22012201
span: self.lower_span(span),
22022202
res,
2203-
segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)],
2203+
segments:
2204+
arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)],
22042205
}),
22052206
));
22062207

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
@@ -916,7 +916,7 @@ impl<'tcx> DumpVisitor<'tcx> {
916916
| Res::SelfTy { .. } => {
917917
self.dump_path_segment_ref(
918918
id,
919-
&hir::PathSegment::from_ident(ident, hir::HirId::INVALID, Res::Err),
919+
&hir::PathSegment::new(ident, hir::HirId::INVALID, Res::Err),
920920
);
921921
}
922922
def => {

0 commit comments

Comments
 (0)