rust/compiler/rustc_resolve/src
bors 58eefc33ad Auto merge of #113408 - petrochenkov:bindintern2, r=cjgillot
resolve: Stop creating `NameBinding`s on every use, create them once per definition instead

`NameBinding` values are supposed to be unique, use referential equality, and be created once for every name declaration.

Before this PR many `NameBinding`s were created on name use, rather than on name declaration, because it's sufficiently cheap, and comparisons are not actually used in practice for some binding kinds.
This PR makes `NameBinding`s consistently unique and created on name declaration.

There are two special cases
- for extern prelude names creating `NameBinding` requires loading the corresponding crate, which is expensive, so such bindings are created lazily on first use, but they still keep the uniqueness by being reused on further uses.
- for legacy derive helpers (helper attributes written before derives that introduce them) the declaration and the use is basically the same thing (that's one of the reasons why they are deprecated), so they are still created on use, but we can still maybe do a bit better in a way that I described in FIXME in the last commit.
2023-08-24 20:05:57 +00:00
..
diagnostics Implement the unused_macro_rules lint 2022-05-05 19:13:00 +02:00
late fix: not insert missing lifetime for ConstParamTy 2023-08-08 14:48:17 +08:00
build_reduced_graph.rs resolve: Make bindings from extern prelude unique 2023-08-24 18:54:28 +08:00
check_unused.rs inline format!() args up to and including rustc_codegen_llvm 2023-07-30 14:22:50 +02:00
def_collector.rs Remove the NodeId of ast::ExprKind::Async 2023-03-19 19:01:31 +01:00
diagnostics.rs resolve: Make bindings for derive helper attributes unique 2023-08-24 18:57:29 +08:00
effective_visibilities.rs resolve: Use Interned for NameBinding 2023-07-05 13:47:36 +03:00
errors.rs Add translatable diagnostic for import resolution strings 2023-06-25 08:29:28 +01:00
ident.rs resolve: Leave a comment about name bindings for legacy derive helpers 2023-08-24 18:57:29 +08:00
imports.rs Rollup merge of #113920 - bvanjoi:fix-81413, r=petrochenkov 2023-07-31 22:49:50 +02:00
late.rs Warn on elided lifetimes in associated constants 2023-08-20 00:21:47 +00:00
lib.rs Auto merge of #113408 - petrochenkov:bindintern2, r=cjgillot 2023-08-24 20:05:57 +00:00
macros.rs resolve: Make bindings for derive helper attributes unique 2023-08-24 18:57:29 +08:00
rustdoc.rs narrow down the lint trigger constraint 2023-08-18 15:19:22 +08:00