Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
802 commits
Select commit Hold shift + click to select a range
b705b87
ty_check: Add a property to indicate mutability to `TypedExpr`
Y-Nak Feb 28, 2024
7125b7f
ty_check: assign and aug assign expression
Y-Nak Feb 28, 2024
5d2634b
ty_check: while statement
Y-Nak Feb 28, 2024
750f25a
ty_check: break and continue statement
Y-Nak Feb 29, 2024
dd78aca
ty_check: `for` statement
Y-Nak Feb 29, 2024
f3c2960
Bumpup `dir-test` version to 0.2
Y-Nak Mar 2, 2024
1bfc8ab
ty_check: function call
Y-Nak Mar 3, 2024
4c889a9
ty_check: Fix bug in type inference in match expr
Y-Nak Apr 6, 2024
935bd3f
Fix missing scope information for unnamed imports
Y-Nak Apr 6, 2024
a23a5e1
Enable to find all impls of a given type
Y-Nak Apr 6, 2024
e981b67
Add function to collect available traits in the given scope
Y-Nak Apr 7, 2024
e04cc5c
Rename `TyVarUniverse` to `TyVarSort`
Y-Nak Apr 8, 2024
c9b9864
Add `TypeFoldable/TypeFolder`
Y-Nak Apr 8, 2024
45661bc
Implement `TypeFolder` to `UnificationTable`
Y-Nak Apr 8, 2024
cd9f630
Add `TypeVisitable`
Y-Nak Apr 8, 2024
155b2d9
Implement `Binder`
Y-Nak Apr 8, 2024
33c5706
Cleanup `Implementor` by wrapping it by `Binder`
Y-Nak Apr 8, 2024
6faf898
Wrap up types by `Binder` more
Y-Nak Apr 9, 2024
57fa1ad
Cleanup trait impl method comparison
Y-Nak Apr 9, 2024
93835d7
Cleanup binder usage
Y-Nak Apr 10, 2024
bb3cbd8
Remove subst in favor of `TypeFoldable`
Y-Nak Apr 10, 2024
9a2bc1f
Remove unnecessary types
Y-Nak Apr 10, 2024
ba3a687
ty_check: inherent method call
Y-Nak Apr 11, 2024
3e58991
Fix missing visibility check in field access
Y-Nak Apr 12, 2024
217a636
Modify `FuncDef` definition to allow lowering an enum unit variant in…
Y-Nak Apr 14, 2024
a8e6d7b
Add lowering from tuple varaint to func def
Y-Nak Apr 14, 2024
bc2c9eb
Allow users to specify `!` type
Y-Nak Apr 14, 2024
6fff62d
Add tests for method call
Y-Nak Apr 14, 2024
a17cbf7
Fix meaningless type application in method call
Y-Nak Apr 15, 2024
ab82abb
Improve error message in method selection
Y-Nak Apr 15, 2024
ed92e70
ty_check: trait method call
Y-Nak Apr 15, 2024
b84ea9f
ty_check: bitnot op
Y-Nak Apr 15, 2024
ff41344
ty_check: static trait method
Y-Nak Apr 15, 2024
56876d4
ty_check: const
Y-Nak Apr 16, 2024
3df921f
Add check for foreign/non-nominal type in inherent impl
Y-Nak Apr 16, 2024
2340147
Fix missing instantiation in method selection
Y-Nak Apr 16, 2024
f12d7ca
Fix impl method stricter bound check so that it ignores parental assu…
Y-Nak Apr 16, 2024
8520097
Cleanup path resolution in body
Y-Nak Apr 16, 2024
dce3342
Resolve const generics as a term
Y-Nak Apr 17, 2024
e176aa9
Cleanup `ty_def` module
Y-Nak Apr 18, 2024
2a386dc
Add `TyFlags`
Y-Nak Apr 18, 2024
77f5c46
Improve error messages
Y-Nak Apr 18, 2024
d209e77
Improve representation of trait constraints
Y-Nak Apr 19, 2024
883fbf1
Handle unexpected missing self type in trait method check
Y-Nak Apr 19, 2024
cb2ae67
Allow missing `self` label
Y-Nak Apr 19, 2024
9857615
Stop visiting block internal items when finalizing type checking
Y-Nak Apr 20, 2024
68fff89
Fix missing instantiation in method selection
Y-Nak Apr 20, 2024
75ccd06
Fix missing string type variable fallback
Y-Nak Apr 20, 2024
524efd9
Update old tests
Y-Nak Apr 20, 2024
c399d68
Add more tests
Y-Nak Apr 20, 2024
7252aaf
Canonicalize more
Y-Nak Apr 21, 2024
c80b36e
Fix a bug in constraitns collection when `Self` appears in where clau…
Y-Nak Apr 23, 2024
2fca91c
Fix incorrect instantiation in constraint solving (#998)
Y-Nak Apr 25, 2024
732e88c
Fix label assertion bug
Y-Nak Apr 25, 2024
4a18de0
Merge pull request #999 from Y-Nak/fix-incorrect-label
g-r-a-n-t Apr 25, 2024
851f25e
Fix missing instantiation in `impls_of_ty` function
Y-Nak May 2, 2024
e399d92
Make clippy happy
Y-Nak May 2, 2024
6b13659
Merge pull request #1001 from Y-Nak/fix-trait-method-selection
sbillig May 3, 2024
52c864c
Add devcontainer.json, for development in Docker and Github Codespace…
May 4, 2024
5f9086d
Merge branch 'master' into fe-v2
sbillig May 4, 2024
106a319
Merge pull request #1005 from sbillig/mergeroo
Y-Nak May 6, 2024
cc6e938
gh ci: enable rust backtrace; only deny warnings on the lint job (#1006)
sbillig May 6, 2024
65ef137
Add `Canonicalized<T>` and `Solution<T>`
Y-Nak May 13, 2024
854d789
Add `PersistentUnificationTable`
Y-Nak May 13, 2024
9705246
Tabled trait resolution
Y-Nak May 13, 2024
73717ff
Refactor module structure
Y-Nak May 14, 2024
d52c3a3
Fix broken link
Y-Nak May 14, 2024
5bac0d4
Introduce confirmation concept for method selection
Y-Nak May 14, 2024
a9abd65
Improve wf error message by displaying an unsatisfied subgoal together
Y-Nak May 15, 2024
bc233f7
Add test for lazy method confirmation
Y-Nak May 15, 2024
15191a3
Doc work
Y-Nak May 15, 2024
53b15e5
Tweak trait import rule so that users don't need to import trait to u…
Y-Nak May 16, 2024
da86b34
Update `dir-test` version to `0.3`
Y-Nak May 17, 2024
5b405ad
Merge pull request #1007 from Y-Nak/tabled-trait-resolution
sbillig May 22, 2024
e2aac12
add usize and isize primitive types
lana-shanghai May 31, 2024
79bab76
address nits
lana-shanghai Jun 10, 2024
96acdc4
leave keywords defs in capital letters
lana-shanghai Jun 10, 2024
5f36438
Merge pull request #1012 from lana-shanghai/feat/add_usize_isize_types
Y-Nak Jun 10, 2024
5b13ab6
Probe type variable deeply
Y-Nak Jun 10, 2024
73af776
Define upper bound on the type depth to enusre termination in trait s…
Y-Nak Jun 10, 2024
1c3d94b
Exclude `certik.com` from linkcheck
Y-Nak Jun 10, 2024
9bf3943
Prioritize consumer nodes that are closer to the original goal in the…
Y-Nak Jun 19, 2024
6360a30
Make clippy happy
Y-Nak Jun 19, 2024
c9a55c2
Merge pull request #1014 from Y-Nak/ensure-termination-in-trait-solving
sbillig Jun 19, 2024
1113942
[hir] Update type representation for salsa 3.0
Y-Nak Jun 26, 2024
f8d8f88
[name-resolution] Update type representation for salsa 3.0
Y-Nak Jun 26, 2024
862972d
[ty] Update type representation for salsa 3.0
Y-Nak Jun 26, 2024
95b8ed2
[name-resolution] Remove accumulators
Y-Nak Jun 27, 2024
eda5af3
[ty] Remove accumulators
Y-Nak Jun 27, 2024
dd66c37
Replace `salsa::FromId` with `salsa::LookupId`
Y-Nak Jun 28, 2024
fa20327
Update tests for salsa 3.0
Y-Nak Jun 28, 2024
e9f46ea
Make clippy happy
Y-Nak Jun 28, 2024
776b53f
Add thin wrappers for `IndexMap`/`IndexSet` to implement `salsa::Update`
Y-Nak Jun 28, 2024
0f589f6
Replace `BTreeMap/BTreeSet` with `IndexMap/IndexSet`
Y-Nak Jun 29, 2024
ef81c76
Fix duplicated error report in alias cycle
Y-Nak Jun 29, 2024
904dccc
Modify scope graph DFS traversal order
Y-Nak Jun 29, 2024
dce1e09
Exclude language-server from the workspace temporarily
Y-Nak Jun 29, 2024
28fe40c
Remove fe-macros
Y-Nak Jun 29, 2024
bd7343c
Merge pull request #1015 from Y-Nak/update-salsa
sbillig Jul 4, 2024
ecd8c22
Initial work moving to async-lsp
micahscopes Jun 28, 2024
afe6fd5
add actor dispatcher abstraction
micahscopes Jul 28, 2024
1d26d51
parameterize actor dispatcher type
micahscopes Jul 28, 2024
5711d01
Decouple `Actor`, `ActorRef` and `Dispatcher`
micahscopes Jul 30, 2024
d22a7da
compiling
micahscopes Jul 30, 2024
03e7938
State of the code during Jul. 30 weekly meeting
micahscopes Jul 30, 2024
ac2b8f8
Fix missing occurence check
Y-Nak Sep 17, 2024
7e9d00d
Make clippy happy
Y-Nak Sep 17, 2024
da8aed3
Merge pull request #1019 from Y-Nak/missing-occurence-check
Y-Nak Sep 18, 2024
ace2107
compiling, still not initializing
micahscopes Sep 18, 2024
9385c1d
clippy/rustfmt
micahscopes Sep 18, 2024
e00636f
getting closer
micahscopes Sep 18, 2024
b4b8556
graceful lsp fallback for error handling
micahscopes Sep 20, 2024
6607268
error handling improvements
micahscopes Sep 21, 2024
bee08d9
further debugging...
micahscopes Sep 23, 2024
a8ad476
add TCP support
micahscopes Sep 24, 2024
9d5109c
use async-std's stdio
micahscopes Sep 24, 2024
69839da
attempts to fix LSP logging
micahscopes Sep 24, 2024
28fd8c6
multithreaded/multi-client tracing proof of concept
micahscopes Sep 30, 2024
0bcef56
LSP actor thread names in logger
micahscopes Oct 1, 2024
8e856a4
use generic actor message keys
micahscopes Oct 10, 2024
f798fae
hooking up functionality again
micahscopes Oct 15, 2024
24cf4b0
hook up LSP diagnostics
micahscopes Oct 15, 2024
e9f68f2
get rid of warnings / rustfmt / clippy
micahscopes Oct 15, 2024
aee7bb7
salsa upgrade for LSP server
micahscopes Oct 15, 2024
47b0c54
cleanup and LSP event `CanHandle`
micahscopes Oct 15, 2024
90574ee
language server organization
micahscopes Oct 15, 2024
a7ac89c
simplify LSP setup
micahscopes Oct 15, 2024
4484871
Support for non-mutating LSP handlers
micahscopes Oct 16, 2024
8054189
non-mutable diagnostics handler
micahscopes Nov 26, 2024
fddc3c3
use language server via TCP
micahscopes Nov 26, 2024
14edc09
LSP server timeout to shutdown unused server instances
micahscopes Nov 26, 2024
08f7efe
Compute diagnostics using a worker per ingot
micahscopes Nov 26, 2024
1c0d211
appease clippy
micahscopes Nov 26, 2024
a8a3c24
use published actor lib for LSP server
micahscopes Nov 26, 2024
b5fe468
update readme
sbillig Nov 27, 2024
942ec59
rely less on async-lsp changes
micahscopes Nov 29, 2024
2e8f575
Running tests, iterating on actor module
micahscopes Jul 27, 2024
764d45a
actor is passing basic smoke test
micahscopes Jul 27, 2024
502fc6a
update progress log, roadmap
micahscopes Nov 30, 2024
d6efd9a
remove extra changes
micahscopes Nov 30, 2024
b116b92
appease clippy
micahscopes Nov 30, 2024
d400186
more fixes for clippy
micahscopes Nov 30, 2024
fa36151
clippy and compiler were fighting over these lines
micahscopes Nov 30, 2024
eef4e1a
remove unused dependencies, use different TCP listener library
micahscopes Nov 30, 2024
0df34a4
Merge branch 'fix-lifetime-elision-lint' into language-server-async
micahscopes Nov 30, 2024
0b6a311
fix lsp actor test
micahscopes Nov 30, 2024
fcf416e
fix lsp `WithFallback` service
micahscopes Nov 30, 2024
6767314
Appease clippy's new rules (#1023)
micahscopes Dec 2, 2024
cee478f
Merge pull request #1022 from micahscopes/language-server-async
sbillig Dec 2, 2024
c2dc82d
Merge pull request #1021 from sbillig/update-readme
g-r-a-n-t Dec 2, 2024
797b907
additional LSP diagnostics + fixups
micahscopes Dec 17, 2024
065ee22
catch unhandled LSP notifications and events
micahscopes Dec 18, 2024
89c9961
Fix LSP server stdio mode (#1025)
micahscopes Dec 24, 2024
bbef0ed
Merge pull request #1024 from micahscopes/additional-lsp-diagnostics
sbillig Dec 24, 2024
03ad0d5
move editor support to separate repos (remove vscode extension) (#1028)
micahscopes Dec 30, 2024
68c3c05
fix crate vulnerabilities
rex4539 Dec 31, 2024
ebdab4c
Merge pull request #1029 from rex4539/vuln
g-r-a-n-t Jan 8, 2025
1aec667
Fix `salsa::Update` impl for `IndexMap` (#1030)
Y-Nak Jan 10, 2025
111f0b4
appease clippy
micahscopes Jan 12, 2025
fabcd29
Merge pull request #1032 from micahscopes/appease-clippy-in-jan-2025
Y-Nak Jan 12, 2025
4525b8f
Simplify early name resolution
Y-Nak Jul 1, 2024
1138aad
Fix lsp
sbillig Dec 7, 2024
dd18017
Recursive PathId
sbillig Jul 29, 2024
37b9059
Cleanup; fix should_partial and generic expr parsing
sbillig Dec 11, 2024
8282248
Update goto implementation for pathseg-generic refactor
micahscopes Dec 11, 2024
26be613
Fix 'invalid path segment' error referring to wrong path segment
sbillig Dec 16, 2024
e061a19
Refactor some uses of Either type
sbillig Dec 17, 2024
f3ec23a
Use PathId::segment_index
sbillig Dec 17, 2024
6a711d7
TyId::array now takes element ty
sbillig Dec 17, 2024
f85753f
Small cleanup
sbillig Dec 18, 2024
371a1b2
Walk all path segment generic args in EarlyPathVisitor
sbillig Dec 18, 2024
7775a87
Use path segment ident span when reporting errors
sbillig Dec 18, 2024
fbebecc
Generic arg parsing: use different recovery behavior in expr context
sbillig Dec 18, 2024
c11d8fe
Support generic args in intermediate path segments
sbillig Dec 18, 2024
05b496a
clippy
sbillig Dec 19, 2024
a150137
Fix resolution of variants of generic enums
sbillig Dec 20, 2024
57227b2
Replace TyId::app loops with TyId::foldl
sbillig Dec 20, 2024
f391553
Fix 'invalid' type bug caused by over-applying types to a resolved in…
sbillig Dec 21, 2024
cb6f62c
Add functor uitest (demonstrates inferrence weakness)
sbillig Dec 21, 2024
c8003c8
Refactor path resolution
sbillig Jan 4, 2025
d657932
Merge pull request #1017 from sbillig/pathseg-generic
Y-Nak Jan 15, 2025
a4c13a8
salsa 3.0 wip
sbillig Jan 11, 2025
8b0293f
Fix cycle recovery functions
sbillig Jan 12, 2025
5500b17
Consolidated tracing / log cleanup
micahscopes Jan 12, 2025
a716928
cleanup
sbillig Jan 12, 2025
d70bda7
Fix ordering of missing field names in diagnostic
sbillig Jan 13, 2025
ccfc799
cleanup dead code warnings
sbillig Jan 13, 2025
47b7e82
Update to latest salsa master
sbillig Jan 15, 2025
f662719
Remove InputIngot field from InputFile
sbillig Jan 15, 2025
a9b68f8
Merge pull request #1033 from sbillig/salsa-update
Y-Nak Jan 17, 2025
13033c4
Add missing attributes parsing/lowering
Y-Nak Jan 15, 2025
e671692
Add resolution from `ScopeId` to a hir node
Y-Nak Jan 15, 2025
f143227
Display docstrings for the resolved scope in language-server
Y-Nak Jan 15, 2025
9aa00cc
Fix missing id stack management in `leave_item_scope` (#1038)
Y-Nak Jan 17, 2025
682fac9
Merge pull request #1035 from Y-Nak/parse-attrs
sbillig Jan 17, 2025
4651aa3
Improve the display of diagnostics
Y-Nak Jan 15, 2025
99ad75c
Simplify `GenericParamAlreadyDefinedInParent` error message
Y-Nak Jan 16, 2025
8fbc166
Add `DiagnosticRelatedInformation` to secondary diagnostics
Y-Nak Jan 16, 2025
810558d
Add missing analysis passes
Y-Nak Jan 16, 2025
7c2be9f
Merge pull request #1036 from Y-Nak/tweak-lsp
micahscopes Jan 17, 2025
91ff3da
Merge pull request #840 from ethereum/fe-v2
sbillig Jan 18, 2025
d13edaa
Remove legacy crates
sbillig Jan 18, 2025
4b9df5c
Remove docs, update gh workflows
sbillig Jan 18, 2025
36b5d82
Merge pull request #1039 from sbillig/repo-purge
Y-Nak Jan 18, 2025
4f5b7a6
chore: remove `2` suffix from crate names
sbillig Jan 18, 2025
5bf1e9f
chore: cargo update
sbillig Jan 18, 2025
0159316
chore: make lsp `smallest_enclosing` test deterministic
sbillig Jan 18, 2025
d19759c
chore: update deps to latest versions; move some deps to workspace Ca…
sbillig Jan 18, 2025
4348dc3
chore: remove rowan dep from language-server
sbillig Jan 18, 2025
c284260
Remove gh PULL_REQUEST_TEMPLATE.md
sbillig Jan 18, 2025
73fcd62
Remove gh ISSUE_TEMPLATE.md
sbillig Jan 18, 2025
91ef37e
chore: update logos crate
sbillig Jan 19, 2025
e86565e
chore: update derive-more crate
sbillig Jan 19, 2025
16c1326
Merge pull request #1041 from sbillig/tidy-deps
sbillig Jan 20, 2025
4e24af3
Add skeleton cli crate (#1044)
sbillig Jan 20, 2025
ec28d41
Local and core ingot support.
Jan 20, 2025
0772d06
Merge pull request #1046 from g-r-a-n-t/core-local-ingots
g-r-a-n-t Jan 25, 2025
464327a
Add missing check for duplicated binding in the same pattern
Y-Nak May 18, 2024
07940c0
Diagnostic language tweaks
sbillig Jan 20, 2025
1469529
Merge pull request #1047 from sbillig/pat-binding-dup
Y-Nak Jan 25, 2025
7ecd47e
Bump salsa commit (includes accumulator bugfix)
sbillig Jan 26, 2025
f975424
Use salsa::tracked methods and remove `_impl` functions
sbillig Jan 27, 2025
93f181d
Merge pull request #1050 from sbillig/salsa-update
micahscopes Jan 27, 2025
2e20d75
Add TyId::name_span(self, db)
sbillig Jan 21, 2025
036a063
Move diagnostic `to_complete` impls
sbillig Jan 23, 2025
c380984
Remove TyLowerDiag constructor functions
sbillig Jan 23, 2025
cc94a4a
Remove most diagnostic constructor fns
sbillig Jan 24, 2025
f704df1
Merge pull request #1048 from sbillig/diag-refactor
sbillig Jan 27, 2025
ed3ceca
Fix resolution of call of imported enum tuple variant constructor
sbillig Jan 26, 2025
ef331cc
Fix inherent method resolution for imported types
sbillig Jan 28, 2025
e33b419
Add tests: analysis of core lib, and analysis of `use`r of core lib
sbillig Jan 28, 2025
60eabe4
disable fe language server in zed for the fe monorepo (#1052)
micahscopes Jan 28, 2025
5be9878
Merge pull request #1051 from sbillig/enum-tuple-ctor-fix
micahscopes Jan 28, 2025
8598c88
Better diagnostic when using a struct field name in a method call
sbillig Feb 2, 2025
8fb9623
Add arg_count_mismatch uitest
sbillig Feb 2, 2025
915be56
Emit diag when path parent resolves to invalid ty
sbillig Feb 2, 2025
babd504
Emit NotAMethod diag when associated fn used as method
sbillig Feb 2, 2025
d018b3b
RecordInitChecker: remove unnecessary `mut`
sbillig Feb 2, 2025
61cd54e
Add analysis benchmarks
sbillig Feb 3, 2025
b3709bf
ci: exclude fe-bench and fe-language-server from `cargo test`
sbillig Feb 3, 2025
c04dec4
Merge pull request #1055 from sbillig/bench
micahscopes Feb 4, 2025
0bb0c07
config.toml > fe.toml (#1058)
g-r-a-n-t Feb 14, 2025
e0d6273
Merge pull request #1054 from sbillig/diag-improvements
g-r-a-n-t Feb 17, 2025
1914db5
smallvec 1 -> 2.0.0-alpha10
sbillig Feb 19, 2025
348e46c
return exit code 1 when fe check fails (#1060)
Turupawn Feb 20, 2025
8eb41e0
salsa update: coarse tracked structs
sbillig Feb 20, 2025
1091f51
salsa update: derive(Update); remove AdtRefId and GenericParamOwnerId
sbillig Feb 20, 2025
8a4e9be
Use IndexMap for consistent trait order in diagnostic
sbillig Feb 20, 2025
113d67c
salsa update: bump to latest (perf improvements)
sbillig Feb 26, 2025
1c40071
Merge pull request #1061 from sbillig/salsa-update
g-r-a-n-t Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
salsa update: coarse tracked structs
  • Loading branch information
sbillig committed Feb 26, 2025
commit 8eb41e0e03e9c02ec0e846047a2dc29240b6f775
22 changes: 16 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dir-test = "0.4"
rustc-hash = "2.1.0"
num-bigint = "0.4"
paste = "1.0.15"
salsa = { git = "https://github.com/salsa-rs/salsa", rev = "d32b3c1995b632d894250a667adb79c846b3da02" }
salsa = { git = "https://github.com/salsa-rs/salsa", rev = "ca9fba4e83b38ad7c2002b394edd792fa75f924a" }
smallvec = { version = "2.0.0-alpha.10" }
wasm-bindgen-test = "0.3"
glob = "0.3.2"
Expand Down
3 changes: 2 additions & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ description = "Provides HIR definition and lowering for Fe lang."

[dependencies]
camino.workspace = true
indexmap = "2.7"
paste.workspace = true
salsa.workspace = true
semver.workspace = true
smol_str = "0.3.2"

parser.workspace = true
ordermap = "0.5.5"
rustc-hash.workspace = true
119 changes: 41 additions & 78 deletions crates/common/src/indexmap.rs
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
use std::{
hash::{BuildHasher, Hash, RandomState},
hash::Hash,
ops::{Deref, DerefMut},
};

use rustc_hash::FxBuildHasher;
use salsa::Update;

#[derive(Debug, Clone)]
pub struct IndexMap<K, V, S = RandomState>(indexmap::IndexMap<K, V, S>);
type OrderMap<K, V> = ordermap::OrderMap<K, V, FxBuildHasher>;
type OrderSet<V> = ordermap::OrderSet<V, FxBuildHasher>;

#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct IndexMap<K, V>(OrderMap<K, V>);

impl<K, V> IndexMap<K, V> {
pub fn new() -> Self {
Self(indexmap::IndexMap::new())
Self(OrderMap::default())
}

pub fn with_capacity(n: usize) -> Self {
Self(indexmap::IndexMap::with_capacity(n))
Self(OrderMap::with_capacity_and_hasher(n, FxBuildHasher {}))
}
}

Expand All @@ -24,83 +28,56 @@ impl<K, V> Default for IndexMap<K, V> {
}
}

impl<K, V, S> IntoIterator for IndexMap<K, V, S> {
type Item = <indexmap::IndexMap<K, V, S> as IntoIterator>::Item;
type IntoIter = <indexmap::IndexMap<K, V, S> as IntoIterator>::IntoIter;
impl<K, V> IntoIterator for IndexMap<K, V> {
type Item = <OrderMap<K, V> as IntoIterator>::Item;
type IntoIter = <OrderMap<K, V> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

impl<'a, K, V, S> IntoIterator for &'a IndexMap<K, V, S> {
type Item = <&'a indexmap::IndexMap<K, V, S> as IntoIterator>::Item;
type IntoIter = <&'a indexmap::IndexMap<K, V, S> as IntoIterator>::IntoIter;
impl<'a, K, V> IntoIterator for &'a IndexMap<K, V> {
type Item = <&'a OrderMap<K, V> as IntoIterator>::Item;
type IntoIter = <&'a OrderMap<K, V> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}

impl<'a, K, V, S> IntoIterator for &'a mut IndexMap<K, V, S> {
type Item = <&'a mut indexmap::IndexMap<K, V, S> as IntoIterator>::Item;
type IntoIter = <&'a mut indexmap::IndexMap<K, V, S> as IntoIterator>::IntoIter;
impl<'a, K, V> IntoIterator for &'a mut IndexMap<K, V> {
type Item = <&'a mut OrderMap<K, V> as IntoIterator>::Item;
type IntoIter = <&'a mut OrderMap<K, V> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
(&mut self.0).into_iter()
}
}

impl<K, V, S> PartialEq for IndexMap<K, V, S>
where
K: Eq + Hash,
V: PartialEq,
S: BuildHasher,
{
fn eq(&self, other: &Self) -> bool {
self.0.eq(&other.0)
}
}

impl<K, V, S> Eq for IndexMap<K, V, S>
where
K: Eq + Hash,
V: Eq,
S: BuildHasher,
{
}

impl<K, V, S> FromIterator<(K, V)> for IndexMap<K, V, S>
impl<K, V> FromIterator<(K, V)> for IndexMap<K, V>
where
K: Hash + Eq,
S: BuildHasher + Default,
{
fn from_iter<T: IntoIterator<Item = (K, V)>>(iter: T) -> Self {
Self(indexmap::IndexMap::from_iter(iter))
Self(OrderMap::from_iter(iter))
}
}

impl<K, V, S> Deref for IndexMap<K, V, S>
where
S: BuildHasher,
{
type Target = indexmap::IndexMap<K, V, S>;
impl<K, V> Deref for IndexMap<K, V> {
type Target = OrderMap<K, V>;
fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<K, V, S> DerefMut for IndexMap<K, V, S>
where
S: BuildHasher,
{
impl<K, V> DerefMut for IndexMap<K, V> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

unsafe impl<K, V, S> Update for IndexMap<K, V, S>
unsafe impl<K, V> Update for IndexMap<K, V>
where
K: Update + Eq + Hash,
V: Update,
S: BuildHasher,
{
unsafe fn maybe_update(old_pointer: *mut Self, new_map: Self) -> bool {
let old_map = unsafe { &mut *old_pointer };
Expand Down Expand Up @@ -131,15 +108,15 @@ where
}

#[derive(Debug, Clone)]
pub struct IndexSet<V, S = RandomState>(indexmap::IndexSet<V, S>);
pub struct IndexSet<V>(OrderSet<V>);

impl<V> IndexSet<V> {
pub fn new() -> Self {
Self(indexmap::IndexSet::new())
Self(OrderSet::default())
}

pub fn with_capacity(n: usize) -> Self {
Self(indexmap::IndexSet::with_capacity(n))
Self(OrderSet::with_capacity_and_hasher(n, FxBuildHasher {}))
}
}

Expand All @@ -149,72 +126,58 @@ impl<V> Default for IndexSet<V> {
}
}

impl<V, S> IntoIterator for IndexSet<V, S> {
type Item = <indexmap::IndexSet<V, S> as IntoIterator>::Item;
type IntoIter = <indexmap::IndexSet<V, S> as IntoIterator>::IntoIter;
impl<V> IntoIterator for IndexSet<V> {
type Item = <OrderSet<V> as IntoIterator>::Item;
type IntoIter = <OrderSet<V> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
self.0.into_iter()
}
}

impl<'a, V, S> IntoIterator for &'a IndexSet<V, S> {
type Item = <&'a indexmap::IndexSet<V, S> as IntoIterator>::Item;
type IntoIter = <&'a indexmap::IndexSet<V, S> as IntoIterator>::IntoIter;
impl<'a, V> IntoIterator for &'a IndexSet<V> {
type Item = <&'a OrderSet<V> as IntoIterator>::Item;
type IntoIter = <&'a OrderSet<V> as IntoIterator>::IntoIter;
fn into_iter(self) -> Self::IntoIter {
(&self.0).into_iter()
}
}

impl<V, S> PartialEq for IndexSet<V, S>
impl<V> PartialEq for IndexSet<V>
where
V: Hash + Eq,
S: BuildHasher,
{
fn eq(&self, other: &Self) -> bool {
self.0.eq(&other.0)
}
}

impl<V, S> Eq for IndexSet<V, S>
where
V: Eq + Hash,
S: BuildHasher,
{
}
impl<V> Eq for IndexSet<V> where V: Eq + Hash {}

impl<V, S> FromIterator<V> for IndexSet<V, S>
impl<V> FromIterator<V> for IndexSet<V>
where
V: Hash + Eq,
S: BuildHasher + Default,
{
fn from_iter<T: IntoIterator<Item = V>>(iter: T) -> Self {
Self(indexmap::IndexSet::from_iter(iter))
Self(OrderSet::from_iter(iter))
}
}

impl<V, S> Deref for IndexSet<V, S>
where
S: BuildHasher,
{
type Target = indexmap::IndexSet<V, S>;
impl<V> Deref for IndexSet<V> {
type Target = OrderSet<V>;
fn deref(&self) -> &Self::Target {
&self.0
}
}

impl<V, S> DerefMut for IndexSet<V, S>
where
S: BuildHasher,
{
impl<V> DerefMut for IndexSet<V> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}

unsafe impl<V, S> Update for IndexSet<V, S>
unsafe impl<V> Update for IndexSet<V>
where
V: Update + Eq + Hash,
S: BuildHasher,
{
unsafe fn maybe_update(old_pointer: *mut Self, new_set: Self) -> bool {
let old_set = unsafe { &mut *old_pointer };
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-analysis/src/ty/def_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ impl<'db> ImplTraitMethodAnalyzer<'db> {
&mut self.diags,
);

required_methods.shift_remove(name);
required_methods.remove(name);
}

if !required_methods.is_empty() {
Expand Down
16 changes: 9 additions & 7 deletions crates/hir/src/hir_def/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use std::hash::Hash;

use common::indexmap::IndexMap;
use cranelift_entity::{EntityRef, PrimaryMap, SecondaryMap};
use parser::ast::{self, prelude::*};
use rustc_hash::FxHashMap;
Expand All @@ -22,7 +23,7 @@ use crate::{

#[salsa::tracked]
pub struct Body<'db> {
#[id]
// #[id]
id: TrackedItemId<'db>,

/// The expression that evaluates to the value of the body.
Expand Down Expand Up @@ -77,13 +78,13 @@ impl<'db> Body<'db> {
}
}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum BodyKind {
FuncBody,
Anonymous,
}

#[derive(Debug)]
#[derive(Debug, Hash, Clone)]
pub struct NodeStore<K, V>(PrimaryMap<K, V>)
where
K: EntityRef;
Expand Down Expand Up @@ -170,21 +171,22 @@ where
pub trait SourceAst: AstNode + Clone + Hash + PartialEq + Eq {}
impl<T> SourceAst for T where T: AstNode + Clone + Hash + PartialEq + Eq {}

#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct BodySourceMap {
pub stmt_map: SourceNodeMap<ast::Stmt, StmtId>,
pub expr_map: SourceNodeMap<ast::Expr, ExprId>,
pub pat_map: SourceNodeMap<ast::Pat, PatId>,
}

#[derive(Clone, Debug)]
#[allow(clippy::derived_hash_with_manual_eq)]
#[derive(Clone, Debug, Hash)]
pub struct SourceNodeMap<Ast, Node>
where
Ast: SourceAst,
Node: EntityRef,
{
pub node_to_source: SecondaryMap<Node, HirOrigin<Ast>>,
pub source_to_node: FxHashMap<HirOrigin<Ast>, Node>,
pub source_to_node: IndexMap<HirOrigin<Ast>, Node>,
}

impl<Ast, Node> SourceNodeMap<Ast, Node>
Expand Down Expand Up @@ -226,7 +228,7 @@ where
{
fn default() -> Self {
Self {
source_to_node: FxHashMap::default(),
source_to_node: IndexMap::default(),
node_to_source: SecondaryMap::new(),
}
}
Expand Down