-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Future proof us against upcoming changes to derives #1787
Conversation
Macro hygiene used to ignore module scope, which meant that we could reference a type from outside our wrapper module even if we didn't import it. That is changing in an upcoming version of Rust. Unfortunately, we can't just do either of the recommended solutions (either adding `use super::*` or changing to use a function instead of a module). `use super::*` doesn't work for types defined inside of a function, and changing ot use a function instead of a module broke our workaround to pretend we had `$crate` when we really didn't. With this change, an item named `diesel` must be present at the crate root. In the case of Diesel itself, this is just a module, but for all users they will now have to put `extern crate diesel` at the crate root. It's unlikely folks were renaming it, but we will no longer work if they do (the import was already located at the crate root, since you cant do `#[macro_use] extern crate` anywhere else). Fixes #1785.
Because we deny warnings, this is breaking our nightly build on CI (which does not fail CI overall). This will only become an issue once these changes migrate to the beta channel in a few weeks. This patch can be reverted as part of upgrading to Diesel 1.4 once that is released. See the [upstream PR] for more information. [upstream PR]: diesel-rs/diesel#1787
Because we deny warnings, this new lint will cause our CI to fail once it hits beta. Allowing `unknown_lints` is necessary because stable-1.28 isn't aware of this lint. This patch can be reverted as part of upgrading to Diesel 1.4 once that is released. See the [upstream PR] for more information. [upstream PR]: diesel-rs/diesel#1787
1469: Allow a new macro hygiene lint until we get Diesel 1.4 r=jtgeibel a=jtgeibel Because we deny warnings, this new lint will cause our CI to fail once it hits beta. Allowing `unknown_lints` is necessary because stable-1.28 isn't aware of this lint. This patch can be reverted as part of upgrading to Diesel 1.4 once that is released. See the [upstream PR] for more information. [upstream PR]: diesel-rs/diesel#1787 Co-authored-by: Justin Geibel <jtgeibel@gmail.com>
* removed some (useless?) output * also ran clippy, note there is a warning about: ``` warning: cannot find type `As` in this scope --> src/oracle/query_builder/alias.rs:17:24 | 17 | #[derive(Debug, Clone, QueryId)] | ^^^^^^^ names from parent modules are not accessible without an explicit import | = note: #[warn(proc_macro_derive_resolution_fallback)] on by default = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #50504 <rust-lang/rust#50504> ``` which seems to be fixed with diesel-rs/diesel#1787 which has not been released yet
So these warnings are now also triggered on stable Rust with 1.29.0, with the result that my little Diesel (1.3.3) project on stable Rust now generates pages and pages of warnings on every compile. Could this be backported to an 1.3.x release, or will be 1.4.0 be released soon? |
Does it already release? |
@sergeysova Unfortunately not because rustdoc does not build our documentation we cannot do a release currently. |
@weiznich is there any issue tracking this rustdoc problem? |
@weiznich that issue should be resolved in stable 1.30.1 ( |
@r-arias Yes, our ci is failing on windows only. Unfortunately I have no access to a windows machine, so no way for me to track down that issue. Hopefully someone other from @diesel-rs/core (or someone other) with access to a windows machine could help here. (That said: That error looks quite strange, because it's only happening on windows and the code that causes this according to rustc has no conditional thing based on the OS 😟. I also opened a issue on the rustc repo for this: rust-lang/rust#55832 ) |
Thanks for the response. Looks like only sqlite causes trouble? |
@r-arias Yes only sqlite causes problems. |
Could it be that sqlite is wrongly configured in the win environment? Just a guess, I am not familiar with how the test stage is set up... |
@r-arias That's not a configuration issue of the environment, because it does not fail at the linking stage, but while compiling the rust code. In detail while trying to resolve some traits. Those traits do not depend on any os specific impls and work on all other platforms. (That's probably a bug in rustc but without windows I'm not able to dig further into this.) |
Hmm, I thought maybe the schema is wrongly generated:
(here) |
That would be possible, but how? The same database url is used for the build.rs file to run the migrations, so I do not see how running the migrations would be ok, but running infer_schema on the same url would fail afterwards. |
Can't say, I'm just not familiar enough with this :/ |
Looks like it's building on azure, now? https://dev.azure.com/diesel-rs/diesel/_build/results?buildId=10 I can't look at appveyor, where it is still failing. |
Sorry for reviving this, but I thought with Rust 2018 Thanks a lot. |
@icefoxen For supporting the new macro import feature we need to change some internal macros. (The issue is basically that we call internally some macros from the exported ones. Because of the macro hygiene rules a user is not able to provide reference to those internal macros.) Till that is done continue to use |
Will do, thanks a lot! |
@weiznich Is there a tracking issue for proc macros? I'm unable to find any. |
With the "future proof for upcoming Rust hygiene" PR diesel-rs/diesel#1787 Diesel no longer supports renames in the crate root, so testing for that was breaking things unnecessarily.
Macro hygiene used to ignore module scope, which meant that we could
reference a type from outside our wrapper module even if we didn't
import it. That is changing in an upcoming version of Rust.
Unfortunately, we can't just do either of the recommended solutions
(either adding
use super::*
or changing to use a function instead of amodule).
use super::*
doesn't work for types defined inside of afunction, and changing ot use a function instead of a module broke our
workaround to pretend we had
$crate
when we really didn't.With this change, an item named
diesel
must be present at the crateroot. In the case of Diesel itself, this is just a module, but for all
users they will now have to put
extern crate diesel
at the crate root.It's unlikely folks were renaming it, but we will no longer work if they
do (the import was already located at the crate root, since you cant do
#[macro_use] extern crate
anywhere else).Fixes #1785.