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

CE] "we never error on empty config files: Error { inner: ErrorInner { kind: Custom, line: None, col: 0, message: "missing field blacklisted-names", key: [] } }" #2560

Closed
Manishearth opened this issue Mar 20, 2018 · 8 comments
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@Manishearth
Copy link
Member

Moved from rust-lang/rust#49207

Happens when compiling diesel on nightly
https://travis-ci.org/diesel-rs/diesel/jobs/355827115#L499

Error comes from https://github.com/rust-lang-nursery/rust-clippy/blob/4edd140e57cce900fa930e1439bab469f5bbce46/clippy_lints/src/utils/conf.rs#L214-L219

@moore3071
Copy link

I played around with this for a couple of hours, but from what I saw, the problem might be a nonexistent yet specified conf file. Two steps back in the backtrace from the code snippet mentioned in the description, there's this line. Earlier in the same block we have these lines.

Looking around in Diesel, whenever Clippy is mentioned, a conf file is provided as seen here, but the files don't exist in the repo. Is this the same conf file that clippy_lint is looking for, or a more general Clippy conf file?

@sgrif
Copy link

sgrif commented Mar 26, 2018

The file does exist

@sgrif
Copy link

sgrif commented Mar 26, 2018

So there's two separate problems here. The first is the incorrect assumption that toml::from_str("") is now erroring. However, Diesel should have never been hitting that code path, as we specify a config file that exists. The root of that problem is due to the usage of env::current_dir() to resolve the path. The working directory for compilation with Cargo changed in the most recent version of Rust. The solution here is to use env::var("CARGO_MANIFEST_DIR") instead.

@sgrif
Copy link

sgrif commented Mar 26, 2018

Ref rust-lang/rust#47462 for confirmation that the working directory during compilation should not be relied on

@oli-obk
Copy link
Contributor

oli-obk commented Mar 29, 2018

I fixed the current dir usage. @killercup had ideas about the toml iirc

@ghost
Copy link

ghost commented Mar 30, 2018

I'm pretty sure it's because of the proc-macro2/nightly feature. Clone https://github.com/mikerite/clippy_issue_2560 and run cargo build to reproduce.

@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label Mar 30, 2018
@ghost
Copy link

ghost commented Apr 5, 2018

New versions of proc-macro2 have been released. Updating to 0.3.0 and above seems to fix the problem in my test repository.

@ghost
Copy link

ghost commented May 6, 2018

It looks like Diesel has been successfully upgraded to clippy 0.0.195 (diesel-rs/diesel#1674).
This issue should be closed IMO.

@phansch phansch closed this as completed May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

5 participants