Asnim P Ansari
Asnim P Ansari

Reputation: 2487

Unable to compile Rust SQLx with postgres feature

If I try to use postgres feature of SQLx Rust as follows,

[dependencies]
sqlx = { version = "0.3.3", default-features=false , features=["runtime-async-std", "macros", "postgres", "all-type"] }

Then I get a compilation error as follows

   Compiling sqlx-core v0.3.4
error[E0658]: use of unstable library feature 'matches_macro'
  --> /Users/asnimpansari/.cargo/registry/src/github.com-1ecc6299db9ec823/sqlx-core-0.3.4/src/postgres/value.rs:78:12
   |
78 |         if matches!(self.data, Some(PgData::Binary(_))) {
   |            ^^^^^^^
   |
   = note: for more information, see https://github.com/rust-lang/rust/issues/65721

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
error: could not compile `sqlx-core`.

Instead, if I use mysql instead postgres the build succeeds.

➜  ~ rustc  -V
rustc 1.41.1 (f3e1a954d 2020-02-24)

Upvotes: 1

Views: 2916

Answers (1)

izik1
izik1

Reputation: 363

SQLx only supports the most recent version of Rust. As of April 14th 2020 that would be 1.42.0, which was released on March 9th.

This specific error is because the matches! macro was stabilized in 1.42

Upvotes: 3

Related Questions