You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
representable check fails if an enum references another enum that is cyclic #3008
// Compiler fails here because it starts to check foo which references
// bar which is cyclic.
enum foo { foo(bar) }
enum bar { bar_none, bar_some(bar) }
// As before, but with order reversed, so that should we happen to
// start checking from end of file forward, we'd still have the same
// problem.
enum bar1 { bar1_none, bar1_some(bar1) }
enum foo1 { foo1(bar1) }
fn main() {}
I think the right approach is to replace ty_structurally_contains() with something like walk_interior_tys(). then we have to keeep a stack of def-ids and when we enter a new nominal type check that we do not already have it on the stack. i started this then realized it was a big distraction from what I'm trying to do, so filing a bug instead. Marking as A-typesystem as this check is performed in middle/typeck/check.rs
Just to make this concrete: both of the cases that Niko describes yield ICE's. The first (the foo and bar items) yields an ICE with no useful error information. The second (bar1 and foo1) yields an error describing the illegal recursive enum type (followed by an ICE :).
Activity
pnkfelix commentedon Apr 25, 2013
Just to make this concrete: both of the cases that Niko describes yield ICE's. The first (the
fooandbaritems) yields an ICE with no useful error information. The second (bar1andfoo1) yields an error describing the illegal recursive enum type (followed by an ICE :).pcwalton commentedon May 16, 2013
I don't believe this is backwards incompatible, renominating.
graydon commentedon Jun 6, 2013
accepted for production-ready milestone
bblum commentedon Aug 16, 2013
appears to be properly classified
pnkfelix commentedon Jan 16, 2014
Accepting for P-high.
pnkfelix commentedon Jan 16, 2014
Tagging as mentorship bug, with @nikomatsakis as mentor
isabelmu commentedon Jan 19, 2014
This code triggers the same infinite recursion in type_structurally_contains:
isabelmu commentedon Jan 27, 2014
I have a fix for this written, in case anyone is wondering whether to start working on it. I'll submit a pull request soon.
Check enum and struct representability properly (issues rust-lang#3008 …
Auto merge of rust-lang#3008 - oli-obk:ui_test_progress_bars, r=RalfJung
Upgrade Rust toolchain to nightly-2024-01-24 (rust-lang#3008)
Merge rust-lang#3378
Merge pull request rust-lang#3008 from rust-lang/tshepang/misc