udoprog / genco

A whitespace-aware quasiquoter for beautiful code generation.
Apache License 2.0
181 stars 11 forks source link

Fix build error "field, not a method" for line and column #47

Closed ClementWalter closed 6 months ago

ClementWalter commented 10 months ago

Fix build

Current behavior

Not sure how the CI could pass otherwise, just pulling the repo and running cargo build raises this error

$ cargo build --locked
   Compiling genco-macros v0.17.6 (/Users/clementwalter/Documents/genco/genco-macros)
error[E0599]: no method named `line` found for struct `proc_macro::LineColumn` in the current scope
  --> genco-macros/src/fake.rs:26:24
   |
26 |             line: span.line(),
   |                        ^^^^-- help: remove the arguments
   |                        |
   |                        field, not a method

error[E0599]: no method named `column` found for struct `proc_macro::LineColumn` in the current scope
  --> genco-macros/src/fake.rs:27:26
   |
27 |             column: span.column(),
   |                          ^^^^^^-- help: remove the arguments
   |                          |
   |                          field, not a method

error[E0599]: no method named `line` found for struct `proc_macro::LineColumn` in the current scope
  --> genco-macros/src/fake.rs:36:24
   |
36 |             line: span.line(),
   |                        ^^^^-- help: remove the arguments
   |                        |
   |                        field, not a method

error[E0599]: no method named `column` found for struct `proc_macro::LineColumn` in the current scope
  --> genco-macros/src/fake.rs:37:26
   |
37 |             column: span.column(),
   |                          ^^^^^^-- help: remove the arguments
   |                          |
   |                          field, not a method

For more information about this error, try `rustc --explain E0599`.
error: could not compile `genco-macros` (lib) due to 4 previous errors

I have actually face this when compiling a repo depending on genco.

udoprog commented 10 months ago

You seem to be using an older nightly.

Since I want to support the most recent version this would have to rely on version detection instead for me to merge.

See build.rs, you could possible extend it to support older nightly versions (with a different cfg). But primarily I'd suggest you try and update nightly.

udoprog commented 6 months ago

This should be fixed.