Skip to content

Prefer longest match in path dependency search - #341

Merged
dtolnay merged 1 commit into
masterfrom
longestdep
Aug 3, 2026
Merged

Prefer longest match in path dependency search#341
dtolnay merged 1 commit into
masterfrom
longestdep

Conversation

@dtolnay

@dtolnay dtolnay commented Aug 3, 2026

Copy link
Copy Markdown
Owner

The previous behavior was the match having the alphanumerically least name would be used in the replacement, which isn't a justifiable behavior.

[dependencies]
a = { path = "../b/a" }  # $A/src/lib.rs
b = { path = "../b" }    # $B/src/lib.rs
c = { path = "../b/c" }  # $B/c/src/lib.rs

After this PR the new behavior uses the longest match: $A/src/lib.rs, $B/src/lib.rs, $C/src/lib.rs.

Always using shortest match would also produce reasonable behavior. $B/a/src/lib.rs, $B/src/lib.rs, $B/c/src/lib.rs

@dtolnay
dtolnay merged commit a20999d into master Aug 3, 2026
20 checks passed
@dtolnay
dtolnay deleted the longestdep branch August 3, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant