Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9cd61f0

Browse files
committedApr 14, 2019
Auto merge of #59967 - Centril:rollup-bdqq7ux, r=Centril
Rollup of 7 pull requests Successful merges: - #59856 (update polonius-engine) - #59877 (HirIdify hir::Def) - #59896 (Remove duplicated redundant spans) - #59900 (Remove [mut] syntax in pin docs) - #59906 (Make BufWriter use get_mut instead of manipulating inner in Write implementation) - #59936 (Fix cross-crate visibility of fictive variant constructors) - #59957 (Add missing backtick to Symbol documentation.) Failed merges: r? @ghost
2 parents d70c5a9 + c348bb6 commit 9cd61f0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+384
-148
lines changed
 

‎Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,7 +1906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
19061906

19071907
[[package]]
19081908
name = "polonius-engine"
1909-
version = "0.6.2"
1909+
version = "0.7.0"
19101910
source = "registry+https://github.com/rust-lang/crates.io-index"
19111911
dependencies = [
19121912
"datafrog 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2341,7 +2341,7 @@ dependencies = [
23412341
"measureme 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
23422342
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
23432343
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
2344-
"polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
2344+
"polonius-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
23452345
"rustc-rayon 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
23462346
"rustc-rayon-core 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
23472347
"rustc_apfloat 0.0.0",
@@ -2841,7 +2841,7 @@ dependencies = [
28412841
"graphviz 0.0.0",
28422842
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
28432843
"log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
2844-
"polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
2844+
"polonius-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
28452845
"rustc 0.0.0",
28462846
"rustc_apfloat 0.0.0",
28472847
"rustc_data_structures 0.0.0",
@@ -4164,7 +4164,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
41644164
"checksum phf_generator 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "05a079dd052e7b674d21cb31cbb6c05efd56a2cd2827db7692e2f1a507ebd998"
41654165
"checksum phf_shared 0.7.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c2261d544c2bb6aa3b10022b0be371b9c7c64f762ef28c6f5d4f1ef6d97b5930"
41664166
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
4167-
"checksum polonius-engine 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2490c396085801abf88df91758bad806b0890354f0875d624e62ecf0579a8145"
4167+
"checksum polonius-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b24942fee141ea45628484a453762bb7e515099c3ec05fbeb76b7bf57b1aeed"
41684168
"checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c"
41694169
"checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6"
41704170
"checksum pretty_env_logger 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df8b3f4e0475def7d9c2e5de8e5a1306949849761e107b360d03e98eafaffd61"

‎src/libcore/pin.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -158,28 +158,32 @@
158158
//! is called *even if your type was previously pinned*! It is as if the
159159
//! compiler automatically called `get_unchecked_mut`.
160160
//!
161-
//! This can never cause a problem in safe code because implementing a type that relies on pinning
162-
//! requires unsafe code, but be aware that deciding to make use of pinning
163-
//! in your type (for example by implementing some operation on `Pin<&[mut] Self>`)
164-
//! has consequences for your `Drop` implementation as well: if an element
165-
//! of your type could have been pinned, you must treat Drop as implicitly taking
166-
//! `Pin<&mut Self>`.
161+
//! This can never cause a problem in safe code because implementing a type that
162+
//! relies on pinning requires unsafe code, but be aware that deciding to make
163+
//! use of pinning in your type (for example by implementing some operation on
164+
//! `Pin<&Self>` or `Pin<&mut Self>`) has consequences for your `Drop`
165+
//! implementation as well: if an element of your type could have been pinned,
166+
//! you must treat Drop as implicitly taking `Pin<&mut Self>`.
167167
//!
168168
//! In particular, if your type is `#[repr(packed)]`, the compiler will automatically
169169
//! move fields around to be able to drop them. As a consequence, you cannot use
170170
//! pinning with a `#[repr(packed)]` type.
171171
//!
172172
//! # Projections and Structural Pinning
173173
//!
174-
//! One interesting question arises when considering the interaction of pinning and
175-
//! the fields of a struct. When can a struct have a "pinning projection", i.e.,
176-
//! an operation with type `fn(Pin<&[mut] Struct>) -> Pin<&[mut] Field>`?
177-
//! In a similar vein, when can a generic wrapper type (such as `Vec<T>`, `Box<T>`, or `RefCell<T>`)
178-
//! have an operation with type `fn(Pin<&[mut] Wrapper<T>>) -> Pin<&[mut] T>`?
174+
//! One interesting question arises when considering the interaction of pinning
175+
//! and the fields of a struct. When can a struct have a "pinning projection",
176+
//! i.e., an operation with type `fn(Pin<&Struct>) -> Pin<&Field>`? In a
177+
//! similar vein, when can a generic wrapper type (such as `Vec<T>`, `Box<T>`,
178+
//! or `RefCell<T>`) have an operation with type `fn(Pin<&Wrapper<T>>) ->
179+
//! Pin<&T>`?
180+
//!
181+
//! Note: For the entirety of this discussion, the same applies for mutable references as it
182+
//! does for shared references.
179183
//!
180184
//! Having a pinning projection for some field means that pinning is "structural":
181185
//! when the wrapper is pinned, the field must be considered pinned, too.
182-
//! After all, the pinning projection lets us get a `Pin<&[mut] Field>`.
186+
//! After all, the pinning projection lets us get a `Pin<&Field>`.
183187
//!
184188
//! However, structural pinning comes with a few extra requirements, so not all
185189
//! wrappers can be structural and hence not all wrappers can offer pinning projections:

0 commit comments

Comments
 (0)
Please sign in to comment.