Skip to content

Conversation

@HackingRepo
Copy link

@HackingRepo HackingRepo commented Nov 26, 2025

This RFC would introduce glob exports for only public item.

Rendered

@ehuss ehuss added the T-lang Relevant to the language team, which will review and decide on the RFC. label Nov 26, 2025
@Diggsey
Copy link
Contributor

Diggsey commented Nov 27, 2025

They export everything

That's not quite true - private items are not exported. See https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=5917d9c29d6ac204394b33a806e2bbb9

# Reference-level explanation
[reference-level-explanation]: #reference-level-explanation

- Parsing: `pub *` is treated as a glob pattern filtered by visibility.
Copy link
Member

Choose a reason for hiding this comment

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

in a group it would be pub use crate_name::{pub *, other_stuff}?

pub use crate::mymod::pub *;
```

This re‑exports all items from a module that are already marked `pub`, while excluding private helpers. It balances ergonomics (no need to maintain huge allowlists) with safety (no accidental leakage of private items).
Copy link

Choose a reason for hiding this comment

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

Isn't this how glob exports already work? In addition to @Diggsey s example, using pub(super) isn't exported either.

Do you have example code of something that is exported by globa today that wouldn't be exported with pub *?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-lang Relevant to the language team, which will review and decide on the RFC.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants