Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sea_orm::DeriveActiveEnum now requires some modules and types are imported since v0.10.0 #1143

Closed
siketyan opened this issue Oct 24, 2022 · 2 comments · Fixed by #1154
Closed
Assignees

Comments

@siketyan
Copy link
Contributor

siketyan commented Oct 24, 2022

Description

Since v0.10.0, deriving DeriveActiveEnum now requires these modules and types are imported outer the derive:

  • sea_orm::sea_query
  • sea_orm::ActiveEnum
  • sea_orm::EnumIter
  • sea_orm::Iden

Steps to Reproduce

#[derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum)]
#[sea_orm(rs_type = "String", db_type = "String(Some(32))")]
pub enum Color {
    // omitted
}

Expected Behavior

Built successfully.

Actual Behavior

Errors are occurred.

error: cannot find derive macro `Iden` in this scope
  --> [redacted].rs:22:31
   |
22 |     derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: consider importing this derive macro:
           sea_orm::Iden
   = note: this error originates in the derive macro `sea_orm::DeriveActiveEnum` (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find attribute iden in this scope
--> [redacted].rs:22:31
|
22 | derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro sea_orm::DeriveActiveEnum (in Nightly builds, run with -Z macro-backtrace for more info)

error: cannot find derive macro EnumIter in this scope
--> [redacted].rs:22:31
|
22 | derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: consider importing this derive macro:
sea_orm::EnumIter
= note: this error originates in the derive macro sea_orm::DeriveActiveEnum (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound [redacted]Variant: sea_orm::Iterable is not satisfied
--> [redacted].rs:22:31
|
22 | derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait sea_orm::Iterable is not implemented for [redacted]Variant
|
= help: the following other types implement trait sea_orm::Iterable:
domain::[redacted]
models::[redacted]::Column
models::[redacted]::PrimaryKey
models::[redacted]::Relation
= note: this error originates in the derive macro sea_orm::DeriveActiveEnum (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound [redacted]Enum: sea_orm::Iden is not satisfied
--> [redacted].rs:22:31
|
22 | derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait sea_orm::Iden is not implemented for [redacted]Enum
|
= help: the following other types implement trait sea_orm::Iden:
models::[redacted]::Column
models::[redacted]::Entity
models::[redacted]::PrimaryKey
sea_orm::Identity
sea_orm::SelectA
sea_orm::SelectB
sea_orm::sea_query::Alias
sea_orm::sea_query::NullAlias
and 4 others
= note: required for the cast from [redacted]Enum to the object type dyn sea_orm::Iden
= note: this error originates in the derive macro sea_orm::DeriveActiveEnum (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named to_value found for reference &[redacted] in the current scope
--> [redacted].rs:22:31
|
22 | derive(sea_orm::EnumIter, sea_orm::DeriveActiveEnum),
| ^^^^^^^^^^^^^^^^^^^^^^^^^ method not found in &[redacted]
|
= help: items from traits can only be used if the trait is in scope
= note: this error originates in the derive macro sea_orm::DeriveActiveEnum (in Nightly builds, run with -Z macro-backtrace for more info)
help: the following trait is implemented but not in scope; perhaps add a use for it:
|
1 | use sea_orm::ActiveEnum;
|

error: aborting due to 6 previous errors

Some errors have detailed explanations: E0277, E0599.
For more information about an error, try rustc --explain E0277.
error: could not compile [redacted] due to 7 previous errors

With the import statement below, build succeeds:

use sea_orm::{sea_query, ActiveEnum, EnumIter, Iden};

Reproduces How Often

Always

Versions

Since v0.10.0

Additional Information

Our Cargo.toml includes:

sea-orm = { version = "0.10", features = ["sqlx-postgres", "runtime-tokio-rustls", "macros"] }
@UkonnRa
Copy link

UkonnRa commented Oct 24, 2022

Same error on 0.10

@billy1624
Copy link
Member

Hey @siketyan, thanks again for the help!! Please check this PR for the fix.

A new patch will be released shortly :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants