Skip to content

add directory layout section - #12950

Closed
ShahakShama wants to merge 3 commits into
shahak/style-guide-rename-allocationsfrom
shahak/style-guide-directory-layout
Closed

ShahakShama wants to merge 3 commits into
shahak/style-guide-rename-allocationsfrom
shahak/style-guide-directory-layout

Conversation

@ShahakShama

@ShahakShama ShahakShama commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Note

Low Risk
Low risk because changes are documentation-only, but they may influence future code organization conventions across the repo.

Overview
Adds a new Directory Layout section to style.md that standardizes when to use foo.rs vs foo/mod.rs, requires mod.rs to be declaration-only, and documents where to put unit test files (including a #[path] pattern for single-file modules).

Removes the prior guideline to avoid mod.rs, effectively shifting the recommended module layout conventions.

Written by Cursor Bugbot for commit e8dfc47. This will update automatically on new commits. Configure here.

@reviewable-StarkWare

Copy link
Copy Markdown

This change is Reviewable

ShahakShama commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor Author

@ShahakShama
ShahakShama marked this pull request as ready for review March 2, 2026 11:29
@ShahakShama
ShahakShama requested a review from Stavbe March 2, 2026 11:29

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stavbe made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on ShahakShama).


style.md line 77 at r1 (raw file):

## Directory Layout

Single-file modules use `foo.rs`. Modules with submodules use `foo/mod.rs`.

WDYM by use?


style.md line 87 at r1 (raw file):

For a single-file module `foo.rs`, place tests in `foo_test.rs` in the same directory.

Use the `#[path]` attribute to make it a submodule of `foo`:

Do we have an explanation for why do we want this?

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama made 2 comments.
Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on Stavbe).


style.md line 77 at r1 (raw file):

Previously, Stavbe wrote…

WDYM by use?

Done.


style.md line 87 at r1 (raw file):

Previously, Stavbe wrote…

Do we have an explanation for why do we want this?

This is what we agreed with the goldbergs. If you want we can re-open this

@Stavbe Stavbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Stavbe made 3 comments.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on ShahakShama).


style.md line 87 at r1 (raw file):

Previously, ShahakShama wrote…

This is what we agreed with the goldbergs. If you want we can re-open this

Yes, I remember. I just think it is good to add an explanation of the `#[path]' attribute.


style.md line 77 at r2 (raw file):

## Directory Layout

Single-file modules should be in a file called `foo.rs`. Modules with submodules should be in a file called `foo/mod.rs`.

<module_name>.rs

Code quote:

foo.rs

style.md line 79 at r2 (raw file):

Single-file modules should be in a file called `foo.rs`. Modules with submodules should be in a file called `foo/mod.rs`.

`mod.rs` should not contain any code — it should only declare submodules.

This contradicts the previous sentence:
Modules with submodules should be in a file called foo/mod.rs
I think you mean that "Modules with submodules should be in a directory called foo that contains a file called mod.ts that contains...

Code quote:

`mod.rs` should not contain any code — it should only declare submodules.

@ShahakShama ShahakShama left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ShahakShama made 3 comments.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on Stavbe).


style.md line 87 at r1 (raw file):

Previously, Stavbe wrote…

Yes, I remember. I just think it is good to add an explanation of the `#[path]' attribute.

added an explanation that this makes the test a submodule and gives private access


style.md line 77 at r2 (raw file):

Previously, Stavbe wrote…

<module_name>.rs

You mean throughout the entire section or here specifically. If throughout I'm ok with this change even though I think it's less better. If only here it will break consistency


style.md line 79 at r2 (raw file):

Previously, Stavbe wrote…

This contradicts the previous sentence:
Modules with submodules should be in a file called foo/mod.rs
I think you mean that "Modules with submodules should be in a directory called foo that contains a file called mod.ts that contains...

Yes, that's what I meant, but it's clear that I mean modules with submodules from the fact I wrote mod.rs and not foo.rs
The sentence you wrote is too long IMO. I think this way is clear enough

@github-actions

Copy link
Copy Markdown

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale.
This PR will be closed and locked in 7 days if no further activity occurs.
Thank you for your contributions!

@github-actions github-actions Bot added the stale label May 29, 2026
@github-actions github-actions Bot closed this Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants