Closed
Description
I have three crates: a
(library), b
(library), and c
(binary).
a
has no dependencies, and its src/lib.rs
is just:
pub struct Struct;
b
has the following dependency and src/lib.rs
:
[dependencies]
a = { path = "../a", version = "*" }
pub use a;
pub use crate as alias;
c
has the following dependency and src/main.rs
:
[dependencies]
b = { path = "../b", version = "*" }
use b::alias;
// the error happens with Fn and FnMut but not FnOnce
// (the error also happens if the `F` parameter is an `impl Trait`)
// (the error also happens if crate c depends on crate a and uses `a::Struct` directly)
fn f<F: Fn(b::a::Struct)>(_: F) {}
fn main() {}
The following error happens running cargo check
or cargo build
in crate c
:
carado@ram:~/tmp/rust8/c $ rustc --version
rustc 1.37.0-nightly (400b409ef 2019-06-09)
carado@ram:~/tmp/rust8/c $ RUST_BACKTRACE=full cargo check
Checking a v0.1.0 (/home/carado/tmp/rust8/a)
Checking b v0.1.0 (/home/carado/tmp/rust8/b)
Checking c v0.1.0 (/home/carado/tmp/rust8/c)
warning: unused import: `b::alias`
--> src/main.rs:1:5
|
1 | use b::alias;
| ^^^^^^^^
|
= note: #[warn(unused_imports)] on by default
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: Could not compile `c`.
Caused by:
process didn't exit successfully: `rustc --edition=2018 --crate-name c src/main.rs --color always --crate-type bin --emit=dep-info,metadata -C debuginfo=2 -C metadata=d99834104ec97a8f -C extra-filename=-d99834104ec97a8f --out-dir /home/carado/tmp/rust8/c/target/debug/deps -C incremental=/home/carado/tmp/rust8/c/target/debug/incremental -L dependency=/home/carado/tmp/rust8/c/target/debug/deps --extern a=/home/carado/tmp/rust8/c/target/debug/deps/liba-abc860a16fd4c695.rmeta --extern b=/home/carado/tmp/rust8/c/target/debug/deps/libb-b7de48bb96cbc467.rmeta` (signal: 6, SIGABRT: process abort signal)
Try as I may, I can't manage to make the error happen without putting in every one of those lines and dependencies.
EDIT: the bug only requires crate as alias
, not crate::{self as alias}