File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,12 +190,9 @@ impl Clone for VaList<'_> {
190190 #[ inline]
191191 fn clone ( & self ) -> Self {
192192 // We only implement Clone and not Copy because some future target might not be able to
193- // implement Copy (e.g. because it allocates).
194-
195- // We still use a `va_copy` intrinsic to provide a hook for const evaluation. The hook is
196- // used to report UB when a variable argument list is duplicated with a manual `memcpy`.
197- // While that works in practice for all current targets, we want to be able to support
198- // targets in the future where that is not the case.
193+ // implement Copy (e.g. because it allocates). For the same reason we use an intrinsic
194+ // to do the copying: the fact that on all current targets, this is just `memcpy`, is an implementation
195+ // detail. The intrinsic lets Miri catch UB from code incorrectly relying on that implementation detail.
199196 va_copy ( self )
200197 }
201198}
Original file line number Diff line number Diff line change @@ -3473,7 +3473,7 @@ pub unsafe fn va_arg<T: VaArgSafe>(ap: &mut VaList<'_>) -> T;
34733473#[ rustc_intrinsic]
34743474#[ rustc_nounwind]
34753475pub fn va_copy<' f>( src: & VaList <' f>) -> VaList <' f> {
3476- // NOTE: this intrinsic exists only as a hook for constant evaluation, and is used to detect UB
3476+ // NOTE: this intrinsic exists only as a hook for Miri and constant evaluation, and is used to detect UB
34773477 // when `VaList` is used incorrectly. Codegen backends should not have custom behavior for this
34783478 // intrinsic, they should always use this fallback implementation.
34793479 src. duplicate ( )
You can’t perform that action at this time.
0 commit comments