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

Remove "full" feature from syn #38

Merged
merged 1 commit into from
Aug 9, 2019
Merged

Remove "full" feature from syn #38

merged 1 commit into from
Aug 9, 2019

Conversation

Pratyush
Copy link
Contributor

@Pratyush Pratyush commented Aug 8, 2019

It seems that the library might not need to use the full feature of syn. This PR removes it to potentially help improve compile times for end users. If I'm missing something please let me know =).

@mcarton mcarton merged commit fbbd067 into mcarton:master Aug 9, 2019
@mcarton
Copy link
Owner

mcarton commented Aug 9, 2019

Thanks!

@Pratyush Pratyush deleted the remove-syn-feature branch August 10, 2019 05:00
@kankri
Copy link
Contributor

kankri commented Aug 21, 2019

This seems to have broken #derivative(Default(value="expr")) where the expression is a tuple, struct, list, method call, etc.... For example, this compiles OK with commit 1fd45f3 but fails after the change in this PR:

pub struct Bar { x: u32, y: u32 }

#[derive(Derivative)]
#[derivative(Default)]
pub struct Foo {
	#[derivative(Default(value="Bar {x:42, y:42}"))]
	a: Bar,
	#[derivative(Default(value="[42;2]"))]
	b: [u32; 2],
}

Using commit fbbd067 you get either

error: proc-macro derive panicked
help: message: unexpected token

or

error: proc-macro derive panicked
help: message: unsupported expression; enable syn's features=["full"]

@dtolnay
Copy link
Contributor

dtolnay commented Aug 21, 2019

Looks like

out.default.value = Some(try!(parse_str(&value)));
should be parsing to a TokenStream rather than Expr.

kankri added a commit to kankri/rust-derivative that referenced this pull request Aug 23, 2019
PR mcarton#38 made Default expressions with e.g. list values fail and there
weren't any tests for them.
kankri pushed a commit to kankri/rust-derivative that referenced this pull request Aug 23, 2019
kankri added a commit to kankri/rust-derivative that referenced this pull request Aug 23, 2019
PR mcarton#38 made Default expressions with e.g. list values fail and there
weren't any tests for them.
kankri added a commit to kankri/rust-derivative that referenced this pull request Aug 23, 2019
PR mcarton#38 made Default expressions with e.g. list values fail and there
weren't any tests for them.
@mcarton
Copy link
Owner

mcarton commented Aug 28, 2019

Looks like

out.default.value = Some(try!(parse_str(&value)));

should be parsing to a TokenStream rather than Expr.

That did the trick, thanks!

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

Successfully merging this pull request may close these issues.

4 participants