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 fails in Rust 1.48.0 nightly #209

Closed
ekexium opened this issue Sep 8, 2020 · 5 comments
Closed

Build fails in Rust 1.48.0 nightly #209

ekexium opened this issue Sep 8, 2020 · 5 comments

Comments

@ekexium
Copy link

ekexium commented Sep 8, 2020

Build succeeds for rust 1.46.0 stable, but failed for Rust 1.48.0 nightly.
I'm using proptest 0.10.1 and proptest-derive 0.2.0.

Example:

use proptest::{arbitrary::any_with, collection::size_range};
use proptest_derive::Arbitrary;
#[derive(Arbitrary)]
pub struct Key(
    #[proptest(strategy = "any_with::<Vec<u8>>((size_range(1024), ()))")]
    pub Vec<u8>,
);

Build error:

❯ cargo build
   Compiling play v0.1.0 (/Users/ekexium/code/play)
error: [proptest_derive, E0026] during #[derive(Arbitrary)]:
The attribute modifier `strategy` inside `#[proptest(..)]` must have the format `#[proptest(strategy = "<expr>")]` where `<expr>` is a valid Rust expression. Please see: https://PATH/TO/foo#E0026 for more information.
 --> src/lib.rs:3:17
  |
3 | #[derive(Debug, Arbitrary)]
  |                 ^^^^^^^^^
  |
  = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

warning: unused imports: `arbitrary::any_with`, `collection::size_range`
 --> src/lib.rs:1:16
  |
1 | use proptest::{arbitrary::any_with, collection::size_range};
  |                ^^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error: aborting due to previous error; 1 warning emitted

error: could not compile `play`.

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

Don't know if it's a bug. Do you have any idea?

@Centril
Copy link
Collaborator

Centril commented Sep 8, 2020

Can you please paste the build error?

@ekexium
Copy link
Author

ekexium commented Sep 8, 2020

Can you please paste the build error?

Sorry I put the wrong content in build errors. It's Updated.

@Centril
Copy link
Collaborator

Centril commented Sep 8, 2020

Odd. This error arises when proptest_derive gets a malformed expression, according to syn.

The token stream any_with::<Vec<u8>>((size_range(1024), ())) is however definitely a well-formed Rust expression syntactically, unless there are issues in rustc's pretty printing or so. Could you test whether rustc handles this right? The syn dependency shouldn't have been changed since we aren't using 1.0+ yet and 0.15.*. shouldn't have been changed.

@Centril
Copy link
Collaborator

Centril commented Sep 8, 2020

Maybe caused by rust-lang/rust#76399.

@ekexium
Copy link
Author

ekexium commented Sep 11, 2020

Latest nightly doesn't have this problem

@ekexium ekexium closed this as completed Sep 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants