Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upInsertable derive may error if used with other schema features #1032
Comments
This comment has been minimized.
|
This is the expected behavior. The module needs to be in scope. You generally shouldn't import stuff from |
sgrif
closed this
Jul 21, 2017
This comment has been minimized.
|
Is this documented explicitly in the dsl docs? (I'll check and add if not.)
The solution to this using UFCS in the code generated by the proc macro. It
may be a good idea to this regardless, but I'll need to think about that
some more :)
Sean Griffin <notifications@github.com> schrieb am Fr. 21. Juli 2017 um
13:28:
… This is the expected behavior. The module needs to be in scope. You
generally shouldn't import stuff from dsl outside of functions
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1032 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABOX_Sy_hod6PlE-MSO83Tkjuve0A9-ks5sQIt0gaJpZM4OfHtf>
.
|
This comment has been minimized.
skade
commented
Jul 21, 2017
•
|
The example is minimal, this also happens if the schema is in scope. This is documented nowhere and came up in an innocuous attempt to extend this (working) module by following your guides, by inserting NewCampaign. https://github.com/rust-community/rust-campaigns-server/blob/master/src/main.rs#L47-L112 It is at least surprising and the error message is terribly unhelpful. I find it confusing that diesel needs very tight hygienic control of the surrounding namespace or otherwise falls flat on its nose. |
This comment has been minimized.
|
I agree that we need to make this more clear in the documentation. I'm not sure how we can improve the error message other than a lint.
I don't see any way that we could work around this, unless we enforce the exact location of the table module from the crate root, which isn't something I want to do. |
skade commentedJul 21, 2017
•
edited
Setup
Versions
Feature Flags
Problem Description
When importing schema dsl methods in the same namespace as an
Insertablederive, the code doesn't compile.https://gist.github.com/skade/9f66885d041de7f8cf88ce3788696ae1
What are you trying to accomplish?
Nothing, it just occured to me.
What is the expected output?
What is the actual output?
See linked gist above
Are you seeing any additional errors?
No.
Steps to reproduce
Use the file linked in the gist as lib.rs with your standard example setup.
Checklist