Skip to content

Commit 73da4e3

Browse files
committed
tweaks to comments
1 parent 9e64ee5 commit 73da4e3

3 files changed

Lines changed: 10 additions & 14 deletions

File tree

compiler/rustc_const_eval/src/interpret/intrinsics.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ enum VarArgCompatible {
6363
/// `T` and `U` are compatible, e.g.
6464
///
6565
/// - They're the same type.
66-
/// - One is `usize`/`isize`, the other same-sized fixed-width integer on that target.
67-
/// - They are compatible pointer types.
66+
/// - One is `usize`/`isize`, the other an integer type of the same width
67+
/// and sign on the current target.
68+
/// - They are compatible pointer types (see the exact rules below).
6869
Compatible,
6970
/// `T` and `U` are definitely not compatible.
7071
Incompatible,
@@ -838,11 +839,10 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
838839
/// Types `T` and `U` are compatible when:
839840
///
840841
/// - `T` and `U` are the same type.
841-
/// - `T` is a signed integer and `U` the corresponding unsigned integer,
842-
/// - `T` is an unsigned integer and `U` the corresponding signed integer,
842+
/// - `T` and `U` are integer types of the same size. When the sign is different a further check
843+
/// is needed on the passed value, but that is not done here.
843844
/// - `T` and `U` are both pointers, and their target types are compatible.
844-
/// - `T` is a pointer to `c_void` and `U` is a pointer to `i8` or `u8` (i.e., any "character type").
845-
/// - `T` is a pointer to `i8` or `u8` and `U` is a pointer to `c_void`.
845+
/// - `T` is a pointer to [`c_void`] and `U` is a pointer to [`i8]` or [`u8`], or vice versa.
846846
fn validate_c_variadic_compatible_ty(
847847
&mut self,
848848
caller_type: Ty<'tcx>,

library/core/src/ffi/va_list.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,10 @@ impl<'f> VaList<'f> {
399399
/// Types `T` and `U` are compatible when:
400400
///
401401
/// - `T` and `U` are the same type.
402-
/// - `T` is a signed integer and `U` the corresponding unsigned integer,
403-
/// - `T` is an unsigned integer and `U` the corresponding signed integer,
402+
/// - `T` and `U` are integer types of the same size. The value that the caller passes
403+
/// must be representable by `T` and `U`.
404404
/// - `T` and `U` are both pointers, and their target types are compatible.
405-
/// - `T` is a pointer to [`c_void`] and `U` is a pointer to [`i8]` or [`u8`].
406-
/// - `T` is a pointer to [`i8]` or [`u8`] and `U` is a pointer to [`c_void`].
407-
///
408-
/// When `T` and `U` are both integer types, the value that the caller passes must be
409-
/// representable by `T` and `U`.
405+
/// - `T` is a pointer to [`c_void`] and `U` is a pointer to [`i8]` or [`u8`], or vice versa.
410406
///
411407
/// [`c_void`]: core::ffi::c_void
412408
#[inline] // Avoid codegen when not used to help backends that don't support VaList.

src/llvm-project

Submodule llvm-project updated 132 files

0 commit comments

Comments
 (0)