diff options
| -rw-r--r-- | compiler/rustc_ast_lowering/src/expr.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/item.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/lib.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_ast_lowering/src/pat.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_save_analysis/src/dump_visitor.rs | 2 |
6 files changed, 9 insertions, 10 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs index d31ec91fcaa..22245692d13 100644 --- a/compiler/rustc_ast_lowering/src/expr.rs +++ b/compiler/rustc_ast_lowering/src/expr.rs @@ -1783,7 +1783,7 @@ impl<'hir> LoweringContext<'_, 'hir> { self.arena.alloc(hir::Path { span: self.lower_span(span), res, - segments: arena_vec![self; hir::PathSegment::from_ident(ident, hir_id, res)], + segments: arena_vec![self; hir::PathSegment::new(ident, hir_id, res)], }), )); diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 778203acf7d..8ca52269d6e 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -1438,7 +1438,7 @@ impl<'hir> LoweringContext<'_, 'hir> { res, segments: self .arena - .alloc_from_iter([hir::PathSegment::from_ident(ident, hir_id, res)]), + .alloc_from_iter([hir::PathSegment::new(ident, hir_id, res)]), }); let ty_id = self.next_id(); let bounded_ty = diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 097855bb6bf..5832bf91790 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1267,7 +1267,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { None, self.arena.alloc(hir::Path { res, - segments: arena_vec![self; hir::PathSegment::from_ident( + segments: arena_vec![self; hir::PathSegment::new( Ident::with_dummy_span(kw::SelfUpper), hir_id, res @@ -2203,7 +2203,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.arena.alloc(hir::Path { span: self.lower_span(span), res, - segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)], + segments: + arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)], }), )); diff --git a/compiler/rustc_ast_lowering/src/pat.rs b/compiler/rustc_ast_lowering/src/pat.rs index a23f5fddc57..87ccf5861e1 100644 --- a/compiler/rustc_ast_lowering/src/pat.rs +++ b/compiler/rustc_ast_lowering/src/pat.rs @@ -262,7 +262,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { self.arena.alloc(hir::Path { span: self.lower_span(ident.span), res, - segments: arena_vec![self; hir::PathSegment::from_ident(self.lower_ident(ident), hir_id, res)], + segments: arena_vec![self; hir::PathSegment::new(self.lower_ident(ident), hir_id, res)], }), )) } diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 561045ff4ef..b395917cd7a 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -202,9 +202,7 @@ impl Path<'_> { pub struct PathSegment<'hir> { /// The identifier portion of this path segment. pub ident: Ident, - pub hir_id: HirId, - pub res: Res, /// Type/lifetime parameters attached to this path. They come in @@ -223,12 +221,12 @@ pub struct PathSegment<'hir> { impl<'hir> PathSegment<'hir> { /// Converts an identifier to the corresponding segment. - pub fn from_ident(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> { + pub fn new(ident: Ident, hir_id: HirId, res: Res) -> PathSegment<'hir> { PathSegment { ident, hir_id, res, infer_args: true, args: None } } pub fn invalid() -> Self { - Self::from_ident(Ident::empty(), HirId::INVALID, Res::Err) + Self::new(Ident::empty(), HirId::INVALID, Res::Err) } pub fn args(&self) -> &GenericArgs<'hir> { diff --git a/compiler/rustc_save_analysis/src/dump_visitor.rs b/compiler/rustc_save_analysis/src/dump_visitor.rs index f2b2daaf20b..d95ade594fb 100644 --- a/compiler/rustc_save_analysis/src/dump_visitor.rs +++ b/compiler/rustc_save_analysis/src/dump_visitor.rs @@ -914,7 +914,7 @@ impl<'tcx> DumpVisitor<'tcx> { | Res::SelfTy { .. } => { self.dump_path_segment_ref( id, - &hir::PathSegment::from_ident(ident, hir::HirId::INVALID, Res::Err), + &hir::PathSegment::new(ident, hir::HirId::INVALID, Res::Err), ); } def => { |
