Martin Vogel
ad435fd05d
fix(rust): resolve use paths inside the importing crate
...
In a Cargo workspace a relative `use` bound a sibling crate's item. The
import resolver has no Rust branch, so `crate::util::helper` fell through
to the project-wide symbol-name fallback (Strategy 3), which matches the
last path segment, then every enclosing segment, against every same-named
definition in the project and keeps the lexicographically smallest QN:
whichever crate sorts first. The same fallback bound imports of external
crates to project symbols by name (`use serde_json::json` -> the project's
own `json` function, and every `json!` call through import_map) and let a
module segment bind a function (`crate::util::Gone` -> fn `util`), while
Strategy 4 resolved `crate::`, `self::` and `super::` from the repository
root instead of the crate's module root.
A Rust import of a file under a Cargo.toml is now classified by its first
path segment and resolved inside exactly one crate:
- `crate::` is the importing crate's module root: the nearest Cargo.toml's
src/ (or tests/, benches/, examples/; a build script is its own root);
- `self::` / `super::` are relative to the importing file's module path;
- a child module of the importing module is that module (2018 paths);
- a workspace member's crate name (a package `foo-bar` is `foo_bar`) is
that member;
- anything else (std, core, a dependency) binds no project symbol.
Inside the crate the item at the module the path names wins, else the
module the full path names, else a same-named item in a submodule of that
module (a re-export from below), else the type an associated item or enum
variant belongs to. Nothing else is guessed, ties break on module-path fit
then QN, and files with no Cargo.toml above them keep the generic
strategies. The CALLS import map is built from these IMPORTS edges in both
drivers, so import_map CALLS follow.
On jdx/mise this removes all 720 relative IMPORTS that crossed into
another workspace crate, all 1,123 IMPORTS bound through an external-crate
path and all 259 import_map CALLS that followed them; IMPORTS and
import_map CALLS into a crate the caller does not depend on drop from
920 and 12 to 0. Wall time and index worker peak RSS are unchanged; a
non-Rust control graph is byte-identical.
Strategy 4's module-prefix loop moves into resolve_module_prefixes so the
crate tree can reuse its lookup (plus the mod.rs form); Strategy 4's own
behaviour is unchanged.
Refs #2922 , #2932
Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com >
2026-11-10 00:15:38 +01:00
..
2026-10-20 23:09:09 +02:00
2026-09-18 23:27:23 +02:00
2026-11-01 21:29:22 +01:00
2026-10-16 13:54:11 +03:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-06-05 21:53:25 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-09-05 06:05:08 +02:00
2026-07-13 01:50:03 +02:00
2026-03-15 22:37:34 +01:00
2026-09-12 16:50:42 +02:00
2026-10-21 03:14:59 +02:00
2026-11-03 22:29:12 +01:00
2026-09-04 21:45:24 +07:00
2026-10-11 20:16:34 +02:00
2026-09-18 03:31:22 +02:00
2026-10-31 20:46:20 +01:00
2026-06-29 09:45:28 -06:00
2026-11-02 00:06:52 +01:00
2026-07-22 17:48:20 +02:00
2026-10-27 20:43:28 +01:00
2026-10-21 23:22:14 +02:00
2026-10-01 00:10:39 +02:00
2026-11-09 19:18:33 +01:00
2026-10-21 00:07:51 +02:00
2026-10-13 00:33:09 +02:00
2026-10-20 04:35:02 +02:00
2026-09-11 23:26:33 +02:00
2026-10-14 11:16:00 -05:00
2026-10-25 17:56:40 +01:00
2026-11-02 18:23:18 +01:00
2026-10-14 22:09:37 +02:00
2026-08-04 16:37:06 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-06 03:19:38 +02:00
2026-10-06 03:19:38 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-06-06 22:16:04 +02:00
2026-10-31 20:59:47 +01:00
2026-08-14 06:46:05 -04:00
2026-11-01 01:13:02 +01:00
2026-11-02 02:04:05 +01:00
2026-11-02 18:15:55 +01:00
2026-10-05 18:52:26 +02:00
2026-11-01 23:48:31 +01:00
2026-11-01 20:51:22 +01:00
2026-11-02 00:56:08 +01:00
2026-07-18 11:48:59 +02:00
2026-10-26 01:12:55 +01:00
2026-08-11 13:37:32 +02:00
2026-09-28 00:01:56 +02:00
2026-09-06 16:23:45 +02:00
2026-08-13 14:04:51 +02:00
2026-09-05 06:05:08 +02:00
2026-10-30 23:20:25 +01:00
2026-10-28 18:13:34 +01:00
2026-10-09 02:55:23 +02:00
2026-10-30 22:34:08 +01:00
2026-10-19 01:38:07 +02:00
2026-10-10 23:13:18 +02:00
2026-10-11 02:09:04 +02:00
2026-10-18 21:21:37 +02:00
2026-10-11 12:43:35 +02:00
2026-10-26 00:54:53 +01:00
2026-10-11 02:09:04 +02:00
2026-10-11 02:09:04 +02:00
2026-10-10 11:34:47 +02:00
2026-10-11 02:09:04 +02:00
2026-10-09 18:24:01 +02:00
2026-09-22 08:48:33 +02:00
2026-06-23 06:38:45 +09:00
2026-08-27 10:15:09 +02:00
2026-03-25 09:28:11 +01:00
2026-10-28 23:27:16 +01:00
2026-11-01 09:11:36 -08:00
2026-11-04 13:41:55 +05:30
2026-10-13 00:31:54 +02:00
2026-08-18 15:56:41 +08:00
2026-11-03 18:09:19 +01:00
2026-10-12 20:18:19 +02:00
2026-10-11 11:42:35 +02:00
2026-10-01 22:56:52 +02:00
2026-11-03 03:04:02 +01:00
2026-09-30 23:50:03 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-29 02:51:35 +01:00
2026-08-26 22:51:29 +02:00
2026-10-20 19:30:16 +02:00
2026-06-07 19:13:01 +02:00
2026-06-07 19:13:01 +02:00
2026-06-07 19:13:01 +02:00
2026-06-27 16:23:26 +02:00
2026-06-07 20:05:24 +02:00
2026-10-19 23:42:36 +02:00
2026-10-10 15:40:21 +02:00
2026-10-25 20:26:27 +01:00
2026-10-10 17:19:41 +02:00
2026-10-14 22:54:02 +02:00
2026-10-05 18:52:31 +02:00
2026-10-06 03:19:38 +02:00
2026-09-18 23:27:23 +02:00
2026-09-30 23:50:03 +02:00
2026-08-17 22:07:11 +03:00
2026-10-11 20:16:34 +02:00
2026-08-28 20:56:33 +02:00
2026-09-26 07:14:58 +02:00
2026-10-16 02:10:53 +02:00
2026-10-19 17:18:00 +08:00
2026-10-02 20:51:31 +02:00
2026-11-02 18:12:22 +01:00
2026-10-31 23:47:50 +01:00
2026-11-01 23:02:46 +01:00
2026-07-18 13:48:06 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-06 18:07:16 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-06 18:07:16 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-06-02 18:52:37 +02:00
2026-07-18 15:52:50 +02:00
2026-11-02 03:15:43 +01:00
2026-07-18 15:52:50 +02:00
2026-10-18 16:42:30 +02:00
2026-10-30 23:44:25 +01:00
2026-10-20 23:09:09 +02:00
2026-10-22 01:44:27 +00:00
2026-10-21 00:33:40 +02:00
2026-10-29 04:33:04 +01:00
2026-11-02 01:11:51 +01:00
2026-09-04 15:42:15 +02:00
2026-10-26 01:58:34 +01:00
2026-11-01 21:29:22 +01:00
2026-03-15 22:37:34 +01:00
2026-11-04 00:05:36 +01:00
2026-07-18 01:26:08 +02:00
2026-06-08 22:55:23 +02:00
2026-07-18 15:52:50 +02:00
2026-11-03 22:03:56 +01:00
2026-09-04 22:02:47 +02:00
2026-08-11 17:01:24 +02:00
2026-09-18 23:27:23 +02:00
2026-10-20 19:45:45 +02:00
2026-09-13 13:52:08 +03:00
2026-06-12 02:17:39 +02:00
2026-08-20 21:20:44 +02:00
2026-10-11 02:08:58 +02:00
2026-09-28 19:45:45 +02:00
2026-11-02 02:39:51 +01:00
2026-09-06 13:12:20 +08:00
2026-10-20 07:16:11 +02:00
2026-10-02 05:34:41 +02:00
2026-07-18 15:52:50 +02:00
2026-10-19 23:11:02 -05:00
2026-10-05 02:15:08 +02:00
2026-10-05 23:55:25 +02:00
2026-11-10 00:15:38 +01:00
2026-10-29 11:46:19 -05:00
2026-09-21 13:02:07 -05:00
2026-10-21 00:33:51 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-07-18 01:26:08 +02:00
2026-08-10 16:40:31 +02:00
2026-10-20 19:29:02 +02:00
2026-05-09 14:16:15 +02:00
2026-11-01 21:29:22 +01:00
2026-10-31 14:16:05 +01:00
2026-08-11 17:01:24 +02:00
2026-09-04 22:02:47 +02:00
2026-08-18 22:30:28 +02:00
2026-06-23 13:52:08 -03:00
2026-11-01 21:17:28 +01:00
2026-10-03 18:37:19 +02:00
2026-10-15 18:07:25 +02:00
2026-10-18 06:55:57 +02:00
2026-09-28 00:13:39 +02:00
2026-08-03 15:42:32 +02:00
2026-10-11 20:42:19 +02:00
2026-10-03 18:37:19 +02:00
2026-10-20 23:09:09 +02:00
2026-10-15 03:18:42 +02:00
2026-10-11 18:23:58 +02:00
2026-08-08 17:35:05 +02:00
2026-10-21 20:04:54 +02:00
2026-10-11 15:46:00 +02:00
2026-10-02 06:50:04 +02:00
2026-09-18 03:31:42 +02:00
2026-09-18 23:27:23 +02:00
2026-06-28 21:57:35 -06:00
2026-09-30 23:21:43 +02:00
2026-09-21 11:29:04 +03:00
2026-07-25 00:37:05 +02:00
2026-09-13 13:52:00 +03:00
2026-08-07 14:58:22 +02:00
2026-10-06 02:44:56 +02:00
2026-10-13 16:28:45 +09:00
2026-10-13 17:50:13 +08:00
2026-10-30 22:29:41 +01:00
2026-10-07 23:50:20 +00:00
2026-10-07 19:20:08 +02:00
2026-07-03 20:16:39 +02:00
2026-11-02 18:55:43 +01:00
2026-10-13 18:33:40 +02:00
2026-11-02 18:55:43 +01:00
2026-10-14 18:26:57 +02:00
2026-10-03 23:55:18 +02:00
2026-10-14 21:20:07 +02:00
2026-03-24 23:48:23 +01:00
2026-09-21 20:29:27 +02:00
2026-11-02 00:27:33 +01:00
2026-10-05 02:15:08 +02:00
2026-10-05 18:52:26 +02:00
2026-10-03 23:55:18 +02:00
2026-10-05 02:15:08 +02:00
2026-10-17 20:44:27 +02:00
2026-10-17 14:48:52 +02:00
2026-10-03 23:55:18 +02:00
2026-10-05 02:15:08 +02:00
2026-10-05 02:15:08 +02:00
2026-10-03 23:55:18 +02:00
2026-10-03 23:55:18 +02:00
2026-09-30 23:29:52 +02:00
2026-10-03 23:55:18 +02:00
2026-10-17 14:48:52 +02:00
2026-10-03 23:55:18 +02:00
2026-10-17 14:48:52 +02:00
2026-10-17 14:48:52 +02:00
2026-10-13 18:33:40 +02:00
2026-10-05 18:52:31 +02:00
2026-10-06 18:07:16 +02:00
2026-10-06 05:58:39 +02:00
2026-10-18 17:10:45 +02:00
2026-09-18 23:26:05 +02:00
2026-09-02 21:55:30 -04:00
2026-10-26 01:23:10 +01:00
2026-06-10 12:11:02 +02:00
2026-07-21 15:32:15 +02:00
2026-10-13 20:57:12 +02:00
2026-11-09 19:18:50 +01:00
2026-10-08 18:33:34 -06:00
2026-08-08 17:35:05 +02:00
2026-10-20 23:09:09 +02:00
2026-09-25 14:24:26 -05:00
2026-10-21 00:34:29 +02:00
2026-10-03 23:55:18 +02:00
2026-10-06 03:36:33 +02:00
2026-10-06 03:36:33 +02:00
2026-08-08 17:35:05 +02:00
2026-06-05 21:53:25 +02:00
2026-08-14 00:21:31 +02:00
2026-08-14 04:40:07 +02:00
2026-08-14 12:48:40 +02:00
2026-10-03 18:37:19 +02:00
2026-11-02 07:52:34 -06:00
2026-10-22 16:41:03 +05:30
2026-10-03 23:55:18 +02:00
2026-09-09 16:06:59 +08:00
2026-06-06 19:48:48 +02:00
2026-10-19 17:18:00 +08:00
2026-09-09 16:06:59 +08:00
2026-10-20 19:45:03 +02:00
2026-03-24 23:48:23 +01:00
2026-04-15 23:56:03 +02:00