Skip to content

Compilation error for dynamic keys #17

Description

@XX

When using keys as owned strings instead of &'static str:

slog = { version = "2.5.1", features = ["dynamic-keys"] }

this crate is not compiled:

Checking slog-kvfilter v0.7.0
error[E0277]: the trait bound `&str: std::borrow::Borrow<slog::Key>` is not satisfied
  --> /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-kvfilter-0.7.0/src/lib.rs:38:69
   |
38 |         let matched = if let Some(keyvalues) = self.pending_matches.get(&key) {
   |                                                                     ^^^ the trait `std::borrow::Borrow<slog::Key>` is not implemented for `&str`

error[E0277]: the trait bound `slog::Key: std::cmp::Eq` is not satisfied
  --> /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-kvfilter-0.7.0/src/lib.rs:38:69
   |
38 |         let matched = if let Some(keyvalues) = self.pending_matches.get(&key) {
   |                                                                     ^^^ the trait `std::cmp::Eq` is not implemented for `slog::Key`

error[E0277]: the trait bound `&'a str: std::borrow::Borrow<slog::Key>` is not satisfied
  --> /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-kvfilter-0.7.0/src/lib.rs:48:34
   |
48 |             self.pending_matches.remove(&key);
   |                                  ^^^^^^ the trait `std::borrow::Borrow<slog::Key>` is not implemented for `&'a str`

error[E0277]: the trait bound `slog::Key: std::cmp::Eq` is not satisfied
  --> /home/xx/.cargo/registry/src/github.com-1ecc6299db9ec823/slog-kvfilter-0.7.0/src/lib.rs:48:34
   |
48 |             self.pending_matches.remove(&key);
   |                                  ^^^^^^ the trait `std::cmp::Eq` is not implemented for `slog::Key`

error: aborting due to 4 previous errors

For more information about this error, try `rustc --explain E0277`.
error: Could not compile `slog-kvfilter`.

Activity

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

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