-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Closed
Copy link
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
Deserializetrait definition. - Removing the
constaround theextern cratestatement. - Moving the
constdeclaration 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
C-bugCategory: This is a bug.Category: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.