Diesel: names from parent modules are not accessible without an explicit import

Created on 15 Jul 2018  Â·  16Comments  Â·  Source: diesel-rs/diesel

Setup

Versions

Feature Flags

  • diesel:

Problem Description

I got a lot of warns after rustup and cargo update, like follow:

warning: cannot find type `ThingDefine` in this scope
  --> src\data\thing\mod.rs:71:41
   |
71 | #[derive(Serialize, Deserialize, Debug, Queryable, Clone, PartialOrd, PartialEq)]
   |                                         ^^^^^^^^^ 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 <https://github.com/rust-lang/rust/issues/50504>

warning: cannot find type `NaiveDateTime` in this scope
  --> src\data\thing\mod.rs:71:41
   |
71 | #[derive(Serialize, Deserialize, Debug, Queryable, Clone, PartialOrd, PartialEq)]
   |                                         ^^^^^^^^^ names from parent modules are not accessible without an explicit import
   |
   = 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 <https://github.com/rust-lang/rust/issues/50504>

What are you trying to accomplish?

I try to add #[allow(proc_macro_derive_resolution_fallback)] on the structure used for query to disable the errors, but the warning exists yet.

What is the expected output?

I want to remove these warnings

Most helpful comment

Here is a good way to mute the warning on a per-file basis:

#![allow(proc_macro_derive_resolution_fallback)]

All 16 comments

Thanks, but we don't accept errors that are specific to nightly versions of Rust. There's an ongoing discussion about this and it's not clear what the final direction will be, Diesel will not be acting on it until it's clear what we actually will need to do for stable.

This broke semver's CI as well.

I had mistook this for a different issue, this one does look like one that we can address

Following the tutorial here I keep getting names from parent modules are not accessible without an explicit import for Queryable and Insertable too, but #[macro_use] extern crate diesel; is present in main.rs? Am I missing something? Did read the merge report and tried changing to extern crate diesel; but unsure if this is correct as I got a bunch of other errors?

@WillSquire This error is due to a change in the rust compiler. You can't fix it directly, as its a warning that diesel would break in the future. I think it's fixed on the repo, just not released yet.

@Deedasmi Ah ok, thanks. I'll ignore for now

@WillSquire you may want to mute that warning. No big deal, AFAICS.

Shows up also with latest Rust nightly (1.30.0 as I write)

Here is a good way to mute the warning on a per-file basis:

#![allow(proc_macro_derive_resolution_fallback)]

Now that 1.29 is out is there a plan to cut a release for this fix?

I'm also wondering when this is going to get released. Hit it just now as well.

The fix may be included in 1.4, which will be released in the next week or two -- But that's only assuming https://github.com/rust-lang/rust/issues/52545 is fixed. If our docs still fail to build, I'll be reverting the fix before releasing 1.4.

This is a warning, not an error -- and one that you can easily silence, so it's not something we're going to cut a release over.

I appreciate the update. We tend to have warnings as errors in our CI. I have this silenced for now but doing a blanket silence is problematic as it could mask other issues that crop up which is why I'd like resolution here.

Thanks again for the update and context.

You can silence specifically this error with #![allow(proc_macro_derive_resolution_fallback)]. Unless you're writing a ton of custom derives, it's unlikely you'll be getting new instances of this warning.

rust is so unstable. I must consider not to move my tech stack to it and I should postpone for at least a year or so..

I know this is a closed issue but I still get this warning after addding #[allow(proc_macro_derive_resolution_fallback)] in src/schema.rs and models.

Just ‘#[allow’ or ‘#![allow’? They do different things (this definition vs module level)

Also, I think this was also fixed on 1.4? Could be wrong.

Was this page helpful?
0 / 5 - 0 ratings