@@ -930,34 +930,27 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
930
930
// If we need a panic runtime, we try to find an existing one here. At
931
931
// the same time we perform some general validation of the DAG we've got
932
932
// going such as ensuring everything has a compatible panic strategy.
933
- let desired_strategy = self . sess . panic_strategy ( ) ;
934
- let mut runtime_found = false ;
935
933
let mut needs_panic_runtime = attr:: contains_name ( & krate. attrs , sym:: needs_panic_runtime) ;
936
-
937
934
for ( _cnum, data) in self . cstore . iter_crate_data ( ) {
938
- needs_panic_runtime = needs_panic_runtime || data. needs_panic_runtime ( ) ;
939
- if data. is_panic_runtime ( ) {
940
- runtime_found = runtime_found || data. dep_kind ( ) == CrateDepKind :: Explicit ;
941
- }
935
+ needs_panic_runtime |= data. needs_panic_runtime ( ) ;
942
936
}
943
937
944
- // If an explicitly linked and matching panic runtime was found, or if
945
- // we just don't need one at all, then we're done here and there's
946
- // nothing else to do.
947
- if !needs_panic_runtime || runtime_found {
938
+ // If we just don't need a panic runtime at all, then we're done here
939
+ // and there's nothing else to do.
940
+ if !needs_panic_runtime {
948
941
return ;
949
942
}
950
943
951
- // By this point we know that we (a) need a panic runtime and (b) no
952
- // panic runtime was explicitly linked. Here we just load an appropriate
953
- // default runtime for our panic strategy.
944
+ // By this point we know that we need a panic runtime. Here we just load
945
+ // an appropriate default runtime for our panic strategy.
954
946
//
955
947
// We may resolve to an already loaded crate (as the crate may not have
956
948
// been explicitly linked prior to this), but this is fine.
957
949
//
958
950
// Also note that we have yet to perform validation of the crate graph
959
951
// in terms of everyone has a compatible panic runtime format, that's
960
952
// performed later as part of the `dependency_format` module.
953
+ let desired_strategy = self . sess . panic_strategy ( ) ;
961
954
let name = match desired_strategy {
962
955
PanicStrategy :: Unwind => sym:: panic_unwind,
963
956
PanicStrategy :: Abort => sym:: panic_abort,
0 commit comments