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

Comments

Projects
None yet
6 participants
@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

This comment has been minimized.

Copy link
Author

spinda commented Nov 29, 2016

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

@Arnavion

This comment has been minimized.

Copy link

Arnavion commented Jan 12, 2018

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

@pietroalbini

This comment has been minimized.

Copy link
Member

pietroalbini commented Apr 3, 2018

This is now fixed on the latest nightly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment