Skip to content

Add a pub use example#2000

Merged
marioidival merged 1 commit intorust-lang:masterfrom
XiaoPengMei:docs/add-pub-use-example-1234
Mar 30, 2026
Merged

Add a pub use example#2000
marioidival merged 1 commit intorust-lang:masterfrom
XiaoPengMei:docs/add-pub-use-example-1234

Conversation

@XiaoPengMei
Copy link
Copy Markdown
Contributor

Closes #1234

Summary

  • add a small pub use example to the use declaration chapter
  • show how a module can re-export an item through its public interface

Validation

  • mdbook build
  • mdbook test

Notes

  • AI-assisted: I used Sisyphus to help draft and validate this documentation change, and I reviewed the final diff before submission.

Show how a module can re-export an item with pub use so the use declaration chapter covers that common pattern directly.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 27, 2026

r? @marioidival

rustbot has assigned @marioidival.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @marioidival

@marioidival marioidival merged commit 8819d3e into rust-lang:master Mar 30, 2026
1 check passed
This was referenced Mar 30, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 6, 2026
Update books

## rust-lang/reference

6 commits in 7446bf9697c95d155eef33c6a9d91fbd29a5e359..d2715c07e9dd9839c0c7675ecfa18bec539a6ee9
2026-03-31 18:18:16 UTC to 2026-03-23 21:49:16 UTC

