@@ -952,34 +952,27 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
952
952
// If we need a panic runtime, we try to find an existing one here. At
953
953
// the same time we perform some general validation of the DAG we've got
954
954
// going such as ensuring everything has a compatible panic strategy.
955
- let desired_strategy = self . sess . panic_strategy ( ) ;
956
- let mut runtime_found = false ;
957
955
let mut needs_panic_runtime = attr:: contains_name ( & krate. attrs , sym:: needs_panic_runtime) ;
958
-
959
956
for ( _cnum, data) in self . cstore . iter_crate_data ( ) {
960
- needs_panic_runtime = needs_panic_runtime || data. needs_panic_runtime ( ) ;
961
- if data. is_panic_runtime ( ) {
962
- runtime_found = runtime_found || data. dep_kind ( ) == CrateDepKind :: Explicit ;
963
- }
957
+ needs_panic_runtime |= data. needs_panic_runtime ( ) ;
964
958
}
965
959
966
- // If an explicitly linked and matching panic runtime was found, or if
967
- // we just don't need one at all, then we're done here and there's
968
- // nothing else to do.
969
- if !needs_panic_runtime || runtime_found {
960
+ // If we just don't need a panic runtime at all, then we're done here
961
+ // and there's nothing else to do.
962
+ if !needs_panic_runtime {
970
963
return ;
971
964
}
972
965
973
- // By this point we know that we (a) need a panic runtime and (b) no
974
- // panic runtime was explicitly linked. Here we just load an appropriate
975
- // default runtime for our panic strategy.
966
+ // By this point we know that we need a panic runtime. Here we just load
967
+ // an appropriate default runtime for our panic strategy.
976
968
//
977
969
// We may resolve to an already loaded crate (as the crate may not have
978
970
// been explicitly linked prior to this), but this is fine.
979
971
//
980
972
// Also note that we have yet to perform validation of the crate graph
981
973
// in terms of everyone has a compatible panic runtime format, that's
982
974
// performed later as part of the `dependency_format` module.
975
+ let desired_strategy = self . sess . panic_strategy ( ) ;
983
976
let name = match desired_strategy {
984
977
PanicStrategy :: Unwind => sym:: panic_unwind,
985
978
PanicStrategy :: Abort => sym:: panic_abort,
0 commit comments