diff options
| author | Jed Davis <jld@panix.com> | 2013-04-07 20:26:48 -0700 |
|---|---|---|
| committer | Jed Davis <jld@panix.com> | 2013-04-08 01:03:42 -0700 |
| commit | 2589eba957ee5632dc9060022b5ca09cbfb782f9 (patch) | |
| tree | 9fff748377f11e1ae38ce7f2aa561048e88b5045 | |
| parent | 640e8ae4e583057e7a4e694063bf704c02f816c1 (diff) | |
| download | rust-2589eba957ee5632dc9060022b5ca09cbfb782f9.tar.gz rust-2589eba957ee5632dc9060022b5ca09cbfb782f9.zip | |
When repr'ing an enum value, assert that it matched some variant.
| -rw-r--r-- | src/libcore/repr.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libcore/repr.rs b/src/libcore/repr.rs index 30ae3c3b833..530f80ef764 100644 --- a/src/libcore/repr.rs +++ b/src/libcore/repr.rs @@ -624,9 +624,10 @@ impl TyVisitor for ReprVisitor { fn visit_leave_enum(&self, _n_variants: uint, _get_disr: extern unsafe fn(ptr: *Opaque) -> int, _sz: uint, _align: uint) -> bool { - // NOTE should this assert that it's not still SearchingFor the right variant? - self.var_stk.pop(); - true + match self.var_stk.pop() { + SearchingFor(*) => fail!(~"enum value matched no variant"), + _ => true + } } fn visit_enter_fn(&self, _purity: uint, _proto: uint, |
