From 04715cbe1caf92e55d393a352a12454ba958845e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 18 Dec 2019 17:41:33 +0100 Subject: Forbid ::foo syntax in mod paths --- crates/ra_hir_def/src/path/lower.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/path') diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index c71b52d89..62aafd508 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs @@ -22,6 +22,7 @@ pub(super) use lower_use::lower_use_tree; /// It correctly handles `$crate` based path from macro call. pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option { let mut kind = PathKind::Plain; + let mut type_anchor = None; let mut segments = Vec::new(); let mut generic_args = Vec::new(); loop { @@ -63,7 +64,8 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option match trait_ref { // ::foo None => { - kind = PathKind::Type(Box::new(self_type)); + type_anchor = Some(Box::new(self_type)); + kind = PathKind::Plain; } // >::Foo desugars to Trait::Foo Some(trait_ref) => { @@ -111,7 +113,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option segments.reverse(); generic_args.reverse(); let mod_path = ModPath { kind, segments }; - return Some(Path { mod_path, generic_args }); + return Some(Path { type_anchor, mod_path, generic_args }); fn qualifier(path: &ast::Path) -> Option { if let Some(q) = path.qualifier() { -- cgit v1.2.3