flux-lsp icon indicating copy to clipboard operation
flux-lsp copied to clipboard

Cargo install fails

Open nathanielc opened this issue 2 years ago • 3 comments

I can cargo build the flux-lsp binary but I cannot cargo install the binary. It seems to be releated to enabling the lsp feature flag on the flux dependency.

See the following terminal output:

$ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.12s
$ cargo install --path .
  Installing flux-lsp v0.8.20 (/flux-lsp)
    Updating crates.io index
    Updating git repository `https://github.com/influxdata/flux`
   Compiling flux-lsp v0.8.20 (/flux-lsp)
error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/server/mod.rs:40:35
   |
40 |         range: node.loc().clone().into(),
   |                                   ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/server/mod.rs:294:47
    |
294 |                     range: e.location.clone().into(),
    |                                               ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/ast.rs:29:43
   |
29 |             &node.base().location.clone().into(),
   |                                           ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Position: From<flux::ast::Position>` is not satisfied
  --> src/visitors/ast.rs:57:47
   |
57 |             position: pkg.base.location.start.into(),
   |                                               ^^^^ the trait `From<flux::ast::Position>` is not implemented for `lspower::lsp_types::Position`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Position>` for `flux::ast::Position`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/lint.rs:57:57
   |
57 | ...                   range: expr.loc.clone().into(),
   |                                               ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/lint.rs:68:61
   |
68 | ...                   range: expr.loc.clone().into(),
   |                                               ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/lint.rs:131:57
    |
131 | ...                   range: expr.loc.clone().into(),
    |                                               ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/lint.rs:142:61
    |
142 | ...                   range: expr.loc.clone().into(),
    |                                               ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/lint.rs:180:50
    |
180 |                     range: assign.id.loc.clone().into(),
    |                                                  ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:20:43
   |
20 |                 range: node.loc().clone().into(),
   |                                           ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:33:46
   |
33 |                     range: param.loc.clone().into(),
   |                                              ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:46:43
   |
46 |                 range: node.loc().clone().into(),
   |                                           ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:69:38
   |
69 |                 range: c.loc.clone().into(),
   |                                      ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:84:44
   |
84 |                     range: arg.loc.clone().into(),
   |                                            ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/symbols.rs:96:44
   |
96 |                     range: arg.loc.clone().into(),
   |                                            ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:120:34
    |
120 |                 range: ident.loc.into(),
    |                                  ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:134:34
    |
134 |                 range: ident.loc.into(),
    |                                  ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:202:51
    |
202 | ...                   range: me.loc.clone().into(),
    |                                             ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:216:48
    |
216 |                         range: num.loc.clone().into(),
    |                                                ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:230:48
    |
230 |                         range: num.loc.clone().into(),
    |                                                ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:244:46
    |
244 |                         range: d.loc.clone().into(),
    |                                              ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:258:46
    |
258 |                         range: b.loc.clone().into(),
    |                                              ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:272:46
    |
272 |                         range: s.loc.clone().into(),
    |                                              ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/symbols.rs:286:46
    |
286 |                         range: a.loc.clone().into(),
    |                                              ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
  --> src/visitors/semantic/mod.rs:29:48
   |
29 |     let range: lsp::Range = node.loc().clone().into();
   |                                                ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
   |
   = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
   --> src/visitors/semantic/mod.rs:227:48
    |
227 |             self.location = Some(n.loc.clone().into());
    |                                                ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
    |
    = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

error[E0277]: the trait bound `lspower::lsp_types::Range: From<flux::ast::SourceLocation>` is not satisfied
    --> src/server/mod.rs:1053:45
     |
1053 |                     &error.location.clone().into(),
     |                                             ^^^^ the trait `From<flux::ast::SourceLocation>` is not implemented for `lspower::lsp_types::Range`
     |
     = note: required because of the requirements on the impl of `Into<lspower::lsp_types::Range>` for `flux::ast::SourceLocation`

For more information about this error, try `rustc --explain E0277`.
error: failed to compile `flux-lsp v0.8.20 (/flux-lsp)`, intermediate artifacts can be found at `/flux-lsp/target`

Caused by:
  could not compile `flux-lsp` due to 27 previous errors

nathanielc avatar Jul 05 '22 16:07 nathanielc

TIL: cargo install ignores the lock file by default. If you do cargo install --locked, that will work (I just verified). Will chase this a bit more later.

rockstar avatar Jul 05 '22 16:07 rockstar

See also rust-lang/cargo#7169

rockstar avatar Jul 05 '22 19:07 rockstar

Ran into this today :angry: More specifically, this is because we have a version range in flux-core which causes cargo to select 0.92 for itself while lspower is still on 0.91. So the version range doesn't seem to work as one would hope. Created https://github.com/influxdata/flux/pull/5067

lsp-types = { version = ">=0.91,<=0.92", optional = true }

(cargo issue https://github.com/rust-lang/cargo/issues/9029 )

Marwes avatar Aug 10 '22 14:08 Marwes