mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 20:34:06 +00:00
Add make::glob_use_tree function to create star-only UseTree
This commit is contained in:
parent
b874721752
commit
45298b5d2a
@ -233,15 +233,7 @@ fn recursive_merge(
|
|||||||
None,
|
None,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
use_trees.insert(
|
use_trees.insert(idx, make::glob_use_tree());
|
||||||
idx,
|
|
||||||
make::use_tree(
|
|
||||||
make::path_unqualified(make::path_segment_self()),
|
|
||||||
None,
|
|
||||||
None,
|
|
||||||
true,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -806,14 +798,14 @@ use std::io;",
|
|||||||
check_full(
|
check_full(
|
||||||
"token::TokenKind",
|
"token::TokenKind",
|
||||||
r"use token::TokenKind::*;",
|
r"use token::TokenKind::*;",
|
||||||
r"use token::TokenKind::{self::*, self};",
|
r"use token::TokenKind::{*, self};",
|
||||||
)
|
)
|
||||||
// FIXME: have it emit `use token::TokenKind::{self, *}`?
|
// FIXME: have it emit `use token::TokenKind::{self, *}`?
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn merge_self_glob() {
|
fn merge_self_glob() {
|
||||||
check_full("self", r"use self::*;", r"use self::{self::*, self};")
|
check_full("self", r"use self::*;", r"use self::{*, self};")
|
||||||
// FIXME: have it emit `use {self, *}`?
|
// FIXME: have it emit `use {self, *}`?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,10 @@ pub fn path_from_text(text: &str) -> ast::Path {
|
|||||||
ast_from_text(text)
|
ast_from_text(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn glob_use_tree() -> ast::UseTree {
|
||||||
|
ast_from_text("use *;")
|
||||||
|
}
|
||||||
|
|
||||||
pub fn use_tree(
|
pub fn use_tree(
|
||||||
path: ast::Path,
|
path: ast::Path,
|
||||||
use_tree_list: Option<ast::UseTreeList>,
|
use_tree_list: Option<ast::UseTreeList>,
|
||||||
|
Loading…
Reference in New Issue
Block a user