diff options
| author | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-08-02 12:45:52 -0700 |
|---|---|---|
| committer | Scott McMurray <scottmcm@users.noreply.github.com> | 2023-08-06 15:47:40 -0700 |
| commit | 502af03445f045dade14f14e754803f02c2c5e24 (patch) | |
| tree | fbeb208e1c6d7df46431f1412404e8b48dfd5349 /compiler/rustc_hir_analysis/src/check | |
| parent | 85fbb571497d13cfb828de9b0d3e78656b9203c1 (diff) | |
| download | rust-502af03445f045dade14f14e754803f02c2c5e24.tar.gz rust-502af03445f045dade14f14e754803f02c2c5e24.zip | |
Add a new `compare_bytes` intrinsic instead of calling `memcmp` directly
Diffstat (limited to 'compiler/rustc_hir_analysis/src/check')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/check/intrinsic.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs index 970efaf312c..f89e2e5c25b 100644 --- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs +++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs @@ -273,6 +273,10 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { ], Ty::new_unit(tcx), ), + sym::compare_bytes => { + let byte_ptr = Ty::new_imm_ptr(tcx, tcx.types.u8); + (0, vec![byte_ptr, byte_ptr, tcx.types.usize], tcx.types.i32) + } sym::write_bytes | sym::volatile_set_memory => ( 1, vec