Skip to content

Commit

Permalink
Auto merge of #8765 - l4l:proc-macro-suffix, r=alexcrichton
Browse files Browse the repository at this point in the history
Mark proc-macro crates

Resolves #8107
  • Loading branch information
bors committed Oct 11, 2020
2 parents b8448d7 + d17311d commit ab69d6a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
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

0 comments on commit ab69d6a

Please sign in to comment.