Skip to content

Commit 02aaea1

Browse files
committed
update intrinsic const param counting
1 parent 3b14b75 commit 02aaea1

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

compiler/rustc_hir_analysis/src/check/intrinsic.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -429,17 +429,17 @@ pub fn check_intrinsic_type(
429429

430430
sym::ptr_guaranteed_cmp => (
431431
1,
432-
1,
432+
0,
433433
vec![Ty::new_imm_ptr(tcx, param(0)), Ty::new_imm_ptr(tcx, param(0))],
434434
tcx.types.u8,
435435
),
436436

437437
sym::const_allocate => {
438-
(0, 1, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
438+
(0, 0, vec![tcx.types.usize, tcx.types.usize], Ty::new_mut_ptr(tcx, tcx.types.u8))
439439
}
440440
sym::const_deallocate => (
441441
0,
442-
1,
442+
0,
443443
vec![Ty::new_mut_ptr(tcx, tcx.types.u8), tcx.types.usize, tcx.types.usize],
444444
tcx.types.unit,
445445
),
@@ -478,16 +478,16 @@ pub fn check_intrinsic_type(
478478
| sym::frem_algebraic => (1, 0, vec![param(0), param(0)], param(0)),
479479
sym::float_to_int_unchecked => (2, 0, vec![param(0)], param(1)),
480480

481-
sym::assume => (0, 1, vec![tcx.types.bool], tcx.types.unit),
482-
sym::likely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
483-
sym::unlikely => (0, 1, vec![tcx.types.bool], tcx.types.bool),
481+
sym::assume => (0, 0, vec![tcx.types.bool], tcx.types.unit),
482+
sym::likely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
483+
sym::unlikely => (0, 0, vec![tcx.types.bool], tcx.types.bool),
484484

485485
sym::read_via_copy => (1, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(0)),
486486
sym::write_via_move => {
487487
(1, 0, vec![Ty::new_mut_ptr(tcx, param(0)), param(0)], tcx.types.unit)
488488
}
489489

490-
sym::typed_swap => (1, 1, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
490+
sym::typed_swap => (1, 0, vec![Ty::new_mut_ptr(tcx, param(0)); 2], tcx.types.unit),
491491

492492
sym::discriminant_value => {
493493
let assoc_items = tcx.associated_item_def_ids(
@@ -566,20 +566,20 @@ pub fn check_intrinsic_type(
566566

567567
sym::black_box => (1, 0, vec![param(0)], param(0)),
568568

569-
sym::is_val_statically_known => (1, 1, vec![param(0)], tcx.types.bool),
569+
sym::is_val_statically_known => (1, 0, vec![param(0)], tcx.types.bool),
570570

571-
sym::const_eval_select => (4, 1, vec![param(0), param(1), param(2)], param(3)),
571+
sym::const_eval_select => (4, 0, vec![param(0), param(1), param(2)], param(3)),
572572

573573
sym::vtable_size | sym::vtable_align => {
574574
(0, 0, vec![Ty::new_imm_ptr(tcx, tcx.types.unit)], tcx.types.usize)
575575
}
576576

577577
// This type check is not particularly useful, but the `where` bounds
578578
// on the definition in `core` do the heavy lifting for checking it.
579-
sym::aggregate_raw_ptr => (3, 1, vec![param(1), param(2)], param(0)),
580-
sym::ptr_metadata => (2, 1, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
579+
sym::aggregate_raw_ptr => (3, 0, vec![param(1), param(2)], param(0)),
580+
sym::ptr_metadata => (2, 0, vec![Ty::new_imm_ptr(tcx, param(0))], param(1)),
581581

582-
sym::ub_checks => (0, 1, Vec::new(), tcx.types.bool),
582+
sym::ub_checks => (0, 0, Vec::new(), tcx.types.bool),
583583

584584
sym::simd_eq
585585
| sym::simd_ne

library/core/src/ffi/c_str.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ impl CStr {
517517
const fn as_non_null_ptr(&self) -> NonNull<c_char> {
518518
// FIXME(effects) replace with `NonNull::from`
519519
// SAFETY: a reference is never null
520-
unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }.as_non_null_ptr()
520+
unsafe { NonNull::new_unchecked(&self.inner as *const [c_char] as *mut [c_char]) }
521+
.as_non_null_ptr()
521522
}
522523

523524
/// Returns the length of `self`. Like C's `strlen`, this does not include the nul terminator.

library/core/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
// Language features:
201201
// tidy-alphabetical-start
202202
#![cfg_attr(bootstrap, feature(c_unwind))]
203+
#![cfg_attr(bootstrap, feature(effects))]
203204
#![feature(abi_unadjusted)]
204205
#![feature(adt_const_params)]
205206
#![feature(allow_internal_unsafe)]

0 commit comments

Comments
 (0)