- Guarantee size and alignment of more integer primitives (rust-lang/reference#2205)
- [type layout] usize and isize have the same size and alignment (rust-lang/reference#2200)
- Update reference for attribute order changes (rust-lang/reference#2213)
- Fix note for non_exhaustive enum read (rust-lang/reference#2211)
- Update link_name duplicates note (rust-lang/reference#2216)
- Note scoping differences between `*x` and `*x.deref()` , and `a[b]` and `*a.index(b)` (rust-lang/reference#2073)

## rust-lang/rust-by-example

8 commits in 5383db524711c0c9c43c3ca9e5e706089672ed6a..b31e3b8da01eeba0460f86a52a55af82709fadf5
2026-04-01 11:59:18 UTC to 2026-03-30 12:17:12 UTC

- fix: correct into_iter() example to compile properly (rust-lang/rust-by-example#2001)
- fix: correct destruction order comments in Drop TempFile example (rust-lang/rust-by-example#2002)
- fix: replace confusing 'module' with 'item' in formatted print docs (rust-lang/rust-by-example#2003)
- fix: clarify misleading 'Error' comment in print_display example (rust-lang/rust-by-example#2004)
- fix: clarify comment about tuple struct field access in testcase_list (rust-lang/rust-by-example#2005)
- fix: correct iter/into_iter type comments in iter_find example (rust-lang/rust-by-example#2006)
- fix: replace year-to-days conversion with miles-to-km in newtype example (rust-lang/rust-by-example#2007)
- Add a pub use example (rust-lang/rust-by-example#2000)
jhpratt added a commit to jhpratt/rust that referenced this pull request Apr 6, 2026
Update books

## rust-lang/reference

6 commits in 7446bf9697c95d155eef33c6a9d91fbd29a5e359..d2715c07e9dd9839c0c7675ecfa18bec539a6ee9
2026-03-31 18:18:16 UTC to 2026-03-23 21:49:16 UTC

- Guarantee size and alignment of more integer primitives (rust-lang/reference#2205)
- [type layout] usize and isize have the same size and alignment (rust-lang/reference#2200)
- Update reference for attribute order changes (rust-lang/reference#2213)
- Fix note for non_exhaustive enum read (rust-lang/reference#2211)
- Update link_name duplicates note (rust-lang/reference#2216)
- Note scoping differences between `*x` and `*x.deref()` , and `a[b]` and `*a.index(b)` (rust-lang/reference#2073)

## rust-lang/rust-by-example

8 commits in 5383db524711c0c9c43c3ca9e5e706089672ed6a..b31e3b8da01eeba0460f86a52a55af82709fadf5
2026-04-01 11:59:18 UTC to 2026-03-30 12:17:12 UTC

- fix: correct into_iter() example to compile properly (rust-lang/rust-by-example#2001)
- fix: correct destruction order comments in Drop TempFile example (rust-lang/rust-by-example#2002)
- fix: replace confusing 'module' with 'item' in formatted print docs (rust-lang/rust-by-example#2003)
- fix: clarify misleading 'Error' comment in print_display example (rust-lang/rust-by-example#2004)
- fix: clarify comment about tuple struct field access in testcase_list (rust-lang/rust-by-example#2005)
- fix: correct iter/into_iter type comments in iter_find example (rust-lang/rust-by-example#2006)
- fix: replace year-to-days conversion with miles-to-km in newtype example (rust-lang/rust-by-example#2007)
- Add a pub use example (rust-lang/rust-by-example#2000)
rust-timer added a commit to rust-lang/rust that referenced this pull request Apr 7, 2026
Rollup merge of #154901 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/reference

6 commits in 7446bf9697c95d155eef33c6a9d91fbd29a5e359..d2715c07e9dd9839c0c7675ecfa18bec539a6ee9
2026-03-31 18:18:16 UTC to 2026-03-23 21:49:16 UTC

- Guarantee size and alignment of more integer primitives (rust-lang/reference#2205)
- [type layout] usize and isize have the same size and alignment (rust-lang/reference#2200)
- Update reference for attribute order changes (rust-lang/reference#2213)
- Fix note for non_exhaustive enum read (rust-lang/reference#2211)
- Update link_name duplicates note (rust-lang/reference#2216)
- Note scoping differences between `*x` and `*x.deref()` , and `a[b]` and `*a.index(b)` (rust-lang/reference#2073)

## rust-lang/rust-by-example

8 commits in 5383db524711c0c9c43c3ca9e5e706089672ed6a..b31e3b8da01eeba0460f86a52a55af82709fadf5
2026-04-01 11:59:18 UTC to 2026-03-30 12:17:12 UTC

- fix: correct into_iter() example to compile properly (rust-lang/rust-by-example#2001)
- fix: correct destruction order comments in Drop TempFile example (rust-lang/rust-by-example#2002)
- fix: replace confusing 'module' with 'item' in formatted print docs (rust-lang/rust-by-example#2003)
- fix: clarify misleading 'Error' comment in print_display example (rust-lang/rust-by-example#2004)
- fix: clarify comment about tuple struct field access in testcase_list (rust-lang/rust-by-example#2005)
- fix: correct iter/into_iter type comments in iter_find example (rust-lang/rust-by-example#2006)
- fix: replace year-to-days conversion with miles-to-km in newtype example (rust-lang/rust-by-example#2007)
- Add a pub use example (rust-lang/rust-by-example#2000)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Apr 8, 2026
Update books

## rust-lang/reference

6 commits in 7446bf9697c95d155eef33c6a9d91fbd29a5e359..d2715c07e9dd9839c0c7675ecfa18bec539a6ee9
2026-03-31 18:18:16 UTC to 2026-03-23 21:49:16 UTC

- Guarantee size and alignment of more integer primitives (rust-lang/reference#2205)
- [type layout] usize and isize have the same size and alignment (rust-lang/reference#2200)
- Update reference for attribute order changes (rust-lang/reference#2213)
- Fix note for non_exhaustive enum read (rust-lang/reference#2211)
- Update link_name duplicates note (rust-lang/reference#2216)
- Note scoping differences between `*x` and `*x.deref()` , and `a[b]` and `*a.index(b)` (rust-lang/reference#2073)

## rust-lang/rust-by-example

8 commits in 5383db524711c0c9c43c3ca9e5e706089672ed6a..b31e3b8da01eeba0460f86a52a55af82709fadf5
2026-04-01 11:59:18 UTC to 2026-03-30 12:17:12 UTC

- fix: correct into_iter() example to compile properly (rust-lang/rust-by-example#2001)
- fix: correct destruction order comments in Drop TempFile example (rust-lang/rust-by-example#2002)
- fix: replace confusing 'module' with 'item' in formatted print docs (rust-lang/rust-by-example#2003)
- fix: clarify misleading 'Error' comment in print_display example (rust-lang/rust-by-example#2004)
- fix: clarify comment about tuple struct field access in testcase_list (rust-lang/rust-by-example#2005)
- fix: correct iter/into_iter type comments in iter_find example (rust-lang/rust-by-example#2006)
- fix: replace year-to-days conversion with miles-to-km in newtype example (rust-lang/rust-by-example#2007)
- Add a pub use example (rust-lang/rust-by-example#2000)
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 8, 2026
Update books

## rust-lang/reference

6 commits in 7446bf9697c95d155eef33c6a9d91fbd29a5e359..d2715c07e9dd9839c0c7675ecfa18bec539a6ee9
2026-03-31 18:18:16 UTC to 2026-03-23 21:49:16 UTC

- Guarantee size and alignment of more integer primitives (rust-lang/reference#2205)
- [type layout] usize and isize have the same size and alignment (rust-lang/reference#2200)
- Update reference for attribute order changes (rust-lang/reference#2213)
- Fix note for non_exhaustive enum read (rust-lang/reference#2211)
- Update link_name duplicates note (rust-lang/reference#2216)
- Note scoping differences between `*x` and `*x.deref()` , and `a[b]` and `*a.index(b)` (rust-lang/reference#2073)

## rust-lang/rust-by-example

8 commits in 5383db524711c0c9c43c3ca9e5e706089672ed6a..b31e3b8da01eeba0460f86a52a55af82709fadf5
2026-04-01 11:59:18 UTC to 2026-03-30 12:17:12 UTC

- fix: correct into_iter() example to compile properly (rust-lang/rust-by-example#2001)
- fix: correct destruction order comments in Drop TempFile example (rust-lang/rust-by-example#2002)
- fix: replace confusing 'module' with 'item' in formatted print docs (rust-lang/rust-by-example#2003)
- fix: clarify misleading 'Error' comment in print_display example (rust-lang/rust-by-example#2004)
- fix: clarify comment about tuple struct field access in testcase_list (rust-lang/rust-by-example#2005)
- fix: correct iter/into_iter type comments in iter_find example (rust-lang/rust-by-example#2006)
- fix: replace year-to-days conversion with miles-to-km in newtype example (rust-lang/rust-by-example#2007)
- Add a pub use example (rust-lang/rust-by-example#2000)
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.

Add a example for pub use.

3 participants