Skip to content
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

Mark proc-macro crates #8765

Merged
merged 2 commits into from
Oct 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/cargo/ops/tree/format/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,18 @@ impl<'a> fmt::Display for Display<'a> {
match chunk {
Chunk::Raw(s) => fmt.write_str(s)?,
Chunk::Package => {
write!(fmt, "{} v{}", package.name(), package.version())?;
let proc_macro_suffix = if package.proc_macro() {
" (proc-macro)"
} else {
""
};
write!(
fmt,
"{} v{}{}",
package.name(),
package.version(),
proc_macro_suffix
)?;

let source_id = package.package_id().source_id();
if !source_id.is_default_registry() {
Expand Down
18 changes: 9 additions & 9 deletions tests/testsuite/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ fn filters_target() {
"\
foo v0.1.0 ([..]/foo)
├── hostdep v1.0.0
└── pm_host v1.0.0
└── pm_host v1.0.0 (proc-macro)
[build-dependencies]
└── build_host_dep v1.0.0
└── hostdep v1.0.0
Expand All @@ -392,7 +392,7 @@ foo v0.1.0 ([..]/foo)
.with_stdout(
"\
foo v0.1.0 ([..]/foo)
├── pm_target v1.0.0
├── pm_target v1.0.0 (proc-macro)
└── targetdep v1.0.0
[build-dependencies]
└── build_host_dep v1.0.0
Expand All @@ -409,7 +409,7 @@ foo v0.1.0 ([..]/foo)
"\
foo v0.1.0 ([..]/foo)
├── hostdep v1.0.0
└── pm_host v1.0.0
└── pm_host v1.0.0 (proc-macro)
[build-dependencies]
└── build_host_dep v1.0.0
└── hostdep v1.0.0
Expand All @@ -422,8 +422,8 @@ foo v0.1.0 ([..]/foo)
"\
foo v0.1.0 ([..]/foo)
├── hostdep v1.0.0
├── pm_host v1.0.0
├── pm_target v1.0.0
├── pm_host v1.0.0 (proc-macro)
├── pm_target v1.0.0 (proc-macro)
└── targetdep v1.0.0
[build-dependencies]
├── build_host_dep v1.0.0
Expand Down Expand Up @@ -1211,7 +1211,7 @@ fn proc_macro_features() {
.with_stdout(
"\
foo v0.1.0 ([..]/foo)
├── pm v1.0.0
├── pm v1.0.0 (proc-macro)
│ └── somedep v1.0.0
│ └── optdep v1.0.0
└── somedep v1.0.0 (*)
Expand All @@ -1225,7 +1225,7 @@ foo v0.1.0 ([..]/foo)
.with_stdout(
"\
foo v0.1.0 ([..]/foo)
├── pm v1.0.0
├── pm v1.0.0 (proc-macro)
│ └── somedep v1.0.0
│ └── optdep v1.0.0
└── somedep v1.0.0
Expand Down Expand Up @@ -1261,7 +1261,7 @@ somedep v1.0.0
"\
somedep v1.0.0
├── foo v0.1.0 ([..]/foo)
└── pm v1.0.0
└── pm v1.0.0 (proc-macro)
└── foo v0.1.0 ([..]/foo)
",
)
Expand All @@ -1275,7 +1275,7 @@ somedep v1.0.0
└── foo v0.1.0 ([..]/foo)

somedep v1.0.0
└── pm v1.0.0
└── pm v1.0.0 (proc-macro)
└── foo v0.1.0 ([..]/foo)
",
)
Expand Down