fusion-engineering / inline-python

Inline Python code directly in your Rust code
https://docs.rs/inline-python
BSD 2-Clause "Simplified" License
1.15k stars 37 forks source link

`inline-python-macros` does not compile with certain nightly Rust versions #62

Closed m-ou-se closed 7 months ago

m-ou-se commented 1 year ago

The unstable Rust feature proc_macro_span that inline-python uses was changed, causing breakage. This is expected when using unstable Rust features. :)

inline-python-macros 0.11 only compiles with nightly-2023-06-27 or earlier.

inline-python-macros 0.12 only compiles with nightly-2023-06-28 or later.

gauteh commented 1 year ago

Hi,

I am currently getting an error:

error[E0463]: can't find crate for `inline_python_macros`
   --> /home/gauteh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inline-python-0.12.0/src/lib.rs:138:9
    |
138 | pub use inline_python_macros::python;
    |         ^^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `inline-python` (lib) due to previous error

with the latest three nightly versions (back to and including 2023-07-22). With 2023-06-28 I am getting a bunch of:

   Compiling inline-python-macros v0.12.0
error[E0599]: no method named `line` found for struct `proc_macro::Span` in the current scope
  --> /home/gauteh/.cargo/registry/src/index.crates.io-6f17d22bba15001f/inline-python-macros-0.12.0/src/embed_python.rs:57:35
   |
57 |             self.add_whitespace(span, span.line(), span.column())?;
   |                                            ^^^^ method not found in `Span`
m-ou-se commented 1 year ago

I can't seem to reproduce that issue. It works fine here with both the latest nightly and with 2023-07-22.

gauteh commented 1 year ago

Thank you for checking. Could it be some cargo bug? Or platform? I'm on linux unknown gnu 64 bit.

❯ cargo -V
cargo 1.73.0-nightly (7ac9416d8 2023-07-24)
gauteh commented 1 year ago

It does work for me as well on a different computer:

wince on  main via 🦀 v1.73.0-nightly
 10% ❯ cargo -V
cargo 1.73.0-nightly (1b1555676 2023-07-18)
wince on  main via 🦀 v1.73.0-nightly
 10% ❯ rustup toolchain list
stable-x86_64-unknown-linux-gnu
nightly-x86_64-unknown-linux-gnu (default)
wince on  main via 🦀 v1.73.0-nightly
❯ rustc -vV
rustc 1.73.0-nightly (1d56e3a6d 2023-07-22)
binary: rustc
commit-hash: 1d56e3a6d943062e41165bf07fea5ea8324ae011
commit-date: 2023-07-22
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5

also after running rustup update:

wince on  main via 🦀 v1.73.0-nightly via 🅒 sfy took 7s
❯ cargo -V
cargo 1.73.0-nightly (c91a693e7 2023-07-31)
wince on  main via 🦀 v1.73.0-nightly via 🅒 sfy
❯ rustc -vV
rustc 1.73.0-nightly (d12c6e947 2023-08-01)
binary: rustc
commit-hash: d12c6e947ceacf3b22c154caf9532b390d8dc88a
commit-date: 2023-08-01
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 16.0.5
keltia commented 7 months ago

Still happening now, see #65. rustc 1.78.0-nightly (bccb9bbb4 2024-02-16)