aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/path.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-04 09:44:31 +0000
committerGitHub <[email protected]>2020-02-04 09:44:31 +0000
commit73c36fdbd2060bd455ffeef33dca1ecc2ae07ebb (patch)
tree59440abef01f92ac250e45cac4923dd6de712180 /crates/ra_hir_def/src/path.rs
parent918547dbe9a2907401102eba491ac25cebe1404d (diff)
parentf4f71e361ee632a7a09b633934a9c0a11f4a9be7 (diff)
Merge #2962
2962: Differentiate underscore alias from named aliases r=matklad a=zombiefungus pre for Fixing Issue 2736 edited to avoid autoclosing the issue Co-authored-by: zombiefungus <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/path.rs')
-rw-r--r--crates/ra_hir_def/src/path.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index a150b899f..246032c13 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -34,6 +34,14 @@ pub enum PathKind {
34 DollarCrate(CrateId), 34 DollarCrate(CrateId),
35} 35}
36 36
37#[derive(Debug, Clone, PartialEq, Eq)]
38pub enum ImportAlias {
39 /// Unnamed alias, as in `use Foo as _;`
40 Underscore,
41 /// Named alias
42 Alias(Name),
43}
44
37impl ModPath { 45impl ModPath {
38 pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> { 46 pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option<ModPath> {
39 lower::lower_path(path, hygiene).map(|it| it.mod_path) 47 lower::lower_path(path, hygiene).map(|it| it.mod_path)
@@ -57,7 +65,7 @@ impl ModPath {
57 pub(crate) fn expand_use_item( 65 pub(crate) fn expand_use_item(
58 item_src: InFile<ast::UseItem>, 66 item_src: InFile<ast::UseItem>,
59 hygiene: &Hygiene, 67 hygiene: &Hygiene,
60 mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<Name>), 68 mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option<ImportAlias>),
61 ) { 69 ) {
62 if let Some(tree) = item_src.value.use_tree() { 70 if let Some(tree) = item_src.value.use_tree() {
63 lower::lower_use_tree(None, tree, hygiene, &mut cb); 71 lower::lower_use_tree(None, tree, hygiene, &mut cb);