Disallow dereferencing enum types when the variant is private

If an enum type's only variant is private, disallow dereferencing
values of its type.

Due to #4082, this only applies to enums that are in the same crate.

r=pcwalton

Closes #818
This commit is contained in:
Tim Chevalier
2012-11-30 11:24:16 -08:00
parent f89d4ac830
commit daf28a421a
13 changed files with 186 additions and 78 deletions

View File

@@ -391,6 +391,16 @@ fn node_id_to_str(map: map, id: node_id, itr: @ident_interner) -> ~str {
}
}
}
fn node_item_query<Result>(items: map, id: node_id,
query: fn(@item) -> Result,
error_msg: ~str) -> Result {
match items.find(id) {
Some(node_item(it, _)) => query(it),
_ => fail(error_msg)
}
}
// Local Variables:
// mode: rust
// fill-column: 78;