galvanic-mock icon indicating copy to clipboard operation
galvanic-mock copied to clipboard

Build fails with Rust 1.27.0

Open asomers opened this issue 7 years ago • 1 comments

galvanic-mock's own tests pass using rustc 1.26.0-nightly (28a1e4ffe 2018-02-24), but fail using rustc 1.27.0-nightly (e5f80f2a4 2018-05-09).

> cargo +nightly test
   Compiling galvanic-mock v0.1.3 (file:///usr/home/somers/src/rust/galvanic-mock)
error[E0658]: custom attributes cannot be applied to modules
  --> tests/mock_with_explicit_type_name.rs:26:1
   |
26 | #[use_mocks]
   | ^^^^^^^^^^^^
   |
   = help: add #![feature(proc_macro_mod)] to the crate attributes to enable

error: custom attribute panicked
  --> tests/mock_referred_trait.rs:26:1
   |
26 | #[mockable(intern ::sub1::sub2)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: failed to parse #[mockable(..)] requires the absolute path of the trait's module.It must be preceded with `extern`/`intern` if the trait is defined in another crate/module

error: custom attribute panicked
  --> tests/mock_trait_in_submodules.rs:23:9
   |
23 |         #[mockable(::sub1::sub2)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: message: failed to parse #[mockable(..)] requires the absolute path of the trait's module.It must be preceded with `extern`/`intern` if the trait is defined in another crate/module

error: aborting due to previous error
error: aborting due to previous error


error[E0658]: custom attributes cannot be applied to modules
  --> tests/use_mocks_on_module.rs:26:1
   |
26 | #[use_mocks]
   | ^^^^^^^^^^^^
   |
   = help: add #![feature(proc_macro_mod)] to the crate attributes to enable

error: Could not compile `galvanic-mock`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `galvanic-mock`.
warning: build failed, waiting for other jobs to finish...
error[E0658]: custom attributes cannot be applied to modules
  --> tests/use_mocks_on_module.rs:42:1
   |
42 | #[use_mocks]
   | ^^^^^^^^^^^^
   |
   = help: add #![feature(proc_macro_mod)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
error: Could not compile `galvanic-mock`.
warning: build failed, waiting for other jobs to finish...
error: Could not compile `galvanic-mock`.
warning: build failed, waiting for other jobs to finish...
warning: unnecessary parentheses around function argument
  --> tests/verify_on_drop.rs:27:1
   |
27 | #[use_mocks]
   | ^^^^^^^^^^^^ help: remove these parentheses
   |
   = note: #[warn(unused_parens)] on by default

warning: unnecessary parentheses around function argument
  --> tests/verify_on_drop.rs:43:1
   |
43 | #[use_mocks]
   | ^^^^^^^^^^^^ help: remove these parentheses

error: custom attribute panicked
   --> tests/expect_different_interactions.rs:394:5
    |
394 |     #[mockable(::multiple_traits)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: message: failed to parse #[mockable(..)] requires the absolute path of the trait's module.It must be preceded with `extern`/`intern` if the trait is defined in another crate/module

error: aborting due to previous error

error: Could not compile `galvanic-mock`.
warning: build failed, waiting for other jobs to finish...
error: build failed

asomers avatar May 21 '18 19:05 asomers

Thanks for the info. This seems partly related to https://github.com/rust-lang/rust/pull/50820 for which there's currently no easy fix as the proc_macros generate modules to avoid name clashes. I'm currently working on a stable version of this crate, which gets rid of proc_macros. I doubt that I'll fix it before that, sorry.

mindsbackyard avatar May 29 '18 20:05 mindsbackyard