Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebbce69

Browse files
authored
Rollup merge ofrust-lang#126288 - x4exr:patch-1, r=dtolnay
doc: Added commas where needed<!--If this PR is related to an unstable feature or an otherwise tracked effort,please link to the relevant tracking issue here. If you don't know of a relatedtracking issue or there are none, feel free to ignore this.This PR will get automatically assigned to a reviewer. In case you would likea specific user to review your work, you can assign it to them by using r​? <reviewer name>-->
2 parents89b5784 +7912329 commitebbce69

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎core/src/ptr/mod.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
//! pointer. For code which *does* cast a usize to a pointer, the scope of the change depends
238238
//! on exactly what you're doing.
239239
//!
240-
//! In general you just need to make sure that if you want to convert a usize address to a
240+
//! In general, you just need to make sure that if you want to convert a usize address to a
241241
//! pointer and then use that pointer to read/write memory, you need to keep around a pointer
242242
//! that has sufficient provenance to perform that read/write itself. In this way all of your
243243
//! casts from an address to a pointer are essentially just applying offsets/indexing.
@@ -309,7 +309,7 @@
309309
//! i.e. the usual "ZSTs are fake, do what you want" rules apply *but* this only applies
310310
//! for actual forgery (integers cast to pointers). If you borrow some struct's field
311311
//! that *happens* to be zero-sized, the resulting pointer will have provenance tied to
312-
//! that allocation and it will still get invalidated if the allocation gets deallocated.
312+
//! that allocation, and it will still get invalidated if the allocation gets deallocated.
313313
//! In the future we may introduce an API to make such a forged allocation explicit.
314314
//!
315315
//! * [`wrapping_offset`][] a pointer outside its provenance. This includes pointers
@@ -698,7 +698,7 @@ pub const fn dangling_mut<T>() -> *mut T {
698698
///
699699
/// If there is no 'exposed' provenance that justifies the way this pointer will be used,
700700
/// the program has undefined behavior. In particular, the aliasing rules still apply: pointers
701-
/// and references that have been invalidated due to aliasing accesses cannot be usedany more,
701+
/// and references that have been invalidated due to aliasing accesses cannot be usedanymore,
702702
/// even if they have been exposed!
703703
///
704704
/// Note that there is no algorithm that decides which provenance will be used. You can think of this
@@ -1097,7 +1097,7 @@ const unsafe fn swap_nonoverlapping_simple_untyped<T>(x: *mut T, y: *mut T, coun
10971097
// If we end up here, it's because we're using a simple type -- like
10981098
// a small power-of-two-sized thing -- or a special type with particularly
10991099
// large alignment, particularly SIMD types.
1100-
// Thus we're fine just reading-and-writing it, as either it's small
1100+
// Thus, we're fine just reading-and-writing it, as either it's small
11011101
// and that works well anyway or it's special and the type's author
11021102
// presumably wanted things to be done in the larger chunk.
11031103

@@ -1290,7 +1290,7 @@ pub const unsafe fn read<T>(src: *const T) -> T {
12901290
// provides enough information to know that this is a typed operation.
12911291

12921292
// However, as of March 2023 the compiler was not capable of taking advantage
1293-
// of that information.Thus the implementation here switched to an intrinsic,
1293+
// of that information. Thus, the implementation here switched to an intrinsic,
12941294
// which lowers to `_0 = *src` in MIR, to address a few issues:
12951295
//
12961296
// - Using `MaybeUninit::assume_init` after a `copy_nonoverlapping` was not
@@ -1570,7 +1570,7 @@ pub const unsafe fn write<T>(dst: *mut T, src: T) {
15701570
/// As a result, using `&packed.unaligned as *const FieldType` causes immediate
15711571
/// *undefined behavior* in your program.
15721572
///
1573-
/// Instead you must use the [`ptr::addr_of_mut!`](addr_of_mut)
1573+
/// Instead, you must use the [`ptr::addr_of_mut!`](addr_of_mut)
15741574
/// macro to create the pointer. You may use that returned pointer together with
15751575
/// this function.
15761576
///

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp