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

ICE: rustc overflows its stack on instanciation of enum #25693

Closed
abandoned-cocoon opened this issue May 21, 2015 · 2 comments
Closed

ICE: rustc overflows its stack on instanciation of enum #25693

abandoned-cocoon opened this issue May 21, 2015 · 2 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.

Comments

@abandoned-cocoon
Copy link

Also available at http://is.gd/7glmKz

pub trait Paramters { type SelfRef; }

struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> }
struct BP;

impl<'a> Paramters for RP<'a> { type SelfRef = &'a X<RP<'a>>; }
impl Paramters for BP { type SelfRef = Box<X<BP>>; }

pub struct Y;
pub enum X<P: Paramters> {
    Nothing,
    SameAgain(P::SelfRef, Y)
}

fn main() {
    // fine
    let bnil: Box<X<BP>> = Box::new(X::Nothing);
    let bx: Box<X<BP>> = Box::new(X::SameAgain(bnil, Y));
    // crashes rustc
    let rnil: X<RP> = X::Nothing;
    let rx: X<RP> = X::SameAgain(&rnil, Y);
}

Output:

thread 'rustc' has overflowed its stack
Illegal instruction (core dumped)
@pnkfelix pnkfelix added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label May 21, 2015
@eddyb
Copy link
Member

eddyb commented May 26, 2015

This seems to enter a recursive cycle in middle::implicator::Implicator:

accumulate_from_ty
accumulate_from_adt
accumulate_from_assoc_types
accumulate_from_ty

@nikomatsakis Should the implicator detect cycles and report them, or even let this code compile?

@apasel422 apasel422 mentioned this issue Oct 24, 2015
bors added a commit that referenced this issue Oct 25, 2015
Closes #22781.
Closes #23891.
Closes #24956.
Closes #25145.
Closes #25693.
Closes #26095.
Closes #26459.
Closes #27320.
Closes #27895.
@steveklabnik steveklabnik added E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 25, 2015
@steveklabnik
Copy link
Member

This needs a test, and no longer ICEs, but looks like @apasel422 is on it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
Projects
None yet
Development

No branches or pull requests

4 participants