This patch simplifies the way WP_Roles is implemented. Roles are no longer stored in the options table. Instead they are populated at runtime by an action. An action handler in capabilities.php populates the standard roles with current default capabilities. Plugins can hook the same init_roles action to create their own roles.
I also included some related fixes and improvements:
* Capabilities were duplicated in two places previously (in WP_Roles::roles and again in WP_Role::capabilities). This created a bug where calling $wp_roles->add_cap() could cause the two to get out of sync. They're kept in a single place now.
* There's a new "{$role}_has_cap" filter that's considerably easier to use than the old role_has_cap filter (it has only one argument).
Issues: I deliberately haven't yet provided an upgrade path for blogs that have custom roles stored in the options table. That might be necessary but I'm not sure how common or vital it is.