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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Whether one path is a confined location beneath a repository root.
//!
//! One owner, because a confinement rule that existed twice could hold for the
//! seam that asked and not for the seam that read. Every seam in either language
//! takes its answer from here and maps it into the typed error its own boundary
//! publishes: the Rust store that resolves a module candidate, the Rust provider
//! that opens a source, and the Go loader, discovery walk, and provider through
//! their own `PathFault`.
//!
//! Three answers, not two. A path the root does not hold is absence, which the
//! Go tree reports as absence and the Rust tree folds back into the not-found
//! read it is. That fold lives here as [`canonical_present`], so the two Rust
//! seams cannot disagree about what a missing candidate is called.
use ;
/// Why one path is not a confined location beneath a repository root.
///
/// Two answers, because a caller has to tell them apart: a path the filesystem
/// refused to resolve says nothing about where it is, while a path that
/// resolved and landed outside says exactly where it is and that the root does
/// not hold it.
pub
/// The canonical form of `path`, absent when the root holds nothing there, and
/// refused when it resolves outside `root`.
///
/// Symlinks are followed before the decision, so a link inside the root that
/// points outside it is refused rather than read. One owner, because a
/// confinement rule that existed twice could hold for the seam that asked and
/// not for the seam that read.
///
/// Only "no such file" is absence. Every other read failure — a denied
/// permission, a symlink loop, a dangling link, an over-long name — is reported,
/// so a source nobody may read cannot be reported as one the repository never
/// held. A path that resolves outside the root is refused here rather than
/// reported as absent, so a symlink cannot widen what a caller goes on to read.
pub
/// The same answer for a seam that states no absence.
///
/// Both Rust seams name a path they expect the root to hold, so nothing there is
/// the not-found read it is rather than a third outcome they would each have to
/// invent a spelling for.
pub