Skip to content

rustdoc stack overflow on stable (1.25.0) and nightly (ac3c2288f) #50196

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

Closed
RazrFalcon opened this issue Apr 24, 2018 · 5 comments
Closed

rustdoc stack overflow on stable (1.25.0) and nightly (ac3c2288f) #50196

RazrFalcon opened this issue Apr 24, 2018 · 5 comments
Assignees
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@RazrFalcon
Copy link

I got a stack overflow during cargo doc on my crate:

% cargo doc
 Documenting resvg v0.2.0 (file:///media/data/Programming/Projects/rust/resvg)

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: Could not document `resvg`.

Caused by:
  process didn't exit successfully: `rustdoc --crate-name resvg src/lib.rs -o /media/data/Programming/Projects/rust/resvg/target/doc -L dependency=/media/data/Programming/Projects/rust/resvg/target/debug/deps --extern failure=/media/data/Programming/Projects/rust/resvg/target/debug/deps/libfailure-0a3bba1278ba0cc9.rmeta --extern log=/media/data/Programming/Projects/rust/resvg/target/debug/deps/liblog-536ed3d82960b225.rmeta --extern euclid=/media/data/Programming/Projects/rust/resvg/target/debug/deps/libeuclid-64eb361a44c7fcf2.rmeta --extern usvg=/media/data/Programming/Projects/rust/resvg/target/debug/deps/libusvg-c79e4aac850c4257.rmeta --extern lyon_geom=/media/data/Programming/Projects/rust/resvg/target/debug/deps/liblyon_geom-0b70e94ea051fc6c.rmeta` (signal: 6, SIGABRT: process abort signal)
% rustc -V
rustc 1.25.0 (84203cac6 2018-03-25)
% rustc +nightly -V
rustc 1.27.0-nightly (ac3c2288f 2018-04-18)
% uname -a
Linux razr 4.9.76-gentoo-r1 #1 SMP PREEMPT Fri Mar 23 15:37:06 EET 2018 x86_64 Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz GenuineIntel GNU/Linux
@pietroalbini pietroalbini added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools-rustdoc C-bug Category: This is a bug. labels Apr 24, 2018
@est31
Copy link
Member

est31 commented Apr 24, 2018

Below is a minimal reproduction. The code that makes rustdoc overflow its stack is therefore somewhere upwards in the dependency chain.

Cargo.toml:

[package]
name = "resvg_reproduction"
version = "0.1.0"
authors = ["est31 <[email protected]>"]

[dependencies]
usvg = "0.1"
extern crate usvg;
pub use usvg::tree;

@RazrFalcon
Copy link
Author

@est31 is there any hotfix that I can do on my side?

@est31
Copy link
Member

est31 commented Apr 24, 2018

@RazrFalcon I'm currently attempting to minimize the reproduction by slicing apart the usvg crate. I'm not aware of a hotfix.

@est31
Copy link
Member

est31 commented Apr 24, 2018

Found an actual minimal reproduction.

resvg_reproduction Cargo.toml:

[package]
name = "resvg_reproduction"
version = "0.1.0"
authors = ["est31 <[email protected]>"]

[dependencies]
usvg_reproduction = {path = "../usvg_reproduction"}

resvg_reproduction lib.rs:

extern crate usvg_reproduction;
pub use usvg_reproduction::tree;

usvg_reproduction Cargo.toml:

[package]
name = "usvg_reproduction"
version = "0.1.0"
authors = ["est31 <[email protected]>"]

usvg_reproduction lib.rs:

pub mod tree {
    pub use tree;
}

I guess something inside rustdoc tries to follow these self referential indirections infinitely deep and this causes the stack overflow.

For a hotfix the following has worked for me:

a) removing the pub use tree; from the pub mod prelude in src/tree/mod.rs in the usvg codebase
b) replacing pub use tree::prelude::*; with pub use tree; pub use tree::prelude::*; everywhere in usvg as well as doing the analogon in resvg.

@RazrFalcon
Copy link
Author

Thanks for finding a cause. Will think about what I can do here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants