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

Build failure: crate proc_macro is private #11

Closed
elihunter173 opened this issue Jun 29, 2020 · 4 comments
Closed

Build failure: crate proc_macro is private #11

elihunter173 opened this issue Jun 29, 2020 · 4 comments
Labels
D-accepted A decision (D) has been made and the issue will be worked on I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid

Comments

@elihunter173
Copy link

When I try to build the project on any of machines, I get the following error. My guess is that an import was misplaced but I don't know why the CI builds wouldn't catch it.

  Downloaded version_check v0.9.2
  Downloaded proc-macro-error v1.0.3
  Downloaded proc-macro-error-attr v1.0.3
  Downloaded quote v1.0.7
  Downloaded syn-mid v0.5.0
  Downloaded unicode-xid v0.2.1
  Downloaded syn v1.0.33
  Downloaded 7 crates (301.2 KB) in 0.66s
   Compiling proc-macro2 v1.0.18
   Compiling unicode-xid v0.2.1
   Compiling version_check v0.9.2
   Compiling syn v1.0.33
   Compiling proc-macro-error-attr v1.0.3
   Compiling proc-macro-error v1.0.3
   Compiling quote v1.0.7
   Compiling syn-mid v0.5.0
   Compiling duplicate v0.0.0 (/tmp/duplicate)
error[E0603]: crate `proc_macro` is private
   --> src/parse_utils.rs:3:2
    |
3   |     proc_macro::{Punct, Spacing},
    |     ^^^^^^^^^^ private crate
    |
note: the crate `proc_macro` is defined here
   --> /home/eli/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro-error-1.0.3/src/lib.rs:256:1
    |
256 | extern crate proc_macro;
    | ^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `proc_macro_error::*`
 --> src/parse.rs:6:5
  |
6 | use proc_macro_error::*;
  |     ^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused import: `*`
 --> src/parse_utils.rs:4:2
  |
4 |     *,
  |     ^

error: aborting due to previous error; 2 warnings emitted

For more information about this error, try `rustc --explain E0603`.
error: could not compile `duplicate`.

To learn more, run the command again with --verbose.

This patch should fix it. I'll submit a PR after I test it and also replace the wildcard imports.

index 6a7fd06..96061a7 100644
--- a/src/parse_utils.rs
+++ b/src/parse_utils.rs
@@ -1,8 +1,5 @@
-use proc_macro::{Delimiter, Group, Span, TokenTree};
-use proc_macro_error::{
-	proc_macro::{Punct, Spacing},
-	*,
-};
+use proc_macro::{Delimiter, Group, Punct, Spacing, Span, TokenTree};
+use proc_macro_error::*;
 
 /// Tries to parse a valid group from the given token stream iterator, returning
 /// the group if successful.
@ghost ghost added the T-new Triage (T): Has yet to be reviewed label Jun 29, 2020
@Emoun Emoun added I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid and removed T-new Triage (T): Has yet to be reviewed labels Jun 29, 2020
@Emoun
Copy link
Owner

Emoun commented Jun 29, 2020

@elihunter173 thank you for the issue and PR. I will have a look at them later today.
This is indeed weird, as I'm using the crate in one of my other projects and have not encountered this before.

@Emoun
Copy link
Owner

Emoun commented Jun 29, 2020

This actually seems to be a problem with proc_macro_error v1.0.3.
v1.0.2 compiles fine on my machine, but updating my lock file will cause me this error too.

It seems proc_macro_error had a hidden re-export of proc_macro that I accidentally used instead of using the crate directly.

I made an issue with proc_macro_error to make them aware of this.

@Emoun
Copy link
Owner

Emoun commented Jun 29, 2020

PR merged.

@Emoun
Copy link
Owner

Emoun commented Jun 29, 2020

@elihunter173 I have release v0.2.5 with your fix.

Thanks for reporting the issue and contributing the PR. If you need help, have feature requests, or find more bugs feel free to open more issues/PRs.

@Emoun Emoun added the D-accepted A decision (D) has been made and the issue will be worked on label Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
D-accepted A decision (D) has been made and the issue will be worked on I-bug This issue (I) regards a (potential) bug in the project T-accepted Triage (T): Initial review accepted issue/PR as valid
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants