rust/compiler/rustc_middle/src
bors b3df0d7e5e Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix
"Handle" calls to upstream monomorphizations in compiler_builtins

This is pretty cooked, but I think it works.

compiler-builtins has a long-standing problem that at link time, its rlib cannot contain any calls to `core`. And yet, in codegen we _love_ inserting calls to symbols in `core`, generally from various panic entrypoints.

I intend this PR to attack that problem as completely as possible. When we generate a function call, we now check if we are generating a function call from `compiler_builtins` and whether the callee is a function which was not lowered in the current crate, meaning we will have to link to it.

If those conditions are met, actually generating the call is asking for a linker error. So we don't. If the callee diverges, we lower to an abort with the same behavior as `core::intrinsics::abort`. If the callee does not diverge, we produce an error. This means that compiler-builtins can contain panics, but they'll SIGILL instead of panicking. I made non-diverging calls a compile error because I'm guessing that they'd mostly get into compiler-builtins by someone making a mistake while working on the crate, and compile errors are better than linker errors. We could turn such calls into aborts as well if that's preferred.
2024-03-22 16:55:11 +00:00
..
dep_graph Reduce exposure of things. 2023-11-16 16:49:22 +11:00
hir rename items -> free_items 2024-03-21 14:27:11 +01:00
hooks coverage: Make is_eligible_for_coverage a hook method 2024-03-13 20:43:35 +11:00
infer add comment 2024-02-22 18:54:51 +01:00
middle Rename BuiltinLintDiagnostics as BuiltinLintDiag. 2024-03-05 12:15:10 +11:00
mir Rollup merge of #122820 - oli-obk:no_ord_def_id, r=estebank 2024-03-22 11:37:01 +01:00
query Split item bounds and item super predicates 2024-03-20 13:00:34 -04:00
thir Add barest-bones deref patterns 2024-03-20 22:30:27 +01:00
traits cleanup + review 2024-03-18 18:13:25 +01:00
ty Auto merge of #122580 - saethlin:compiler-builtins-can-panic, r=pnkfelix 2024-03-22 16:55:11 +00:00
util Make span_bug panic site useful again 2024-03-19 09:19:12 +00:00
arena.rs Create some minimal HIR for associated opaque types 2024-03-13 17:33:09 +03:00
error.rs Rename DiagnosticMessage as DiagMessage. 2024-03-05 12:14:49 +11:00
lib.rs step cfgs 2024-03-20 08:49:13 -04:00
lint.rs Guard decorate on when not to skip instead 2024-03-17 15:07:22 +00:00
macros.rs Remove unnecessary braces from span_bug 2024-03-21 11:24:24 -04:00
metadata.rs rustc_metadata: Remove Span from ModChild 2023-04-18 17:25:04 +03:00
tests.rs Remove outdated references to librustc_middle. 2024-01-05 16:34:52 +00:00
thir.rs Implement macro-based deref!() syntax for deref patterns 2024-03-21 11:42:49 -04:00
values.rs make Representability::Infinite carry ErrorGuaranteed 2024-03-14 20:52:13 +01:00