File tree Expand file tree Collapse file tree 4 files changed +6
-11
lines changed Expand file tree Collapse file tree 4 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -148,9 +148,6 @@ pub struct Session {
148148 /// Metadata about the allocators for the current crate being compiled.
149149 pub has_global_allocator : Once < bool > ,
150150
151- /// Metadata about the panic handlers for the current crate being compiled.
152- pub has_panic_handler : Once < bool > ,
153-
154151 /// Cap lint level specified by a driver specifically.
155152 pub driver_lint_caps : FxHashMap < lint:: LintId , lint:: Level > ,
156153
@@ -1211,7 +1208,6 @@ fn build_session_(
12111208 print_fuel,
12121209 jobserver : jobserver:: client ( ) ,
12131210 has_global_allocator : Once :: new ( ) ,
1214- has_panic_handler : Once :: new ( ) ,
12151211 driver_lint_caps,
12161212 trait_methods_not_found : Lock :: new ( Default :: default ( ) ) ,
12171213 confused_type_with_std_module : Lock :: new ( Default :: default ( ) ) ,
Original file line number Diff line number Diff line change @@ -3045,4 +3045,9 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) {
30453045 assert_eq ! ( cnum, LOCAL_CRATE ) ;
30463046 attr:: contains_name ( tcx. hir ( ) . krate_attrs ( ) , sym:: compiler_builtins)
30473047 } ;
3048+ providers. has_panic_handler = |tcx, cnum| {
3049+ assert_eq ! ( cnum, LOCAL_CRATE ) ;
3050+ // We want to check if the panic handler was defined in this crate
3051+ tcx. lang_items ( ) . panic_impl ( ) . map_or ( false , |did| did. is_local ( ) )
3052+ } ;
30483053}
Original file line number Diff line number Diff line change @@ -542,7 +542,6 @@ impl<'tcx> EncodeContext<'tcx> {
542542 let attrs = tcx. hir ( ) . krate_attrs ( ) ;
543543 let has_default_lib_allocator = attr:: contains_name ( & attrs, sym:: default_lib_allocator) ;
544544 let has_global_allocator = * tcx. sess . has_global_allocator . get ( ) ;
545- let has_panic_handler = * tcx. sess . has_panic_handler . try_get ( ) . unwrap_or ( & false ) ;
546545
547546 let root = self . lazy ( CrateRoot {
548547 name : tcx. crate_name ( LOCAL_CRATE ) ,
@@ -553,7 +552,7 @@ impl<'tcx> EncodeContext<'tcx> {
553552 panic_strategy : tcx. sess . panic_strategy ( ) ,
554553 edition : tcx. sess . edition ( ) ,
555554 has_global_allocator : has_global_allocator,
556- has_panic_handler : has_panic_handler,
555+ has_panic_handler : tcx . has_panic_handler ( LOCAL_CRATE ) ,
557556 has_default_lib_allocator : has_default_lib_allocator,
558557 plugin_registrar_fn : tcx. plugin_registrar_fn ( LOCAL_CRATE ) . map ( |id| id. index ) ,
559558 proc_macro_decls_static : if is_proc_macro {
Original file line number Diff line number Diff line change @@ -1267,11 +1267,6 @@ fn check_fn<'a, 'tcx>(
12671267 if let Some ( panic_impl_did) = fcx. tcx . lang_items ( ) . panic_impl ( ) {
12681268 if panic_impl_did == fcx. tcx . hir ( ) . local_def_id ( fn_id) {
12691269 if let Some ( panic_info_did) = fcx. tcx . lang_items ( ) . panic_info ( ) {
1270- // at this point we don't care if there are duplicate handlers or if the handler has
1271- // the wrong signature as this value we'll be used when writing metadata and that
1272- // only happens if compilation succeeded
1273- fcx. tcx . sess . has_panic_handler . try_set_same ( true ) ;
1274-
12751270 if declared_ret_ty. kind != ty:: Never {
12761271 fcx. tcx . sess . span_err (
12771272 decl. output . span ( ) ,
You can’t perform that action at this time.
0 commit comments