about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDeadbeef <ent3rm4n@gmail.com>2024-06-16 15:12:22 +0000
committerDeadbeef <ent3rm4n@gmail.com>2024-06-21 09:23:54 +0000
commit02aaea18032cd409d7a07ded6d42fc5855484419 (patch)
treed1e41105c4259d65d6d19cd746db92c15b226d8c
parent3b14b756d87835bf1484ee33eb5b074d3646671c (diff)
downloadrust-02aaea18032cd409d7a07ded6d42fc5855484419.tar.gz
rust-02aaea18032cd409d7a07ded6d42fc5855484419.zip
update intrinsic const param counting
-rw-r--r--compiler/rustc_hir_analysis/src/check/intrinsic.rs24
-rw-r--r--library/core/src/ffi/c_str.rs3
-rw-r--r--library/core/src/lib.rs1
3 files changed, 15 insertions, 13 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/intrinsic.rs b/compiler/rustc_hir_analysis/src/check/intrinsic.rs
index 13180fa2673..683709f43f2 100644
--- a/compiler/rustc_hir_analysis/src/check/intrinsic.rs
+++ b/compiler/rustc_hir_analysis/src/check/intrinsic.rs
@@ -429,17 +429,17 @@ pub fn check_intrinsic_type(
 
             sym::ptr_guaranteed_cmp => (
                 1,
-                1,
+                0,
                 vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
                 tcx.types.u8,
             ),
 
             sym::const_allocate => {
-                (0, 1, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
+                (0, 0, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
             }
             sym::const_deallocate => (
                 0,
-                1,
+                0,
                 vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
                 tcx.types.unit,
             ),
@@ -478,16 +478,16 @@ pub fn check_intrinsic_type(
             | sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)),
             sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)),
 
-            sym::assume => (0, 1, vec![tcx.types.bool], tcx.types.unit),
-            sym::likely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
-            sym::unlikely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
+            sym::assume => (0, 0, vec![tcx.types.bool], tcx.types.unit),
+            sym::likely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
+            sym::unlikely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
 
             sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
             sym::write_via_move => {
                 (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
             }
 
-            sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
+            sym::typed_swap => (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
 
             sym::discriminant_value => {
                 let assoc_items = tcx.associated_item_def_ids(
@@ -566,9 +566,9 @@ pub fn check_intrinsic_type(
 
             sym::black_box => (1, 0, vec![param(0)], param(0)),
 
-            sym::is_val_statically_known => (1, 1, vec![param(0)], tcx.types.bool),
+            sym::is_val_statically_known => (1, 0, vec![param(0)], tcx.types.bool),
 
-            sym::const_eval_select => (4, 1, vec![param(0), param(1), param(2)], param(3)),
+            sym::const_eval_select => (4, 0, vec![param(0), param(1), param(2)], param(3)),
 
             sym::vtable_size | sym::vtable_align => {
                 (0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
@@ -576,10 +576,10 @@ pub fn check_intrinsic_type(
 
             // This type check is not particularly useful, but the `where` bounds
             // on the definition in `core` do the heavy lifting for checking it.
-            sym::aggregate_raw_ptr => (3, 1, vec![param(1), param(2)], param(0)),
-            sym::ptr_metadata => (2, 1, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
+            sym::aggregate_raw_ptr => (3, 0, vec![param(1), param(2)], param(0)),
+            sym::ptr_metadata => (2, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
 
-            sym::ub_checks => (0, 1, Vec::new(), tcx.types.bool),
+            sym::ub_checks => (0, 0, Vec::new(), tcx.types.bool),
 
             sym::simd_eq
             | sym::simd_ne
diff --git a/library/core/src/ffi/c_str.rs b/library/core/src/ffi/c_str.rs
index fbc0c7232c4..d2a408485d1 100644
--- a/library/core/src/ffi/c_str.rs
+++ b/library/core/src/ffi/c_str.rs
@@ -517,7 +517,8 @@ impl CStr {
     const fn as_non_null_ptr(&self) -> NonNull<c_char> {
         // FIXME(effects) replace with `NonNull::from`
         // SAFETY: a reference is never null
-        unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }.as_non_null_ptr()
+        unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }
+            .as_non_null_ptr()
     }
 
     /// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator.
diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs
index 51452e3b7b0..2d0b8825f43 100644
--- a/library/core/src/lib.rs
+++ b/library/core/src/lib.rs
@@ -200,6 +200,7 @@
 // Language features:
 // tidy-alphabetical-start
 #![cfg_attr(bootstrap, feature(c_unwind))]
+#![cfg_attr(bootstrap, feature(effects))]
 #![feature(abi_unadjusted)]
 #![feature(adt_const_params)]
 #![feature(allow_internal_unsafe)]