about summary refs log tree commit diff
path: root/src/rustdoc
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-01-30 21:00:57 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-01-31 10:08:24 -0800
commitfba35e1a3c87892823d1f4d436b9f00a7864cf16 (patch)
tree1fadaaee99ef266bd2f709fb2aa5577184ab611e /src/rustdoc
parent813a55d89135efb716dd80e96453a091a7cfc631 (diff)
Require alts to be exhaustive
middle::check_alt does the work. Lots of changes to add default cases
into alts that were previously inexhaustive.
Diffstat (limited to 'src/rustdoc')
-rw-r--r--src/rustdoc/attr_pass.rs10
-rw-r--r--src/rustdoc/parse.rs2
-rw-r--r--src/rustdoc/prune_unexported_pass.rs6
-rw-r--r--src/rustdoc/tystr_pass.rs18
4 files changed, 32 insertions, 4 deletions
diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs
index 0b38b104c61..91e065f310b 100644
--- a/src/rustdoc/attr_pass.rs
+++ b/src/rustdoc/attr_pass.rs
@@ -70,6 +70,9 @@ fn parse_item_attrs<T>(
     astsrv::exec(srv) {|ctxt|
         let attrs = alt ctxt.ast_map.get(id) {
           ast_map::node_item(item) { item.attrs }
+          _ {
+            fail "parse_item_attrs: not an item";
+          }
         };
         parse_attrs(attrs)
     }
@@ -277,6 +280,7 @@ fn fold_enum(
 
                     attr_parser::parse_variant(ast_variant.node.attrs)
                   }
+                  _ { fail "fold_enum: undocumented invariant"; }
                 }
             };
 
@@ -363,7 +367,6 @@ fn fold_res_should_extract_arg_docs() {
     assert doc.args[0].desc == some("b");
 }
 
-
 fn fold_iface(
     fold: fold::fold<astsrv::srv>,
     doc: doc::ifacedoc
@@ -395,6 +398,9 @@ fn merge_method_attrs(
                 (method.ident, attr_parser::parse_method(method.attrs))
             }
           }
+          _ {
+            fail "Undocumented invariant in merge_method_attrs";
+          }
         }
     };
 
@@ -441,4 +447,4 @@ fn should_extract_iface_method_docs() {
     assert doc.topmod.ifaces()[0].methods[0].args[0].desc == some("a");
     assert doc.topmod.ifaces()[0].methods[0].return.desc == some("return");
     assert doc.topmod.ifaces()[0].methods[0].failure == some("failure");
-}
\ No newline at end of file
+}
diff --git a/src/rustdoc/parse.rs b/src/rustdoc/parse.rs
index 5bc867dd036..c8b13d92769 100644
--- a/src/rustdoc/parse.rs
+++ b/src/rustdoc/parse.rs
@@ -43,4 +43,4 @@ fn from_str_sess(sess: session::session, source: str) -> @ast::crate {
 
 fn cfg(sess: session::session) -> ast::crate_cfg {
     driver::default_configuration(sess, "rustdoc", "<anon>")
-}
\ No newline at end of file
+}
diff --git a/src/rustdoc/prune_unexported_pass.rs b/src/rustdoc/prune_unexported_pass.rs
index 2db7e10cd1f..554124f6348 100644
--- a/src/rustdoc/prune_unexported_pass.rs
+++ b/src/rustdoc/prune_unexported_pass.rs
@@ -111,8 +111,12 @@ fn is_exported_from_mod(
               ast::item_mod(m) {
                 ast_util::is_exported(item_name, m)
               }
+              _ {
+                fail "is_exported_from_mod: not a mod";
+              }
             }
           }
+          _ { fail "is_exported_from_mod: not an item"; }
         }
     }
 }
@@ -243,4 +247,4 @@ fn should_prune_unexported_ifaces_from_top_mod() {
     let doc = extract::from_srv(srv, "");
     let doc = run(srv, doc);
     assert vec::is_empty(doc.topmod.ifaces());
-}
\ No newline at end of file
+}
diff --git a/src/rustdoc/tystr_pass.rs b/src/rustdoc/tystr_pass.rs
index 9f6e5b013b5..ecf3049b156 100644
--- a/src/rustdoc/tystr_pass.rs
+++ b/src/rustdoc/tystr_pass.rs
@@ -50,6 +50,9 @@ fn get_fn_sig(srv: astsrv::srv, fn_id: doc::ast_id) -> option<str> {
           }) {
             some(pprust::fun_to_str(decl, ident, []))
           }
+          _ {
+            fail "get_fn_sig: undocumented invariant";
+          }
         }
     }
 }
@@ -87,6 +90,7 @@ fn get_ret_ty(srv: astsrv::srv, fn_id: doc::ast_id) -> option<str> {
           }) {
             ret_ty_to_str(decl)
           }
+          _ { fail "get_ret_ty: undocumented invariant"; }
         }
     }
 }
@@ -145,6 +149,9 @@ fn get_arg_tys(srv: astsrv::srv, fn_id: doc::ast_id) -> [(str, str)] {
           }) {
             decl_arg_tys(decl)
           }
+          _ {
+            fail "get_arg_tys: undocumented invariant";
+          }
         }
     }
 }
@@ -180,6 +187,9 @@ fn fold_const(
               }) {
                 pprust::ty_to_str(ty)
               }
+              _ {
+                fail "fold_const: undocumented invariant";
+              }
             }
         })
         with doc
@@ -215,6 +225,7 @@ fn fold_enum(
 
                     pprust::variant_to_str(ast_variant)
                   }
+                  _ { fail "fold_enum: undocumented invariant"; }
                 }
             };
 
@@ -251,6 +262,7 @@ fn fold_res(
               }) {
                 pprust::res_to_str(decl, doc.name, [])
               }
+              _ { fail "fold_res: undocumented invariant"; }
             }
         })
         with doc
@@ -336,8 +348,10 @@ fn get_method_ret_ty(
                 some(method) {
                     ret_ty_to_str(method.decl)
                 }
+                _ { fail "get_method_ret_ty: undocumented invariant"; }
             }
           }
+          _ { fail "get_method_ret_ty: undocumented invariant"; }
         }
     }
 }
@@ -358,8 +372,10 @@ fn get_method_sig(
                 some(method) {
                     some(pprust::fun_to_str(method.decl, method.ident, []))
                 }
+                _ { fail "get_method_ret_sig: undocumented invariant"; }
             }
           }
+          _ { fail "get_method_ret_sig: undocumented invariant"; }
         }
     }
 }
@@ -396,8 +412,10 @@ fn get_method_arg_tys(
                 some(method) {
                     decl_arg_tys(method.decl)
                 }
+                _ { fail "get_method_arg_tys: undocumented invariant"; }
             }
           }
+          _ { fail "get_method_arg_tys: undocumented invariant"; }
         }
     }
 }