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

Failed to parse compiler message #132

Closed
alopatindev opened this issue Oct 14, 2020 · 1 comment
Closed

Failed to parse compiler message #132

alopatindev opened this issue Oct 14, 2020 · 1 comment

Comments

@alopatindev
Copy link
Contributor

$ rustc --version
rustc 1.46.0 (04488afe3 2020-08-24)

$ cargo new parsing-bug && echo 'fn main() {format_xml::xml! {<A><A><A><A></A></A><A></A><A><A><A>true</A></A></A><A><A><A>0</A></A><A><A><A>{a}</A></A></A><A><A>"A"</A>if let Some(a)=(a){<A>{a}</A>}</A></A></A></A>};}' > parsing-bug/src/main.rs && cd parsing-bug && echo 'format_xml = "0.1.5"' >> Cargo.toml && cargo build --message-format=json-diagnostic-rendered-ansi > out.txt
     Created binary (application) `parsing-bug` package
    Updating crates.io index
   Compiling format_xml v0.1.5
   Compiling parsing-bug v0.1.0 (/home/al/tmp/parsing-bug)
error: could not compile `parsing-bug`.

To learn more, run the command again with --verbose.
fn main() {
    let s = include_str!("../../parsing-bug/out.txt");
    for message in cargo_metadata::Message::parse_stream(s.as_bytes()) {
        match message.unwrap() {
            cargo_metadata::Message::TextLine(_) => panic!("failed to parse"),
            _ => (),
        }
    }
}
@alopatindev
Copy link
Contributor Author

Actually caused by serde_json

fn main() {
    let s = include_str!("../../parsing-bug/out.txt");
    for i in s.lines() {
        if let Err(e) = serde_json::from_str::<serde_json::Value>(&i) {
            println!("{}", e);
        }
    }
}
recursion limit exceeded at line 1 column 28572

There's a hardcoded remaining_depth in both serde_json and serde_yaml

oli-obk added a commit that referenced this issue Oct 16, 2020
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

No branches or pull requests

1 participant