Index: petgraph/benches/common/factories.rs
===================================================================
--- petgraph.orig/benches/common/factories.rs
+++ petgraph/benches/common/factories.rs
@@ -265,14 +265,17 @@ pub fn digraph() -> GraphFactory<Directe
     graph()
 }
 
+#[cfg(feature = "stable_graph")]
 pub fn stable_graph<Ty: EdgeType>() -> GraphFactory<Ty, StableGraph<(), (), Ty>> {
     GraphFactory::new()
 }
 
+#[cfg(feature = "stable_graph")]
 pub fn stable_ungraph() -> GraphFactory<Undirected, StableGraph<(), (), Undirected>> {
     stable_graph()
 }
 
+#[cfg(feature = "stable_graph")]
 pub fn stable_digraph() -> GraphFactory<Directed, StableGraph<(), (), Directed>> {
     stable_graph()
 }
Index: petgraph/benches/stable_graph.rs
===================================================================
--- petgraph.orig/benches/stable_graph.rs
+++ petgraph/benches/stable_graph.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "stable_graph")]
 #![feature(test)]
 
 extern crate petgraph;
Index: petgraph/benches/matrix_graph.rs
===================================================================
--- petgraph.orig/benches/matrix_graph.rs
+++ petgraph/benches/matrix_graph.rs
@@ -1,3 +1,4 @@
+#![cfg(feature = "matrix_graph")]
 #![feature(test)]
 
 extern crate petgraph;
Index: petgraph/benches/serialize.rs
===================================================================
--- petgraph.orig/benches/serialize.rs
+++ petgraph/benches/serialize.rs
@@ -1,6 +1,6 @@
 #![feature(test)]
 
-#[cfg(feature = "serde-1")]
+#[cfg(all(feature = "serde-1",feature="stable_graph"))]
 mod serialize {
     extern crate petgraph;
     extern crate test;
