2017-04-23 7 views
4

녹 녹스에 코드 적용 범위를 추가하려고합니다. 100 % 적용되는 것으로보고되었지만 보고서를 보면 많은 행이 계산되지 않습니다. https://codecov.io/gh/JelteF/defaultmap/src/c878e108c61f270718c909e1500c4c2e865a33d1/src/lib.rs#L93...106일부 방법이 적용되지 않아도 Kcov에서 Rust lib를 100 %보고 함

이 이유는 무엇이며이를 해결할 수 있습니까? 나는 이미 RUSTFLAGS를 "-C link-dead-code"로 설정하려고 시도했다. 대답은 다음과 같다 : 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 

나는 생각한다.