Skip to content

docs(layout): Updated layout module docs to document new layout#16502

Merged
epage merged 3 commits into
rust-lang:masterfrom
ranger-ross:layout-docs
Feb 17, 2026
Merged

docs(layout): Updated layout module docs to document new layout#16502
epage merged 3 commits into
rust-lang:masterfrom
ranger-ross:layout-docs

Conversation

@ranger-ross

@ranger-ross ranger-ross commented Jan 13, 2026

Copy link
Copy Markdown
Member

What does this PR try to resolve?

This PR updates the layout module docs to reflect the update layout structure changes made as part of #15010

How to test and review this PR?

no response

Follow up needed

  • Add a note in the tracking issue to updating these docs in the stabilization PR

@rustbot rustbot added A-layout Area: target output directory layout, naming, and organization S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 13, 2026
@rustbot

rustbot commented Jan 13, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs
github-merge-queue Bot pushed a commit that referenced this pull request Jan 15, 2026
### What does this PR try to resolve?

While documenting the `build-dir` layout changes in
#16502 I noticed that we are
still creating the `<build-dir>/<profile>/examples` directory when
`-Zbuild-dir-new-layout` is passed even though its no longer used.
This PR fixes it

cc tracking issue: #15010

### How to test and review this PR?

Updating the existing examples test to catch this particular case

r? @epage
github-merge-queue Bot pushed a commit that referenced this pull request Jan 15, 2026
### What does this PR try to resolve?

In #16502 (comment)
there was a discussion about merging the `build-script` and `deps` dirs
in the `build-dir`.

Currently:
```
build-dir/<profile>/build/<pkgname>/<hash>/
    deps/ # rustc output
    build-script/ # build script binary
    build-script-execution/ # the output of running a build script
```

Note: For build-scripts `deps` is empty.

This PR:
1. moves the build script binaries from `build-script` to `deps` to
simplify the layout
2. renames `build-script-execution` to `build-script` to simplify the
dir naming and shorten the path length for windows

```
build-dir/<profile>/build/<pkgname>/<hash>/
    deps/ # rustc output including build-script bins
    build-script/ # the output of running a build script
```

cc tracking issue: #15010

### How to test and review this PR?

see the test changes

r? @epage
github-merge-queue Bot pushed a commit that referenced this pull request Jan 17, 2026
### What does this PR try to resolve?

This spawned out of
#16502 (comment)
when I noticed artifact dependencies are not using the new build-dir
layout.

This PR moves them from
`<build-dir>/<profile>/deps/artifact/$pkgname-$META` (old layout) to
`<build-dir>/<profile>/build/$pkgname/$META/deps/artifact/<kind>` when
`-Zbuild-dir-new-layout` is enabled.

cc tracking issue: #15010

### How to test and review this PR?

Added new test specifically for artifact deps

r? @epage
github-merge-queue Bot pushed a commit that referenced this pull request Feb 11, 2026
### What does this PR try to resolve?

This PR makes more changes to the new `build-dir` layout as discussed in
#16502 (comment).

The goal here is to have more general (and thus reusable) directories in
the build unit structure.

#### Layout changes

1. Rename `{build-unit-dir}/deps` to `{build-unit-dir}/out`
2. Moved build-script `OUT_DIR` from `{build-unit-dir}/build-script/out`
to `{build-unit-dir}/out`
3. Renamed `{build-unit-dir}/build-script` to `{build-unit-dir}/run`
* This makes the dir more general to any build unit that can execute an
external process. (but currently only build-scripts use it)

The resulting structure looks like

```
build-dir/debug/build/<pkgname>/<HASH>
    fingerprint/
    out/
    run/
    .lock
```

Part of #15010

### How to test and review this PR?

See the test updates included in each commit
@rustbot

This comment has been minimized.

@ranger-ross

Copy link
Copy Markdown
Member Author

Okay I am finally coming back to this PR now that #16515, #16519, and #16542 are merged.

I've updated the documentation to reflect the changes added in those PRs.

Comment thread src/cargo/core/compiler/layout.rs
Comment thread src/cargo/core/compiler/layout.rs Outdated
Comment thread src/cargo/core/compiler/layout.rs Outdated
@ranger-ross ranger-ross force-pushed the layout-docs branch 2 times, most recently from 20862b4 to 53e09a7 Compare February 15, 2026 12:20
Comment on lines +24 to +25
//! # Root directory for all compiled examples.
//! examples/

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.

Shouldn't this be removed from build-dir?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Actually its still present in the old layout.
It contains the pre-uplifted bins

} else if unit.target.is_example() && !self.ws.gctx().cli_unstable().build_dir_new_layout {
self.layout(unit.kind).build_dir().examples().to_path_buf()

In the new layout, the examples will use the <build-unit>/out dir just like regular compilation build units

Comment on lines +172 to +184
//! # Set of source filenames for this package.
//! dep-lib-$targetname
//! # Timestamp when this package was last built.
//! invoked.timestamp
//! # The fingerprint hash.
//! lib-$targetname
//! # Detailed information used for logging the reason why
//! # something is being recompiled.
//! lib-$targetname.json
//! # The console output from the compiler. This is cached
//! # so that warnings can be redisplayed for "fresh" units.
//! output-lib-$targetname
//!

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.

Side note: I feel like we could design the entire fingerprint/ directory.

@epage epage enabled auto-merge February 17, 2026 01:01
@epage epage added this pull request to the merge queue Feb 17, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Feb 17, 2026
@ranger-ross

Copy link
Copy Markdown
Member Author

hmmm, seems github actions died? We can probably rerun.

@epage epage added this pull request to the merge queue Feb 17, 2026
Merged via the queue into rust-lang:master with commit 8cc0cb1 Feb 17, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 17, 2026
@ranger-ross ranger-ross deleted the layout-docs branch February 18, 2026 15:47
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Feb 21, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
@rustbot rustbot added this to the 1.95.0 milestone Feb 21, 2026
github-actions Bot pushed a commit to rust-lang/miri that referenced this pull request Feb 22, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Feb 23, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 19, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
makai410 pushed a commit to makai410/rustc_public that referenced this pull request Mar 27, 2026
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-layout Area: target output directory layout, naming, and organization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants