no function or associated item named pool
found for struct ConnectionPool
in the current scope
#2522
-
I'm setting up a new Rocket project, mostly copy-pasting from and old one, and I keep getting this error when I'm trying to add my Database fairing.
I'm pretty sure this is not a bug and I just messed up something trivial, because I have this exact setup with Diesel and Postgresql in my other project and it's working fine there. Either way, the error message is really not helpful, so I'm pretty stuck. database.rs: use diesel::prelude::*;
use diesel::PgConnection;
use rocket_sync_db_pools::database;
pub type Conn = PgConnection;
#[database("property_db")]
pub struct Db(Conn); main.rs: #[macro_use]
extern crate rocket;
#[macro_use]
extern crate diesel;
mod database;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
#[launch]
fn rocket() -> _ {
rocket::build()
.attach(database::Db::fairing())
.mount("/", routes![index])
} Rocket.toml: [global.databases.property_db]
url = "postgresql://...localhost:5432/...." Cargo.toml: [dependencies]
diesel = { version = "1.4", default-features = false, features = ["postgres", "chrono", "64-column-tables", "serde_json"] }
diesel_migrations = "1.4.0"
rocket = { version = "=0.5.0-rc.2", features = ["json"] }
rocket_sync_db_pools = { version = "0.1.0-rc.2", features = ["diesel_postgres_pool"] } Any ideas? What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
That was exactly it, just a missing "=" damn 👍 My other project was working because I did not call |
Beta Was this translation helpful? Give feedback.
diesel
was updated to version 2 in rc3, which is what you're probably pulling in since you didn't use an=
before the rocket_sync_db_pools version. You can either move all deps to RC3 and diesel 2 or use an=
before the rocket_sync_db_pools version number in your Cargo.toml.