Auto merge of #28642 - petrochenkov:name3, r=nrc
This PR removes random remaining `Ident`s outside of libsyntax and performs general cleanup In particular, interfaces of `Name` and `Ident` are tidied up, `Name`s and `Ident`s being small `Copy` aggregates are always passed to functions by value, and `Ident`s are never used as keys in maps, because `Ident` comparisons are tricky. Although this PR closes https://github.com/rust-lang/rust/issues/6993 there's still work related to it: - `Name` can be made `NonZero` to compress numerous `Option<Name>`s and `Option<Ident>`s but it requires const unsafe functions. - Implementation of `PartialEq` on `Ident` should be eliminated and replaced with explicit hygienic, non-hygienic or member-wise comparisons. - Finally, large parts of AST can potentially be converted to `Name`s in the same way as HIR to clearly separate identifiers used in hygienic and non-hygienic contexts. r? @nrc
This commit is contained in:
commit
2e88c36ebc
70 changed files with 337 additions and 401 deletions
|
|
@ -35,7 +35,7 @@ impl LintPass for Pass {
|
|||
|
||||
impl EarlyLintPass for Pass {
|
||||
fn check_item(&mut self, cx: &EarlyContext, it: &ast::Item) {
|
||||
if it.ident.name == "lintme" {
|
||||
if it.ident.name.as_str() == "lintme" {
|
||||
cx.span_lint(TEST_LINT, it.span, "item is named 'lintme'");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ fn expand_mbe_matches(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
|
|||
|
||||
let mac_expr = match TokenTree::parse(cx, &mbe_matcher[..], args) {
|
||||
Success(map) => {
|
||||
match (&*map[&str_to_ident("matched")], &*map[&str_to_ident("pat")]) {
|
||||
match (&*map[&str_to_ident("matched").name], &*map[&str_to_ident("pat").name]) {
|
||||
(&MatchedNonterminal(NtExpr(ref matched_expr)),
|
||||
&MatchedSeq(ref pats, seq_sp)) => {
|
||||
let pats: Vec<P<Pat>> = pats.iter().map(|pat_nt|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue