Skip to content

Build fail with redis feature #71

@folliehiyuki

Description

@folliehiyuki

Hi. I'm getting errors while trying to build flowgger with --all-features (rust 1.62.0) as pointed out in https://gitlab.alpinelinux.org/alpine/aports/-/issues/13952#note_243393.

Changing the declaration to let mut ... (like the log suggests) makes the build pass but I honestly don't know whether things will break. This seems to be happen after redis-rs 0.11.0-beta1 release (ref: https://github.com/redis-rs/redis-rs/blob/main/CHANGELOG.md#0110-beta1---2019-05-30)

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:52:18
   |
52 |     decoder: Box<Decoder>,
   |                  ^^^^^^^
   |
   = note: `#[warn(bare_trait_objects)]` on by default
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
52 -     decoder: Box<Decoder>,
52 +     decoder: Box<dyn Decoder>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:53:18
   |
53 |     encoder: Box<Encoder>,
   |                  ^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
53 -     encoder: Box<Encoder>,
53 +     encoder: Box<dyn Encoder>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:29:22
   |
29 |         decoder: Box<Decoder + Send>,
   |                      ^^^^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
29 -         decoder: Box<Decoder + Send>,
29 +         decoder: Box<dyn Decoder + Send>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:30:22
   |
30 |         encoder: Box<Encoder + Send>,
   |                      ^^^^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
30 -         encoder: Box<Encoder + Send>,
30 +         encoder: Box<dyn Encoder + Send>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:52:18
   |
52 |     decoder: Box<Decoder>,
   |                  ^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
52 -     decoder: Box<Decoder>,
52 +     decoder: Box<dyn Decoder>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:53:18
   |
53 |     encoder: Box<Encoder>,
   |                  ^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
53 -     encoder: Box<Encoder>,
53 +     encoder: Box<dyn Encoder>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:29:22
   |
29 |         decoder: Box<Decoder + Send>,
   |                      ^^^^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
29 -         decoder: Box<Decoder + Send>,
29 +         decoder: Box<dyn Decoder + Send>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:30:22
   |
30 |         encoder: Box<Encoder + Send>,
   |                      ^^^^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
30 -         encoder: Box<Encoder + Send>,
30 +         encoder: Box<dyn Encoder + Send>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:61:51
   |
61 |         "capnp" => Box::new(CapnpSplitter) as Box<Splitter<_>>,
   |                                                   ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
61 -         "capnp" => Box::new(CapnpSplitter) as Box<Splitter<_>>,
61 +         "capnp" => Box::new(CapnpSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:62:49
   |
62 |         "line" => Box::new(LineSplitter) as Box<Splitter<_>>,
   |                                                 ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
62 -         "line" => Box::new(LineSplitter) as Box<Splitter<_>>,
62 +         "line" => Box::new(LineSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:63:53
   |
63 |         "syslen" => Box::new(SyslenSplitter) as Box<Splitter<_>>,
   |                                                     ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
63 -         "syslen" => Box::new(SyslenSplitter) as Box<Splitter<_>>,
63 +         "syslen" => Box::new(SyslenSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tcp/tcpco_input.rs:64:47
   |
64 |         "nul" => Box::new(NulSplitter) as Box<Splitter<_>>,
   |                                               ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
64 -         "nul" => Box::new(NulSplitter) as Box<Splitter<_>>,
64 +         "nul" => Box::new(NulSplitter) as Box<dyn Splitter<_>>,
   | 

warning: use of deprecated associated function `may::Config::set_io_workers`: use `set_workers` only
  --> src/flowgger/input/tls/tlsco_input.rs:33:23
   |
33 |         may::config().set_io_workers(tls_config.threads);
   |                       ^^^^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:68:51
   |
68 |         "capnp" => Box::new(CapnpSplitter) as Box<Splitter<_>>,
   |                                                   ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
68 -         "capnp" => Box::new(CapnpSplitter) as Box<Splitter<_>>,
68 +         "capnp" => Box::new(CapnpSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:69:49
   |
69 |         "line" => Box::new(LineSplitter) as Box<Splitter<_>>,
   |                                                 ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
69 -         "line" => Box::new(LineSplitter) as Box<Splitter<_>>,
69 +         "line" => Box::new(LineSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:70:53
   |
70 |         "syslen" => Box::new(SyslenSplitter) as Box<Splitter<_>>,
   |                                                     ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
70 -         "syslen" => Box::new(SyslenSplitter) as Box<Splitter<_>>,
70 +         "syslen" => Box::new(SyslenSplitter) as Box<dyn Splitter<_>>,
   | 

warning: trait objects without an explicit `dyn` are deprecated
  --> src/flowgger/input/tls/tlsco_input.rs:71:47
   |
71 |         "nul" => Box::new(NulSplitter) as Box<Splitter<_>>,
   |                                               ^^^^^^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: use `dyn`
   |
71 -         "nul" => Box::new(NulSplitter) as Box<Splitter<_>>,
71 +         "nul" => Box::new(NulSplitter) as Box<dyn Splitter<_>>,
   | 

error[E0596]: cannot borrow `redis_cnx` as mutable, as it is not declared as mutable
   --> src/flowgger/input/redis_input.rs:105:46
    |
99  |         let redis_cnx = self.redis_cnx;
    |             --------- help: consider changing this to be mutable: `mut redis_cnx`
...
105 |             let dummy: RedisResult<String> = redis_cnx.rpoplpush(queue_key_tmp, queue_key);
    |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `redis_cnx` as mutable, as it is not declared as mutable
   --> src/flowgger/input/redis_input.rs:110:38
    |
99  |         let redis_cnx = self.redis_cnx;
    |             --------- help: consider changing this to be mutable: `mut redis_cnx`
...
110 |             let line: String = match redis_cnx.brpoplpush(queue_key, queue_key_tmp, 0) {
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `redis_cnx` as mutable, as it is not declared as mutable
   --> src/flowgger/input/redis_input.rs:117:40
    |
99  |         let redis_cnx = self.redis_cnx;
    |             --------- help: consider changing this to be mutable: `mut redis_cnx`
...
117 |             let res: RedisResult<u8> = redis_cnx.lrem(queue_key_tmp as &str, 1, line as String);
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable

For more information about this error, try `rustc --explain E0596`.
warning: `flowgger` (lib) generated 17 warnings
error: could not compile `flowgger` due to 3 previous errors; 17 warnings emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions