From 39d992ef559c9cd67551819a9d63ef52ef7b725f Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 1 Apr 2021 20:35:21 +0200 Subject: Intern Attr, MacroCall and Path components --- crates/hir_def/src/path/lower.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/path/lower.rs') diff --git a/crates/hir_def/src/path/lower.rs b/crates/hir_def/src/path/lower.rs index 4de951fd3..28f6244da 100644 --- a/crates/hir_def/src/path/lower.rs +++ b/crates/hir_def/src/path/lower.rs @@ -2,6 +2,7 @@ mod lower_use; +use crate::intern::Interned; use std::sync::Arc; use either::Either; @@ -74,10 +75,11 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option // >::Foo desugars to Trait::Foo Some(trait_ref) => { let path = Path::from_src(trait_ref.path()?, hygiene)?; + let mod_path = (*path.mod_path).clone(); let num_segments = path.mod_path.segments.len(); - kind = path.mod_path.kind; + kind = mod_path.kind; - let mut prefix_segments = path.mod_path.segments; + let mut prefix_segments = mod_path.segments; prefix_segments.reverse(); segments.extend(prefix_segments); @@ -140,7 +142,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option } } - let mod_path = ModPath::from_segments(kind, segments); + let mod_path = Interned::new(ModPath::from_segments(kind, segments)); return Some(Path { type_anchor, mod_path, generic_args }); fn qualifier(path: &ast::Path) -> Option { -- cgit v1.2.3