2017-04-23 2 views
4

私は錆のライブラリにコードカバレッジを追加しようとしています。それは100%カバーされていると報告していますが、報告書を見ると多くの行は数えられません:https://codecov.io/gh/JelteF/defaultmap/src/c878e108c61f270718c909e1500c4c2e865a33d1/src/lib.rs#L93...106いくつかの方法がカバーされていないにもかかわらず、KcovはRust libの100%を報告しています

これはなぜこれを解決できますか?私はすでに、この答えに示唆されているように、 "Cのリンクデッドコード"にRUSTFLAGSを設定しようとしました:https://stackoverflow.com/a/38371687/2570866 しかし、それは役に立たなかった。

答えて

4

これは既知の問題です(https://github.com/rust-lang/rust/issues/39293)。解決策はまだ実装されていません。錆のジェネリックはsimilar to templates in C++です。ジェネリック関数を使用しない場合、コードはまったく生成されません。実際、これらの関数が存在しない:私は考えて

$ nm target/debug/defaultmap-2fd0c3085042f647 | grep DefaultHashMap | cargo demangle 
000000000002c350 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::ops::Index<KB>>::index::h14fb5e24128b7e47 
000000000002c390 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::ops::Index<KB>>::index::h5c00e602e45f6925 
000000000002c3d0 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::ops::Index<KB>>::index::hc5dfb7b3478d945a 
000000000002c420 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::ops::IndexMut<K>>::index_mut::h8b298bf16464a070 
000000000002c470 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::ops::IndexMut<K>>::index_mut::hcc509def35f89759 
000000000002bfc0 t <defaultmap::hashmap::DefaultHashMap<K, V>>::get::h6a0f4cb5c61c67e8 
000000000002c060 t <defaultmap::hashmap::DefaultHashMap<K, V>>::get::ha5fdb528b5dd94a5 
000000000002c110 t <defaultmap::hashmap::DefaultHashMap<K, V>>::get::hc1a5643986209ba6 
000000000002c1b0 t <defaultmap::hashmap::DefaultHashMap<K, V>>::get_mut::h14f0ded6ba3206f3 
000000000002c2a0 t <defaultmap::hashmap::DefaultHashMap<K, V>>::get_mut::h6ea36d917e778099 
000000000002eaf0 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::fmt::Debug>::fmt::h2cefa624bd18fcfe 
000000000002e9e0 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::default::Default>::default::h0b736edcd6ac228a 
000000000002ea60 t <defaultmap::hashmap::DefaultHashMap<K, V> as core::default::Default>::default::hd09b7abe1e63b94f 

、今のところ、唯一の現実的な解決策は、手動でカバレッジレポートを検査し、無視機能のために不足してテストを再度追加することです。

関連する問題