Commit e5a2b25
authored
Rollup merge of #150521 - petrochenkov:decl, r=nnethercote
resolve: Rename "name bindings" to "name declarations"
This was discussed previously in some name resolution specification threads on zulip.
Link: [#t-compiler/help > understanding early name resolution of imports @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/understanding.20early.20name.20resolution.20of.20imports/near/545306658)
The main change is that `NameBinding` is renamed to `Decl`.
The `Name` part is skipped because almost everything in `rustc_resolve` is about names.
So in general the naming looks more compact now (`binding: NameBinding` -> `decl: Decl`).
I didn't rename *everything* including all the local variables, but did rename most of significant interfaces.
Late resolution in particular uses "bindings" in slightly different meanings, I didn't touch that.
Also, some interface comments are added/improved.
Renaming list:
- fn `define_binding_local` -> `plant_decl_into_local_module`
- fn `add_macro_use_binding` -> `add_macro_use_decl`
- fn `binding_description` -> `decl_description`
- enum `PendingBinding` -> `PendingDecl`
- field `ImportKind::Single::bindings` -> `ImportKind::Single::decls`
- field `NameResolution::non_glob_binding` -> `NameResolution::non_glob_decl`
- field `NameResolution::glob_binding` -> `NameResolution::glob_decl`
- fn `best_binding` -> `best_decl`
- fn `import` -> `new_import_decl`
- fn `try_define_local` -> `try_plant_decl_into_local_module`
- fn `new_ambiguity_binding` -> `new_decl_with_ambiguity`
- fn `new_warn_ambiguity_binding` -> `new_decl_with_warn_ambiguity`
- field `UnnecessaryQualification::binding` -> `UnnecessaryQualification::decl`
- struct `MacroRulesBinding` -> `MacroRulesDef`
- field `MacroRulesBinding::binding` -> `MacroRulesDef::decl`
- variant `MacroRulesScope::Binding` -> `MacroRulesScope::Def`
- enum `LexicalScopeBinding` -> `LateDecl`
- variant `LexicalScopeBinding::Item` -> `LateDecl::Decl`
- variant `LexicalScopeBinding::Res` -> `LateDecl::RibDef`
- field `ModuleData::self_binding` -> `ModuleData::self_decl`
- struct `NameBindingData` -> `DeclData`
- type `NameBinding` -> `Decl`
- enum `NameBindingKind` -> `DeclKind`
- variant `NameBindingKind::Res` -> `DeclKind::Def`
- field `NameBindingKind::Import::binding` -> `DeclKind::Import::source_decl`
- field `PrivacyError::binding` -> `PrivacyError::decl`
- field `ExternPreludeEntry::item_binding` -> `ExternPreludeEntry::item_decl`
- field `ExternPreludeEntry::flag_binding` -> `ExternPreludeEntry::flag_decl`
- field `Resolver::binding_parent_modules` -> `Resolver::decl_parent_modules`
- field `Resolver::dummy_binding` -> `Resolver::dummy_decl`
- field `Resolver::builtin_types_bindings` -> `Resolver::builtin_type_decls`
- field `Resolver::builtin_attrs_bindings` -> `Resolver::builtin_attr_decls`
- field `Resolver::registered_tool_bindings` -> `Resolver::registered_tool_decls`
- fn `ResolverArenas::new_res_binding` -> `ResolverArenas::new_def_decl`
- fn `ResolverArenas::new_pub_res_binding` -> `ResolverArenas::new_pub_def_decl`
- fn `ResolverArenas::alloc_name_binding` -> `ResolverArenas::alloc_decl`
- fn `ResolverArenas::alloc_macro_rules_binding` -> `ResolverArenas::alloc_macro_rules_def`
- fn `set_binding_parent_module` -> `set_decl_parent_module`11 files changed
Lines changed: 596 additions & 639 deletions
File tree
- compiler
- rustc_middle/src
- rustc_resolve/src
- late
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | | - | |
| 36 | + | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | | - | |
57 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| 62 | + | |
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
71 | | - | |
72 | | - | |
| 73 | + | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
82 | 85 | | |
83 | 86 | | |
84 | 87 | | |
85 | | - | |
| 88 | + | |
86 | 89 | | |
87 | | - | |
88 | | - | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | | - | |
105 | | - | |
| 107 | + | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
284 | 287 | | |
285 | 288 | | |
286 | 289 | | |
287 | | - | |
| 290 | + | |
288 | 291 | | |
289 | 292 | | |
290 | 293 | | |
| |||
691 | 694 | | |
692 | 695 | | |
693 | 696 | | |
694 | | - | |
| 697 | + | |
695 | 698 | | |
696 | 699 | | |
697 | 700 | | |
| |||
977 | 980 | | |
978 | 981 | | |
979 | 982 | | |
980 | | - | |
| 983 | + | |
981 | 984 | | |
982 | 985 | | |
983 | 986 | | |
| |||
997 | 1000 | | |
998 | 1001 | | |
999 | 1002 | | |
1000 | | - | |
1001 | | - | |
| 1003 | + | |
| 1004 | + | |
1002 | 1005 | | |
1003 | | - | |
| 1006 | + | |
1004 | 1007 | | |
1005 | 1008 | | |
1006 | 1009 | | |
| |||
1019 | 1022 | | |
1020 | 1023 | | |
1021 | 1024 | | |
1022 | | - | |
| 1025 | + | |
1023 | 1026 | | |
1024 | 1027 | | |
1025 | 1028 | | |
1026 | 1029 | | |
1027 | 1030 | | |
1028 | 1031 | | |
1029 | 1032 | | |
1030 | | - | |
| 1033 | + | |
1031 | 1034 | | |
1032 | 1035 | | |
1033 | 1036 | | |
| |||
1038 | 1041 | | |
1039 | 1042 | | |
1040 | 1043 | | |
1041 | | - | |
| 1044 | + | |
1042 | 1045 | | |
1043 | 1046 | | |
1044 | 1047 | | |
1045 | | - | |
| 1048 | + | |
1046 | 1049 | | |
1047 | 1050 | | |
1048 | 1051 | | |
1049 | 1052 | | |
1050 | | - | |
1051 | | - | |
| 1053 | + | |
| 1054 | + | |
1052 | 1055 | | |
1053 | 1056 | | |
1054 | 1057 | | |
1055 | | - | |
| 1058 | + | |
1056 | 1059 | | |
1057 | 1060 | | |
1058 | 1061 | | |
| |||
1089 | 1092 | | |
1090 | 1093 | | |
1091 | 1094 | | |
1092 | | - | |
| 1095 | + | |
1093 | 1096 | | |
1094 | 1097 | | |
1095 | | - | |
| 1098 | + | |
1096 | 1099 | | |
1097 | 1100 | | |
1098 | 1101 | | |
1099 | | - | |
| 1102 | + | |
1100 | 1103 | | |
1101 | 1104 | | |
1102 | 1105 | | |
| |||
1167 | 1170 | | |
1168 | 1171 | | |
1169 | 1172 | | |
1170 | | - | |
1171 | | - | |
| 1173 | + | |
| 1174 | + | |
1172 | 1175 | | |
1173 | 1176 | | |
1174 | 1177 | | |
| |||
1183 | 1186 | | |
1184 | 1187 | | |
1185 | 1188 | | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
| 1189 | + | |
| 1190 | + | |
1193 | 1191 | | |
1194 | 1192 | | |
1195 | 1193 | | |
| |||
1300 | 1298 | | |
1301 | 1299 | | |
1302 | 1300 | | |
1303 | | - | |
1304 | | - | |
| 1301 | + | |
| 1302 | + | |
1305 | 1303 | | |
1306 | 1304 | | |
1307 | 1305 | | |
| |||
1319 | 1317 | | |
1320 | 1318 | | |
1321 | 1319 | | |
1322 | | - | |
1323 | | - | |
| 1320 | + | |
| 1321 | + | |
1324 | 1322 | | |
1325 | 1323 | | |
1326 | 1324 | | |
1327 | 1325 | | |
1328 | 1326 | | |
1329 | | - | |
1330 | | - | |
| 1327 | + | |
| 1328 | + | |
1331 | 1329 | | |
1332 | | - | |
| 1330 | + | |
1333 | 1331 | | |
1334 | 1332 | | |
1335 | 1333 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
518 | | - | |
| 517 | + | |
| 518 | + | |
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| |||
542 | 542 | | |
543 | 543 | | |
544 | 544 | | |
545 | | - | |
546 | | - | |
| 545 | + | |
| 546 | + | |
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
| |||
0 commit comments