Skip to content

Gcc codegen backend fails to compile diesel #848

@weiznich

Description

@weiznich

To put this upfront: I'm well aware that the gcc backend is nowhere near to be production ready. I'm mostly filling this bug to let you know, not to get this fixed soon.

I tried this code:

git clone https://github.com/diesel-rs/diesel
cd diesel
git checkout 70d1fc8a519ed69d5783d98592fe8d4731b82aef
# without gcc codegen it works
cargo +nightly build -p diesel_cli --no-default-features -F sqlite-bundled
# with gcc codegen it fails
CARGO_PROFILE_DEV_CODEGEN_BACKEND=gcc cargo +nightly build -Zcodegen-backend -p diesel_cli --no-default-features -F sqlite-bundled

I expected to see this happen: Compilation succeeds

Instead, this happened: Compilation fails with the following error

error: unexpected token: `{`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected token: `=`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error: unexpected token: `.`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error: proc-macro derive produced unparsable tokens
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^

error[E0600]: cannot apply unary operator `!` to type `(bool, Option<Option<syn::Path>>)`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0600]: cannot apply unary operator `!` to type `(bool, Option<Flag>)`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0600]: cannot apply unary operator `!` to type `(bool, Option<Option<proc_macro2::Ident>>)`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0600]: cannot apply unary operator `!` to type `(bool, Option<Option<SpannedValue<String>>>)`
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ cannot apply unary operator `!`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> dsl_auto_type/src/auto_type/mod.rs:30:10
    |
 30 | #[derive(darling::FromMeta)]
    |          ^^^^^^^^^^^^^^^^^ argument rust-lang/rust#1 of type `&str` is missing
    |
note: associated function defined here
   --> /home/weiznich/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/darling_core-0.21.3/src/error/mod.rs:164:12
    |
164 |     pub fn unsupported_format(format: &str) -> Self {
    |            ^^^^^^^^^^^^^^^^^^
    = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |          |
   |          expected `(bool, Option<Option<Path>>)`, found `Option<Option<Path>>`
   |          expected due to this type
   |
   = note: expected tuple `(bool, Option<Option<syn::Path>>)`
               found enum `Option<Option<syn::Path>>`
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |          |
   |          expected `(bool, Option<Flag>)`, found `Option<Flag>`
   |          expected due to this type
   |
   = note: expected tuple `(bool, Option<Flag>)`
               found enum `Option<Flag>`
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |          |
   |          expected `(bool, Option<Option<Ident>>)`, found `Option<Option<Ident>>`
   |          expected due to this type
   |
   = note: expected tuple `(bool, Option<Option<proc_macro2::Ident>>)`
               found enum `Option<Option<proc_macro2::Ident>>`
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0308]: mismatched types
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^
   |          |
   |          expected `(bool, Option<Option<...>>)`, found `Option<Option<SpannedValue<String>>>`
   |          expected due to this type
   |
   = note: expected tuple `(bool, Option<Option<SpannedValue<String>>>)`
               found enum `Option<Option<SpannedValue<String>>>`
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `expect` found for tuple `(bool, Option<Option<syn::Path>>)` in the current scope
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ method not found in `(bool, Option<Option<syn::Path>>)`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `expect` found for tuple `(bool, Option<Flag>)` in the current scope
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ method not found in `(bool, Option<Flag>)`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `expect` found for tuple `(bool, Option<Option<proc_macro2::Ident>>)` in the current scope
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ method not found in `(bool, Option<Option<proc_macro2::Ident>>)`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0599]: no method named `expect` found for tuple `(bool, Option<Option<SpannedValue<String>>>)` in the current scope
  --> dsl_auto_type/src/auto_type/mod.rs:30:10
   |
30 | #[derive(darling::FromMeta)]
   |          ^^^^^^^^^^^^^^^^^ method not found in `(bool, Option<Option<SpannedValue<String>>>)`
   |
   = note: this error originates in the derive macro `darling::FromMeta` (in Nightly builds, run with -Z macro-backtrace for more info)

If that's helpful: dsl_auto_type is a local proc-macro crate

Meta

rustc --version --verbose:

rustc 1.95.0-nightly (474276961 2026-01-26)
binary: rustc
commit-hash: 474276961f48b0d05f4ea260ba400096b027584e
commit-date: 2026-01-26
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions