Clarify how normal modules are located inside a `#[path]` module.

Open
#573 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
52/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
documentation

Research direction

Open the Rust Reference documentation for the path attribute and inspect the existing module-location explanation. Use the supplied lib.rs and foo.rs example to clarify how mod y; is resolved inside a path-selected module. Done means the documentation explains the relative location rule without ambiguity.

Written by the indexing model from the issue text.

Description

A-attributes

The path attribute documentation explains how #[path] annotated modules are found. It does not explain how non-attributed modules are located once inside a #[path] module. For example:

// lib.rs
#[path = "foo.rs"]
mod x;
// foo.rs
mod y;   // y must be y.rs or y/mod.rs, relative to foo.rs.

In this case, once inside foo.rs, module locations will be relative to foo's location.

Dominant language
Rust
Stars
1.6k
Forks
607
Avg merge
1d 1h
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/reference

All issues in rust-lang/reference

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.