I am very sorry, but I cannot seem to reproduce the bug easily.
Using the Diesel ORM and the diesel-derive-enum crate, I was able to make the compiler panic which was certainly unexpected to say the least, to fix the issue I did the sensible thing and ran cargo clean and redid the migrations (diesel migrations redo --all) to make sure the database was in a sane state, that seemed to fix the issue so I cannot get the backtrace. Something interesting to note was that before cleaning out the target directory and restoring the database, I tried compiling with the release profile for the first time and that worked, too.
CREATE TYPE access_level AS ENUM (
'a',
'b',
'c',
'd'
);
CREATE TABLE users (
id SERIAL PRIMARY KEY,
-- Other fields omitted...
access_level access_level NOT NULL
);
use diesel::prelude::*;
use crate::db::schema::users;
#[derive(Debug, diesel_derive_enum::DbEnum)]
#[ExistingTypePath = "crate::db::schema::sql_types::AccessLevel"]
pub enum AccessLevel {
A,
B,
C,
D,
}
#[derive(Debug, Queryable, Selectable, Identifiable)]
#[diesel(table_name = users)]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct User {
pub id: i32,
// Other fields omitted...
pub access_level: AccessLevel,
}
I am very sorry, but I cannot seem to reproduce the bug easily.
Using the Diesel ORM and the diesel-derive-enum crate, I was able to make the compiler panic which was certainly unexpected to say the least, to fix the issue I did the sensible thing and ran
cargo clean
and redid the migrations (diesel migrations redo --all
) to make sure the database was in a sane state, that seemed to fix the issue so I cannot get the backtrace. Something interesting to note was that before cleaning out thetarget
directory and restoring the database, I tried compiling with therelease
profile for the first time and that worked, too.Everything seemed to work before adding the diesel-derive-enum crate.
Code
Meta
rustc --version --verbose
:Error output
cargo build
Backtrace
```
```