-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong "uses" edges for reexported inner modules' types #79
Comments
I'll have to do a more thorough investigation for this, but my guess is that this difference is due to the fact that we make use of rust-analyzer's HIR, rather than it's AST. The HIR might be providing an already resolved dependency graph? Previously we did depend on an AST (the one from rustc), but that resulted in lots of issues related to path solution, However I have the feeling that in future we might want to analyze both, the AST, as well as the HIR, since the latter doesn't seem to have any information on inter-type dependencies, either. |
I'm closing this
Where solid lines denote "owns" edges and dashed lines denote "uses" edges. Corresponding dot code
digraph {
graph [
label="github_issue_79",
labelloc=t,
pad=0.4,
layout=neato,
overlap=false,
splines="line",
rankdir=LR,
fontname="Helvetica",
fontsize="36",
];
node [
fontname="monospace",
fontsize="10",
shape="record",
style="filled",
];
edge [
fontname="monospace",
fontsize="10",
];
"github_issue_79" [label="crate|github_issue_79", fillcolor="#5397c8"]; // "crate" node
"github_issue_79::a" [label="pub mod|a", fillcolor="#81c169"]; // "mod" node
"github_issue_79::a::b" [label="pub mod|a::b", fillcolor="#81c169"]; // "mod" node
"github_issue_79::a::b::c" [label="pub(self) mod|a::b::c", fillcolor="#db5367"]; // "mod" node
"github_issue_79::a::d" [label="pub mod|a::d", fillcolor="#81c169"]; // "mod" node
"github_issue_79::a::d::e" [label="pub(self) mod|a::d::e", fillcolor="#db5367"]; // "mod" node
"github_issue_79" -> "github_issue_79::a" [label="owns", color="#000000", style="solid"] [constraint=true]; // "owns" edge
"github_issue_79::a" -> "github_issue_79::a::b" [label="owns", color="#000000", style="solid"] [constraint=true]; // "owns" edge
"github_issue_79::a::b" -> "github_issue_79::a::b::c" [label="owns", color="#000000", style="solid"] [constraint=true]; // "owns" edge
"github_issue_79::a::b" -> "github_issue_79::a::b::c" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"github_issue_79::a" -> "github_issue_79::a::d" [label="owns", color="#000000", style="solid"] [constraint=true]; // "owns" edge
"github_issue_79::a::d" -> "github_issue_79::a::d::e" [label="owns", color="#000000", style="solid"] [constraint=true]; // "owns" edge
"github_issue_79::a" -> "github_issue_79::a::b::c" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
"github_issue_79::a" -> "github_issue_79::a::d" [label="uses", color="#7f7f7f", style="dashed"] [constraint=false]; // "uses" edge
} Since As such:
|
A common pattern is for a module to define an inner private module, then reexport parts of that private module as its own public API. Two ways of doing this are
pub use
andpub type
. But cargo-modules doesn't seem to generate the correct output for either. For example, when using this input as lib.rs:I would expect the output to include the following uses edges:
However, cargo-modules omits the
d -> e
edge, and changes thea -> b
edge intoa -> c
. Here are the actual uses edges it generates:The text was updated successfully, but these errors were encountered: