diff options
| author | bors <bors@rust-lang.org> | 2017-03-09 08:26:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-03-09 08:26:17 +0000 |
| commit | 3087a1f39eaeac9d76c8b159dcc64de515bb2b83 (patch) | |
| tree | bace37e5277d56098ee4d1bb0727d930d68b650c /src/libcore | |
| parent | 5c9208faf1f180cd15cf93f74f1e57b24856d11e (diff) | |
| parent | f2886e8bda7d628ae0cc16e4fe579cbc2c6dc1b0 (diff) | |
| download | rust-3087a1f39eaeac9d76c8b159dcc64de515bb2b83.tar.gz rust-3087a1f39eaeac9d76c8b159dcc64de515bb2b83.zip | |
Auto merge of #40368 - arielb1:rollup, r=arielb1
Rollup of 20 pull requests - Successful merges: #40154, #40222, #40226, #40237, #40254, #40258, #40265, #40268, #40279, #40283, #40292, #40293, #40296, #40316, #40321, #40325, #40326, #40327, #40333, #40335 - Failed merges:
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/macros.rs | 23 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 4 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 66a923f8e58..b22f7fa1707 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -32,11 +32,11 @@ macro_rules! panic { /// Ensure that a boolean expression is `true` at runtime. /// -/// This will invoke the `panic!` macro if the provided expression cannot be +/// This will invoke the [`panic!`] macro if the provided expression cannot be /// evaluated to `true` at runtime. /// /// Assertions are always checked in both debug and release builds, and cannot -/// be disabled. See `debug_assert!` for assertions that are not enabled in +/// be disabled. See [`debug_assert!`] for assertions that are not enabled in /// release builds by default. /// /// Unsafe code relies on `assert!` to enforce run-time invariants that, if @@ -48,6 +48,8 @@ macro_rules! panic { /// This macro has a second version, where a custom panic message can /// be provided with or without arguments for formatting. /// +/// [`panic!`]: macro.panic.html +/// [`debug_assert!`]: macro.debug_assert.html /// [testing]: ../book/testing.html /// /// # Examples @@ -88,9 +90,11 @@ macro_rules! assert { /// On panic, this macro will print the values of the expressions with their /// debug representations. /// -/// Like `assert!()`, this macro has a second version, where a custom +/// Like [`assert!()`], this macro has a second version, where a custom /// panic message can be provided. /// +/// [`assert!()`]: macro.assert.html +/// /// # Examples /// /// ``` @@ -134,6 +138,8 @@ macro_rules! assert_eq { /// Like `assert!()`, this macro has a second version, where a custom /// panic message can be provided. /// +/// [`assert!`]: macro.assert.html +/// /// # Examples /// /// ``` @@ -171,13 +177,13 @@ macro_rules! assert_ne { /// Ensure that a boolean expression is `true` at runtime. /// -/// This will invoke the `panic!` macro if the provided expression cannot be +/// This will invoke the [`panic!`] macro if the provided expression cannot be /// evaluated to `true` at runtime. /// -/// Like `assert!`, this macro also has a second version, where a custom panic +/// Like [`assert!`], this macro also has a second version, where a custom panic /// message can be provided. /// -/// Unlike `assert!`, `debug_assert!` statements are only enabled in non +/// Unlike [`assert!`], `debug_assert!` statements are only enabled in non /// optimized builds by default. An optimized build will omit all /// `debug_assert!` statements unless `-C debug-assertions` is passed to the /// compiler. This makes `debug_assert!` useful for checks that are too @@ -187,10 +193,13 @@ macro_rules! assert_ne { /// An unchecked assertion allows a program in an inconsistent state to keep /// running, which might have unexpected consequences but does not introduce /// unsafety as long as this only happens in safe code. The performance cost -/// of assertions, is however, not measurable in general. Replacing `assert!` +/// of assertions, is however, not measurable in general. Replacing [`assert!`] /// with `debug_assert!` is thus only encouraged after thorough profiling, and /// more importantly, only in safe code! /// +/// [`panic!`]: macro.panic.html +/// [`assert!`]: macro.assert.html +/// /// # Examples /// /// ``` diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 02851c224e2..260fdab9d58 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -191,6 +191,10 @@ pub unsafe fn read_unaligned<T>(src: *const T) -> T { /// allocations or resources, so care must be taken not to overwrite an object /// that should be dropped. /// +/// It does not immediately drop the contents of `src` either; it is rather +/// *moved* into the memory location `dst` and will be dropped whenever that +/// location goes out of scope. +/// /// This is appropriate for initializing uninitialized memory, or overwriting /// memory that has previously been `read` from. /// |
