diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-11-25 17:39:38 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-12-01 18:51:05 +0300 |
| commit | 1f259ae6799e7e0a08e5b84fc5686e404b17eef0 (patch) | |
| tree | 388417f61bf1eb19e633f3e613353f01c05b8730 /compiler/rustc_ast_lowering/src/path.rs | |
| parent | 6cd4dd3091dfe0ce4a728bd9ae177361fba23736 (diff) | |
| download | rust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.tar.gz rust-1f259ae6799e7e0a08e5b84fc5686e404b17eef0.zip | |
rustc_hir: Change representation of import paths to support multiple resolutions
Diffstat (limited to 'compiler/rustc_ast_lowering/src/path.rs')
| -rw-r--r-- | compiler/rustc_ast_lowering/src/path.rs | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/compiler/rustc_ast_lowering/src/path.rs b/compiler/rustc_ast_lowering/src/path.rs index dc85b5e95ea..8d23c26e603 100644 --- a/compiler/rustc_ast_lowering/src/path.rs +++ b/compiler/rustc_ast_lowering/src/path.rs @@ -12,7 +12,7 @@ use rustc_hir::GenericArg; use rustc_span::symbol::{kw, Ident}; use rustc_span::{BytePos, Span, DUMMY_SP}; -use smallvec::smallvec; +use smallvec::{smallvec, SmallVec}; impl<'a, 'hir> LoweringContext<'a, 'hir> { #[instrument(level = "trace", skip(self))] @@ -144,13 +144,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { ); } - pub(crate) fn lower_path_extra( + pub(crate) fn lower_use_path( &mut self, - res: Res, + res: SmallVec<[Res; 3]>, p: &Path, param_mode: ParamMode, - ) -> &'hir hir::Path<'hir> { - self.arena.alloc(hir::Path { + ) -> &'hir hir::UsePath<'hir> { + self.arena.alloc(hir::UsePath { res, segments: self.arena.alloc_from_iter(p.segments.iter().map(|segment| { self.lower_path_segment( @@ -165,17 +165,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { }) } - pub(crate) fn lower_path( - &mut self, - id: NodeId, - p: &Path, - param_mode: ParamMode, - ) -> &'hir hir::Path<'hir> { - let res = self.expect_full_res(id); - let res = self.lower_res(res); - self.lower_path_extra(res, p, param_mode) - } - pub(crate) fn lower_path_segment( &mut self, path_span: Span, |
