Skip to content
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

Infinite size checker doesn't see through impl Trait, leading to rustc overflow #38064

Closed
spinda opened this issue Nov 29, 2016 · 3 comments
Closed
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-type-system Area: Type system C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@spinda
Copy link

spinda commented Nov 29, 2016

Test case:

#![feature(conservative_impl_trait)]

trait Quux {}

fn foo() -> impl Quux {
    struct Foo<T>(T);
    impl<T> Quux for Foo<T> {}
    Foo(bar())
}

fn bar() -> impl Quux {
    struct Bar<T>(T);
    impl<T> Quux for Bar<T> {}
    Bar(foo())
}

// effectively:
//     struct Foo(Bar);
//     struct Bar(Foo);
// should produce an error about infinite size

fn main() { foo(); }

Output:

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow

rustc --version --verbose:

rustc 1.15.0-nightly (03bdaade2 2016-11-27)
binary: rustc
commit-hash: 03bdaade2a0c39118a5be927c667776a5de0d681
commit-date: 2016-11-27
host: x86_64-unknown-linux-gnu
release: 1.15.0-nightly
LLVM version: 3.9
@spinda spinda changed the title Recursion checker doesn't see through impl Trait, leading to rustc overflow Infinite size checker doesn't see through impl Trait, leading to rustc overflow Nov 29, 2016
@spinda
Copy link
Author

spinda commented Nov 29, 2016

References for Minimal impl Trait: RFC rust-lang/rfcs#1522, tracking issue #34511.

@steveklabnik steveklabnik added the A-type-system Area: Type system label Nov 29, 2016
@Mark-Simulacrum Mark-Simulacrum added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 16, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@Arnavion
Copy link

Can this be tagged A-impl-trait too please? Otherwise it's hard to find before filing duplicates.

@petrochenkov petrochenkov added the A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. label Jan 12, 2018
@pietroalbini
Copy link
Member

This is now fixed on the latest nightly.

@fmease fmease added A-type-system Area: Type system and removed A-type-system Area: Type system labels Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-type-system Area: Type system C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

7 participants