1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! Resolve `mod foo;` references to actual files using the standard
//! Rust 2018 conventions.
//!
//! Rules implemented (in order, first hit wins):
//! 1. `#[path = "..."]` attribute on the `mod` declaration → that file
//! (relative to the file containing the `mod` decl).
//! 2. Sibling file `<dir>/foo.rs`.
//! 3. Submodule directory `<dir>/foo/mod.rs`.
//! 4. Submodule directory `<dir>/foo/<foo>.rs` (rare; only used if (2)
//! and (3) are both missing — we still try as a courtesy).
//!
//! `<dir>` for a file `foo.rs` is its parent directory; for `mod.rs` or
//! `lib.rs`/`main.rs` it is also the parent. There's no special case
//! needed because the convention is "child mods live under the
//! containing file's directory" for both forms.
use crateModRef;
use ;
/// Returns the resolved file path for a `mod foo;` reference declared in
/// `containing_file`, or `None` if no candidate exists on disk.