0

I am a newbie with Rust programming and I am building Rust + Diesel + Rocket framework.

When I run the command cargo check or cargo run, the following error occurs:

The specified procedure could not be found. (os error 127)
--> src\main.rs:2:11
|
2 | #![plugin(rocket_codegen)]

OS: Windows 10

cargo.toml

[package]
name = "rest_in_rust"
version = "0.1.0"
authors = ["venka"]

[dependencies]
diesel = { version = "1.0.0", features = ["postgres"]}
dotenv = "0.9.0"
r2d2 = "0.8.3"
serde = "1.0.80"
serde_derive = "1.0.80"
serde_json = "1.0.33"

rocket = {  git = "https://github.com/SergioBenitez/Rocket" }
rocket_codegen = {  git = "https://github.com/SergioBenitez/Rocket" }
rocket_contrib = {  git = "https://github.com/SergioBenitez/Rocket", default-features = false, features = ["json"] }

Rust Version: rustc 1.32.0-nightly (0c999ed13 2018-12-03)

main.rs file (the 2nd line throws me this error) any clue?

 #![feature(plugin, custom_derive, const_fn, decl_macro)]
 #![plugin(rocket_codegen)]

 #[macro_use]
 extern crate diesel;
 extern crate dotenv;
 extern crate r2d2;
 extern crate rocket;
 extern crate rocket_contrib;
 #[macro_use]
 extern crate serde_derive;
 #[macro_use]
 extern crate serde_json;

 use dotenv::dotenv;
 use std::env;
 use diesel::prelude::*;
 use diesel::pg::PgConnection;

 mod schema;
 mod models;
 mod db;
 mod static_file;
CdVr
  • 323
  • 3
  • 15
  • Please review how to create a [MCVE] and then [edit] your question to include it. We cannot tell what modules, etc. are present in the code (such as `schema`) If these aren't required to reproduce the problem, *remove them*; if they are required, provide them, minimized as much as possible. Try to produce something that reproduces your error in a brand new Cargo project with the **minimal** amount of code needed. There are [Rust-specific MCVE tips](//stackoverflow.com/tags/rust/info) as well. – Shepmaster Dec 09 '18 at 16:48

1 Answers1

2

My Cargo.toml has

rocket = { git = "https://github.com/SergioBenitez/Rocket" }
rocket_codegen = { git = "https://github.com/SergioBenitez/Rocket" }

which will pull the latest version. For me, it fetched Rocket 0.4.0. Since Rocket 0.4, rocket_codegen should not be a direct dependency.

Simply remove it:

Cargo.toml

[dependencies]
rocket = "0.4"

main.rs

#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use] extern crate rocket;

Please check the change log in the news section of the Rocket Documentation.

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
CdVr
  • 323
  • 3
  • 15