Skip to content

Commit 7d9427e

Browse files
committed
Rollup merge of rust-lang#26146 - steveklabnik:remove_unsafe_pointer, r=Gankro
Using two terms for one thing is confusing, these are called 'raw pointers' today.
2 parents ef089ff + 2c75256 commit 7d9427e

File tree

22 files changed

+33
-33
lines changed

22 files changed

+33
-33
lines changed

src/doc/trpl/ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ However it is often desired that the callback is targeted to a special
238238
Rust object. This could be the object that represents the wrapper for the
239239
respective C object.
240240
241-
This can be achieved by passing an unsafe pointer to the object down to the
241+
This can be achieved by passing an raw pointer to the object down to the
242242
C library. The C library can then include the pointer to the Rust object in
243243
the notification. This will allow the callback to unsafely access the
244244
referenced Rust object.
@@ -370,7 +370,7 @@ On OSX, frameworks behave with the same semantics as a dynamic library.
370370
371371
# Unsafe blocks
372372
373-
Some operations, like dereferencing unsafe pointers or calling functions that have been marked
373+
Some operations, like dereferencing raw pointers or calling functions that have been marked
374374
unsafe are only allowed inside unsafe blocks. Unsafe blocks isolate unsafety and are a promise to
375375
the compiler that the unsafety does not leak out of the block.
376376

src/doc/trpl/raw-pointers.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ println!("raw points at {}", *raw);
5252
It gives this error:
5353

5454
```text
55-
error: dereference of unsafe pointer requires unsafe function or block [E0133]
56-
println!("raw points at{}", *raw);
57-
^~~~
55+
error: dereference of raw pointer requires unsafe function or block [E0133]
56+
println!("raw points at {}", *raw);
57+
^~~~
5858
```
5959

6060
When you dereference a raw pointer, you’re taking responsibility that it’s not

src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<T> [T] {
370370
core_slice::SliceExt::get_unchecked_mut(self, index)
371371
}
372372

373-
/// Returns an unsafe pointer to the slice's buffer
373+
/// Returns an raw pointer to the slice's buffer
374374
///
375375
/// The caller must ensure that the slice outlives the pointer this
376376
/// function returns, or else it will end up pointing to garbage.

src/libcollections/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ impl str {
525525
core_str::StrExt::as_bytes(&self[..])
526526
}
527527

528-
/// Returns an unsafe pointer to the `&str`'s buffer.
528+
/// Returns a raw pointer to the `&str`'s buffer.
529529
///
530530
/// The caller must ensure that the string outlives this pointer, and
531531
/// that it is not

src/libcollections/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ impl<T: PartialEq> Vec<T> {
12151215
let ln = self.len();
12161216
if ln < 1 { return; }
12171217

1218-
// Avoid bounds checks by using unsafe pointers.
1218+
// Avoid bounds checks by using raw pointers.
12191219
let p = self.as_mut_ptr();
12201220
let mut r: usize = 1;
12211221
let mut w: usize = 1;

src/libcore/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use marker::Sized;
4646

4747
extern "rust-intrinsic" {
4848

49-
// NB: These intrinsics take unsafe pointers because they mutate aliased
49+
// NB: These intrinsics take raw pointers because they mutate aliased
5050
// memory, which is not valid for either `&` or `&mut`.
5151

5252
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> T;

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ macro_rules! impls{
357357
/// struct is dropped, it may in turn drop one or more instances of
358358
/// the type `T`, though that may not be apparent from the other
359359
/// structure of the type itself. This is commonly necessary if the
360-
/// structure is using an unsafe pointer like `*mut T` whose referent
360+
/// structure is using a raw pointer like `*mut T` whose referent
361361
/// may be dropped when the type is dropped, as a `*mut T` is
362362
/// otherwise not treated as owned.
363363
///

src/libcore/ptr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
// FIXME: talk about offset, copy_memory, copy_nonoverlapping_memory
1212

13-
//! Operations on unsafe pointers, `*const T`, and `*mut T`.
13+
//! Operations on raw pointers, `*const T`, and `*mut T`.
1414
//!
15-
//! Working with unsafe pointers in Rust is uncommon,
15+
//! Working with raw pointers in Rust is uncommon,
1616
//! typically limited to a few patterns.
1717
//!
1818
//! Use the `null` function to create null pointers, and the `is_null` method
1919
//! of the `*const T` type to check for null. The `*const T` type also defines
2020
//! the `offset` method, for pointer math.
2121
//!
22-
//! # Common ways to create unsafe pointers
22+
//! # Common ways to create raw pointers
2323
//!
2424
//! ## 1. Coerce a reference (`&T`) or mutable reference (`&mut T`).
2525
//!
@@ -86,7 +86,7 @@
8686
//!
8787
//! Usually you wouldn't literally use `malloc` and `free` from Rust,
8888
//! but C APIs hand out a lot of pointers generally, so are a common source
89-
//! of unsafe pointers in Rust.
89+
//! of raw pointers in Rust.
9090
9191
#![stable(feature = "rust1", since = "1.0.0")]
9292
#![doc(primitive = "pointer")]

src/librustc/middle/effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
162162
debug!("effect: unary case, base type is {}",
163163
ppaux::ty_to_string(self.tcx, base_type));
164164
if let ty::ty_ptr(_) = base_type.sty {
165-
self.require_unsafe(expr.span, "dereference of unsafe pointer")
165+
self.require_unsafe(expr.span, "dereference of raw pointer")
166166
}
167167
}
168168
ast::ExprAssign(ref base, _) | ast::ExprAssignOp(_, ref base, _) => {

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ impl<'tcx> cmt_<'tcx> {
15461546
format!("`Box` content")
15471547
}
15481548
UnsafePtr(..) => {
1549-
format!("dereference of unsafe pointer")
1549+
format!("dereference of raw pointer")
15501550
}
15511551
BorrowedPtr(..) => {
15521552
format!("borrowed content")

0 commit comments

Comments
 (0)