zotero / citeproc-rs

CSL processor in Rust.
https://cormacrelf.github.io/citeproc-wasm-demo/
Other
69 stars 12 forks source link

Rust 1.67 won't compile citeproc-rs (lifetime error) #154

Open jblachly opened 1 year ago

jblachly commented 1 year ago

Rust 1.66 compiles citeproc-rs just fine. (rustup run 1.66 cargo build)

Rust 1.67 (https://github.com/rust-lang/rust/blob/master/RELEASES.md) can't compile sub module io due to a lifetime error:

$ rustup run 1.67 cargo build
...
   Compiling citeproc-io v0.1.0 (/private/tmp/citeproc-rs/crates/io)
error: `QuoteSplitter<'_, impl Iterator<Item = (usize, char)> + '_>::events::{opaque#0}<'_>` does not live long enough
   --> crates/io/src/output/parse_quotes.rs:419:47
    |
419 |                 | MicroNode::Formatted(..) => EachSplitter::Index(Some(ix)),
    |                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: `QuoteSplitter<'_, impl Iterator<Item = (usize, char)> + '_>::events::{opaque#0}<'_>` does not live long enough
   --> crates/io/src/output/parse_quotes.rs:430:21
    |
430 | /                     EachSplitter::Splitter {
431 | |                         index: ix,
432 | |                         splitter,
433 | |                         seen_any: Some(false),
434 | |                     }
    | |_____________________^

error: could not compile `citeproc-io` due to 2 previous errors
jblachly commented 1 year ago

Discussion question posted here: https://users.rust-lang.org/t/rust-1-67-lifetime-error-compiles-with-1-66-what-changed/88483

Likely offending rustc change is here: https://github.com/rust-lang/rust/pull/95474/ although this supposedly was merged into 1.66, but compiling doesn't break until 1.67

cormacrelf commented 1 year ago

Thanks for reporting. This is a one-liner fix, fortunately. Discussion in those threads will go on since it should have been caught by 1.66, but that's rustc's problem.