Yotam Ofek
ae87d005bc
rustc_resolve: reduce rightwards drift with let..else
👉 💨
2025-01-21 13:42:32 +00:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Nicholas Nethercote
d4fc76cbf3
Introduce 'ra
lifetime name.
...
`rustc_resolve` allocates many things in `ResolverArenas`. The lifetime
used for references into the arena is mostly `'a`, and sometimes `'b`.
This commit changes it to `'ra`, which is much more descriptive. The
commit also changes the order of lifetimes on a couple of structs so
that '`ra` is second last, before `'tcx`, and does other minor
renamings such as `'r` to `'a`.
2024-09-12 08:40:12 +10:00
Nicholas Nethercote
84ac80f192
Reformat use
declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Vadim Petrochenkov
b6074fffd1
resolve: Tweak some naming around import ambiguities
2024-06-25 19:52:59 +03:00
bors
36c0a6d40f
Auto merge of #125105 - nnethercote:rustc_resolve-cleanups, r=estebank
...
`rustc_resolve` cleanups
Some improvements I found while looking through this code.
r? `@estebank`
2024-05-18 06:36:44 +00:00
Vadim Petrochenkov
c30b41012d
delegation: Implement list delegation
...
```rust
reuse prefix::{a, b, c}
```
2024-05-15 02:32:59 +03:00
Nicholas Nethercote
d1f5beeed5
Remove #[macro_use] extern crate tracing
from rustc_resolve
.
...
Explicit imports are more standard nowadays and easier to read.
2024-05-10 15:34:41 +10:00
Bryanskiy
d69cd6473c
Delegation implementation: step 1
2024-01-12 14:11:16 +03:00
Vadim Petrochenkov
be321aa473
resolve: Replace visibility table in resolver outputs with query feeding
...
Also feed missing visibilities for import stems and trait impl items, which were previously evaluated lazily.
2023-12-18 02:26:55 +03:00
Nilstrieb
21a870515b
Fix clippy::needless_borrow
in the compiler
...
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.
Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
Michael Goulet
b2d2184ede
Format all the let chains in compiler
2023-10-13 08:59:36 +00:00
bohan
107152141b
fix(resolve): update def if binding is warning ambiguity
2023-08-31 20:00:04 +08:00
Vadim Petrochenkov
8efd9cc30d
resolve: Use Interned
for NameBinding
2023-07-05 13:47:36 +03:00
Bryanskiy
5e917a6039
increase the accuracy of effective visibilities calculation
2023-06-08 19:22:30 +03:00
Bryanskiy
670f5b134e
Populate effective visibilities in rustc_privacy
2023-05-11 14:51:01 +03:00
Michael Goulet
5fcf2e6edc
Revert "Populate effective visibilities in rustc_privacy
"
...
This reverts commit cff85f22f5
.
2023-05-08 21:47:44 +00:00
Bryanskiy
cff85f22f5
Populate effective visibilities in rustc_privacy
2023-05-05 17:33:10 +03:00
Josh Soref
e09d0d2a29
Spelling - compiler
...
* account
* achieved
* advising
* always
* ambiguous
* analysis
* annotations
* appropriate
* build
* candidates
* cascading
* category
* character
* clarification
* compound
* conceptually
* constituent
* consts
* convenience
* corresponds
* debruijn
* debug
* debugable
* debuggable
* deterministic
* discriminant
* display
* documentation
* doesn't
* ellipsis
* erroneous
* evaluability
* evaluate
* evaluation
* explicitly
* fallible
* fulfill
* getting
* has
* highlighting
* illustrative
* imported
* incompatible
* infringing
* initialized
* into
* intrinsic
* introduced
* javascript
* liveness
* metadata
* monomorphization
* nonexistent
* nontrivial
* obligation
* obligations
* offset
* opaque
* opportunities
* opt-in
* outlive
* overlapping
* paragraph
* parentheses
* poisson
* precisely
* predecessors
* predicates
* preexisting
* propagated
* really
* reentrant
* referent
* responsibility
* rustonomicon
* shortcircuit
* simplifiable
* simplifications
* specify
* stabilized
* structurally
* suggestibility
* translatable
* transmuting
* two
* unclosed
* uninhabited
* visibility
* volatile
* workaround
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-17 16:09:18 -04:00
Vadim Petrochenkov
60c6dc07de
resolve: Restore some effective visibility optimizations
...
Something similar was previously removed as a part of #104602 , but after this PR all table changes should also be "locally correct" after every update.
2023-03-31 17:07:59 +04:00
Vadim Petrochenkov
b3bfeaf765
effvis: Stop considering crate root its own parent
...
It helped to reuse `update_def` for the crate root, but it created confusion and caused some mistakes when I implemented #109500
2023-03-28 22:18:02 +04:00
Vadim Petrochenkov
ede21e8932
effvis: Merge two similar code paths
2023-03-28 22:12:45 +04:00
许杰友 Jieyou Xu (Joe)
1f67949f0e
Lint ambiguous glob re-exports
2023-03-20 03:22:31 +08:00
Vadim Petrochenkov
c83553da31
rustc_middle: Remove trait DefIdTree
...
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02 23:46:44 +04:00
Oli Scherer
0847b79ada
Remove ResolverTree
2023-02-20 15:28:59 +00:00
Oli Scherer
2a47113efa
Remove IntoDefIdTree
2023-02-20 15:28:59 +00:00
Oli Scherer
4953d70e2f
Stuff a TyCtxt into the Resolver
2023-02-20 15:28:59 +00:00
Oli Scherer
43a5cc383d
Separate the lifetime of the session and the arena in the resolver
2023-02-14 10:01:25 +00:00
Vadim Petrochenkov
9080b79f2b
rustdoc: Eliminate remaining uses of resolver
2023-02-13 00:10:15 +04:00
Oli Scherer
75ff5c7dd3
Fold Definitions
into the untracked data
2022-12-09 14:59:39 +00:00
Oli Scherer
1c1d3570ee
Move the untracked cstore and source_span into a struct
2022-12-09 14:53:24 +00:00
Oli Scherer
2cd36f2c89
Generate crate loaders on the fly
2022-12-09 14:53:23 +00:00
Oli Scherer
4b08fbaea8
ResolverTree does not require access to the crate loader, only the store
2022-12-09 14:50:09 +00:00
Vadim Petrochenkov
b32a4edb20
rustc_ast_lowering: Stop lowering imports into multiple items
...
Lower them into a single item with multiple resolutions instead.
This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-12-01 18:51:20 +03:00
Vadim Petrochenkov
47cd844468
effective visibility: Stop recalculating current private visibility
...
It becomes relatively expensive if done often and shows up during perf profiling.
2022-11-24 01:30:58 +03:00
Vadim Petrochenkov
7e76d94a22
effective visibility: Always add table entries for nodes used as parents
...
Previously if the parent was not in the table, and there was nothing to inherit from, the child's private visibility was used, but that's not correct - the parent may have a larger visibility so we should set it to at least the parent's private visibility.
That parent's private visibility is also inserted into the table for caching, so it's not recalculated later if used again.
2022-11-24 01:28:41 +03:00
Vadim Petrochenkov
a45a302be5
effective visibility: Fix private visibility calculation for modules
...
Optimizations removed in the previous commit required this function to behave incorrectly, but now those optimizations are gone so we can fix the bug.
Fixes https://github.com/rust-lang/rust/issues/104249
2022-11-24 00:03:51 +03:00
Vadim Petrochenkov
f0843b89d1
effective visibility: Remove questionable optimizations
...
First, they require eagerly calculating private visibility (current normal module), which is somewhat expensive.
Private visibilities are also lost once calculated, instead of being cached in the table.
Second, I cannot prove that the optimizations are correct.
Maybe they can be partially reinstated in the future in cases when it's cheap and provably correct to do them.
They will also probably be merged into `fn update` in that case.
Partially fixes https://github.com/rust-lang/rust/issues/104249
Fixes https://github.com/rust-lang/rust/issues/104539
2022-11-24 00:03:51 +03:00
Vadim Petrochenkov
3f20f4ac42
effective visibility: Satisfy borrow checker to use resolver lazily from a closure
2022-11-24 00:03:51 +03:00
cui fliter
442f848d74
fix some typos in comments
...
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-13 15:26:17 +08:00
Vadim Petrochenkov
43bea6cf69
resolve: Fill effective visibilities for import def ids in a separate pass
...
This should result in less update calls than doing it repeatedly during the fix point iteration.
2022-11-05 17:55:20 +04:00
Vadim Petrochenkov
24093fc6bd
resolve: More detailed effective visibility tracking for imports
...
Also drop `extern` blocks from the effective visibility table, they are nominally private and it doesn't make sense to keep them there.
2022-11-05 15:46:22 +04:00
Vadim Petrochenkov
84317518ff
resolve: Turn the binding from #[macro_export]
into a proper Import
2022-10-31 21:25:00 +04:00
Vadim Petrochenkov
637bfe68a1
resolve: Not all imports have their own NodeId
2022-10-31 20:25:27 +04:00
Vadim Petrochenkov
34eb73c72d
privacy: Rename "accessibility levels" to "effective visibilities"
...
And a couple of other naming tweaks
Related to https://github.com/rust-lang/rust/issues/48054
2022-10-26 16:34:53 +04:00