Stream: compiler development

Topic: Cargo deps workspace


view this post on Zulip Luke Boswell (Nov 28 2024 at 22:47):

Just noticed this comment... is this something we want to update across the whole compiler? basically have one reference in the workspace and then all the crates use that?

Screenshot 2024-11-29 at 09.44.07.png

I'm contemplating doing a pass through the crates and making a PR to do this, it would make life easier in the long run when we refactor things.

view this post on Zulip Luke Boswell (Nov 28 2024 at 22:48):

I didn't know you could use workspace paths for our own crates... I thought it was only possible for external packages.

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:49):

Hmm... I guess we could do it for local imports

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:49):

Sounds nice to not need to get paths right....though seeing paths may minorly help key people that they are importing things they shouldn't.

view this post on Zulip Luke Boswell (Nov 28 2024 at 22:50):

There's still a path, just in the one Cargo.toml in the root of the workspace instead of repeated throughout all of the crates

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:51):

Like of you have to use a ton of ../, you may be important in something form far away and making the time to compile the roc compiler worse due to bad cargo dependency tree

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:51):

At the same time, our dependency tree is already screwed up really bad (from a compile time perspective), so maybe that doesn't matter

view this post on Zulip Luke Boswell (Nov 28 2024 at 22:52):

I think making it easier to refactor and reorganise the crates will help us improve the situation

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:53):

Maybe though realistically, it needs a very target project mostly related to compiling the roc builtins to get fixed up.

view this post on Zulip Luke Boswell (Nov 28 2024 at 22:53):

If it's not really helpful I might just leave it for now. We can revisit later. Thanks :smiley:

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:53):

I mean sounds reasonable to do

view this post on Zulip Brendan Hansknecht (Nov 28 2024 at 22:54):

Like doesn't hurt anything, but I don't think it is much of a gain either

view this post on Zulip Luke Boswell (Nov 28 2024 at 22:54):

Yeah, it was just something I stumbled into while looking at the llvm-upgrade PR and thought it would be better to fix in main and then merge. But I might leave it for a later time and not get too distracted.

view this post on Zulip Ayaz Hafiz (Nov 28 2024 at 23:13):

i think for local crates it doesn’t matter. there aren’t going to be two local crates of the same name. I think this is very useful for 3p dependencies though so you have one version across the board.

view this post on Zulip Richard Feldman (Nov 28 2024 at 23:26):

Luke Boswell said:

I didn't know you could use workspace paths for our own crates... I thought it was only possible for external packages.

yeah I found about this at Zed. I really like it!

view this post on Zulip Richard Feldman (Nov 28 2024 at 23:27):

I'd like to have it for all our local crates, so we don't have to get all the ..s right and so forth

view this post on Zulip Richard Feldman (Nov 28 2024 at 23:28):

I don't think it's urgent or anything, which was why I figured I'd just introduce it with the soa crate and start doing it, then figured eventually we'd convert over the existing crates

view this post on Zulip Richard Feldman (Nov 28 2024 at 23:28):

but if you'd like to do a pass to make everything consistent, that seems fine to me!

view this post on Zulip Luke Boswell (Nov 29 2024 at 00:38):

Done https://github.com/roc-lang/roc/pull/7265


Last updated: Jul 06 2025 at 12:14 UTC