Skip to content

rustc stack overflow while using serde #72024

Closed
@euclio

Description

@euclio

I tried this code:

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=56914d5ac20726d98a92eb173281eb09

use serde::{Deserialize, Deserializer};

pub enum Message {}

impl<'de> Deserialize<'de> for Message {
    fn deserialize<D>(_deserializer: D) -> Result<Self, D::Error>
    where
        D: Deserializer<'de>,
    {
        #[derive(Deserialize)]
        pub struct RawMessage {}
    }
}

I expected to see this happen: Get a type error. This is reduced from a much larger example.

Instead, this happened: rustc overflows its stack.

Meta

rustc --version --verbose:

rustc 1.43.1 (8d69840ab 2020-05-04)
binary: rustc
commit-hash: 8d69840ab92ea7f4d323420088dd8c9775f180cd
commit-date: 2020-05-04
host: x86_64-unknown-linux-gnu
release: 1.43.1
LLVM version: 9.0

This bug is also present on nightly.

Backtrace

None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions