Closed
Description
...but only when the crate is introduced solely through edition2018 extern prelude and not when an extern crate
statement exists at root level.
Minimized reproduction (on playground)
use serde::de::{Deserialize, Deserializer};
pub struct S;
impl<'de> Deserialize<'de> for S {
fn deserialize<D>(_: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
const _: () = {
extern crate serde;
};
todo!()
}
}
(Reason for this code shape: deriving serde's traits puts the impl within a const
and uses extern crate
to get serde at a known name.)
Edits that make this not overflow the stack:
- Add
extern crate serde;
at root level. - Inline the
Deserialize
trait definition. - Removing the
const
around theextern crate
statement. - Moving the
const
declaration to root scope.
Meta
rustc --version --verbose
:
rustc 1.44.0-nightly (94d346360 2020-04-09)
binary: rustc
commit-hash: 94d346360da50f159e0dc777dc9bc3c5b6b51a00
commit-date: 2020-04-09
host: x86_64-pc-windows-msvc
release: 1.44.0-nightly
LLVM version: 9.0
This overflows the stack back to 1.31.0, the first stable release with edition 2018 support.
cargo check
is enough to get the stack overflow.
Error output
thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.