diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-03-16 13:16:44 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-16 13:16:44 +0100 |
| commit | 8872d9057230e46f4bf35af5880cc6095a06e744 (patch) | |
| tree | 66780180c8104b7528546896aa9e7ebec9ce6333 /src/librustc/ty | |
| parent | 8f2482b8012993a7e173f2296880818c1b90a0ca (diff) | |
| parent | db638bd123b7b73be691f7b4daebb61469587a27 (diff) | |
| download | rust-8872d9057230e46f4bf35af5880cc6095a06e744.tar.gz rust-8872d9057230e46f4bf35af5880cc6095a06e744.zip | |
Rollup merge of #69989 - petrochenkov:nolegacy, r=eddyb,matthewjasper
resolve/hygiene: `macro_rules` are not "legacy" The "modern" vs "legacy" naming was introduced by jseyfried during initial implementation of macros 2.0. At this point it's clear that `macro_rules` are not going anywhere and won't be deprecated in the near future. So this PR changes the naming "legacy" (when it implies "macro_rules") to "macro_rules". This should also help people reading this code because it's wasn't obvious that "legacy" actually meant "macro_rules" in these contexts. The most contentious renaming here is probably ``` fn modern -> fn normalize_to_macros_2_0 fn modern_and_legacy -> fn normalize_to_macro_rules ``` Other alternatives that I could think of are `normalize_to_opaque`/`normalize_to_semitransparent`, or `strip_non_opaque`/`strip_transparent`, but they seemed less intuitive. The documentation to these functions can be found in `symbol.rs`. r? @matthewjasper
Diffstat (limited to 'src/librustc/ty')
| -rw-r--r-- | src/librustc/ty/mod.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index d3c4ddf1ed3..338ff45a4ac 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -3083,7 +3083,7 @@ impl<'tcx> TyCtxt<'tcx> { pub fn hygienic_eq(self, use_name: Ident, def_name: Ident, def_parent_def_id: DefId) -> bool { // We could use `Ident::eq` here, but we deliberately don't. The name // comparison fails frequently, and we want to avoid the expensive - // `modern()` calls required for the span comparison whenever possible. + // `normalize_to_macros_2_0()` calls required for the span comparison whenever possible. use_name.name == def_name.name && use_name .span @@ -3099,7 +3099,7 @@ impl<'tcx> TyCtxt<'tcx> { } pub fn adjust_ident(self, mut ident: Ident, scope: DefId) -> Ident { - ident.span.modernize_and_adjust(self.expansion_that_defined(scope)); + ident.span.normalize_to_macros_2_0_and_adjust(self.expansion_that_defined(scope)); ident } @@ -3109,12 +3109,14 @@ impl<'tcx> TyCtxt<'tcx> { scope: DefId, block: hir::HirId, ) -> (Ident, DefId) { - let scope = match ident.span.modernize_and_adjust(self.expansion_that_defined(scope)) { - Some(actual_expansion) => { - self.hir().definitions().parent_module_of_macro_def(actual_expansion) - } - None => self.parent_module(block), - }; + let scope = + match ident.span.normalize_to_macros_2_0_and_adjust(self.expansion_that_defined(scope)) + { + Some(actual_expansion) => { + self.hir().definitions().parent_module_of_macro_def(actual_expansion) + } + None => self.parent_module(block), + }; (ident, scope) } |
