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

Extend clone macro #534

Merged
merged 8 commits into from Nov 16, 2019
Merged

Extend clone macro #534

merged 8 commits into from Nov 16, 2019

Conversation

@GuillaumeGomez
Copy link
Member

GuillaumeGomez commented Nov 14, 2019

Fixes #532.
Fixes #533.

cc @sdroege @EPashkin @antoyo

@antoyo
antoyo approved these changes Nov 14, 2019
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 15, 2019

You might also want to add another branch to the macro after the $variable:ident case for $variable:expr, which then maps to compile_error! for giving a better error message for things like x.y as variable.

Did you test that all the other parts are working? The syntax looks fine to me in any case. Maybe we can add some tests for this (and fix the existing tests)? :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 15, 2019

cargo test is running fine on my computer?

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 15, 2019

Oh you meant the examples maybe? Well, the PR is already open, just not up to date.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 15, 2019

I also added a check for the keyword (better than having a macro error. :) )

@EPashkin EPashkin mentioned this pull request Nov 15, 2019
src/clone.rs Outdated Show resolved Hide resolved
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 16, 2019

@GuillaumeGomez Improved the error handling a bit and also fixed a bug. This should be good to go I guess :)

let $variable = $variable.clone();
);
(@weak $variable:ident) => (
let $variable = $crate::clone::Downgrade::downgrade(&$variable);
);
(@ $keyword:ident $variable:ident) => (
compile_error!("Unknown keyword, only `weak` and `strong` are allowed");

This comment has been minimized.

Copy link
@GuillaumeGomez

GuillaumeGomez Nov 16, 2019

Author Member

The stringify!(keyword) wasn't working?

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 16, 2019

@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 16, 2019

Na, not worth it. Looks good to me now. Once merged, I'll update my examples PR.

@sdroege sdroege merged commit 37afcec into gtk-rs:master Nov 16, 2019
0 of 2 checks passed
0 of 2 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 16, 2019

Merged, please fix the examples then :) Thanks!

@GuillaumeGomez GuillaumeGomez deleted the GuillaumeGomez:extend-clone-macro branch Nov 16, 2019
@GuillaumeGomez

This comment has been minimized.

Copy link
Member Author

GuillaumeGomez commented Nov 16, 2019

Will do before the end of the day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.