1
Fork 0
rust/compiler/rustc_hir_analysis/src
bors dfa88b328f Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin
Implement intrinsics with fallback bodies

fixes #93145 (though we can port many more intrinsics)
cc #63585

The way this works is that the backend logic for generating custom code for intrinsics has been made fallible. The only failure path is "this intrinsic is unknown". The `Instance` (that was `InstanceDef::Intrinsic`) then gets converted to `InstanceDef::Item`, which represents the fallback body. A regular function call to that body is then codegenned. This is currently implemented for

* codegen_ssa (so llvm and gcc)
* codegen_cranelift

other backends will need to adjust, but they can just keep doing what they were doing if they prefer (though adding new intrinsics to the compiler will then require them to implement them, instead of getting the fallback body).

cc `@scottmcm` `@WaffleLapkin`

### todo

* [ ] miri support
* [x] default intrinsic name to name of function instead of requiring it to be specified in attribute
* [x] make sure that the bodies are always available (must be collected for metadata)
2024-02-16 09:53:01 +00:00
..
astconv Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoerister 2024-02-15 12:36:37 +00:00
check Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
coherence Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoerister 2024-02-15 12:36:37 +00:00
collect Bump indexmap 2024-02-13 21:03:34 +00:00
impl_wf_check Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obk 2024-02-12 23:18:54 +01:00
outlives Auto merge of #120931 - chenyukang:yukang-cleanup-hashmap, r=michaelwoerister 2024-02-15 12:36:37 +00:00
structured_errors hir: Remove hir::Map::{opt_parent_id,parent_id,get_parent,find_parent} 2024-02-10 12:24:46 +03:00
variance Dejargnonize subst 2024-02-12 15:46:35 +09:00
autoderef.rs fix ICE for deref coercions with type errors 2024-02-12 14:37:35 +01:00
bounds.rs ~const trait or projection bounds do not imply non-const bounds 2024-01-08 15:01:14 +00:00
check_unused.rs Rename TyCtxt::struct_span_lint_hir as TyCtxt::node_span_lint. 2024-01-23 08:09:01 +11:00
collect.rs Auto merge of #120500 - oli-obk:intrinsics2.0, r=WaffleLapkin 2024-02-16 09:53:01 +00:00
constrained_generic_params.rs Dejargnonize subst 2024-02-12 15:46:35 +09:00
errors.rs Rollup merge of #120958 - ShoyuVanilla:remove-subst, r=oli-obk 2024-02-12 23:18:54 +01:00
hir_wf_check.rs Remove Session methods that duplicate DiagCtxt methods. 2023-12-24 08:05:28 +11:00
impl_wf_check.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00
lib.rs Auto merge of #120486 - reitermarkus:use-generic-nonzero, r=dtolnay 2024-02-16 07:46:31 +00:00
structured_errors.rs Stop using String for error codes. 2024-01-29 07:41:41 +11:00