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

Compilatin fails in Vim using neomake, but works from shell. #1142

Closed
dpc opened this Issue Sep 3, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@dpc

dpc commented Sep 3, 2017

Setup

Versions

  • Rust: rustc 1.22.0-nightly (f861b6ee4 2017-09-01)
  • Diesel: 0.16.0
  • Database: sqlite
  • Operating System: Fedora 26

Feature Flags

  • diesel: "postgres", "sqlite"
  • diesel_codegen: "postgres", "sqlite"

Problem Description

When I compile from command line, everything works, but when I start Vim, I get compilation errors:

main.rs|24 col 19 error 282| unresolved import `self::schema::reviews`: Could not find `reviews` in `schema`        
(...)

through neomake.

It looks to me that infer_schema macro fails silently (if I understand right, it is expanding by something that actually connects to the db to check the schema). However, when I do :!cargo build or :!cargo check compilation works, so it's not Vim itself.

If I am able to figure out anything more useful, I'll update the issue.

@killercup

This comment has been minimized.

Member

killercup commented Sep 4, 2017

I have no idea what neomake does internally, and I assume that this is very much dependent on that. Can you get it to show what cargo/rustc calls it does? Does it set the correct features and pass down the correct env vars?

I'd probably also open that as a bug with them as it seems like diesel works fine with the build process we support (i.e., using cargo directly) :)

@killercup

This comment has been minimized.

Member

killercup commented Sep 7, 2017

Any news here? I'm quite tempted to close this as I don't see anything we can do in diesel about that

@dpc

This comment has been minimized.

dpc commented Sep 7, 2017

I'm sorry. I was/am busy. I was wondering if this might have something to do with lack of attached tty or something. I'm fine with closing. Maybe someone will Google it, or I'll get more time to investigate localy.

@killercup killercup closed this Sep 7, 2017

@dpc

This comment has been minimized.

dpc commented Sep 25, 2017

I have found a reason. Basically, I'm using neomake and it will run cargo check in the src/, as opposed to root project directory. This usually works just fine. But here, in my src/schema.rs I have:

infer_schema!("dotenv:DATABASE_URL");

and my DATABASE_URL points to test.db, which is relative. It works fine when I'm in root directory, but in relative directory, it will just create an empty test.db and fail to infer anything.

Since cargo build does work when started in ./src I don't think this is a neomake problem.

It is a bit of a footgun, and it would be great if could be avoided somehow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment