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

Appearance settings

Commit bb2d0ea

Browse filesBrowse files
committed
Auto merge of #58656 - Mark-Simulacrum:beta-rollups, r=pietroalbini
Beta rollups - #58649 - #58592 - #58574 - #58227 - #58056 - #57859 - #57710 A few of these are via #58641. r? @pietroalbini
2 parents 1f84156 + 5c6eb4e commit bb2d0ea
Copy full SHA for bb2d0ea

File tree

Expand file treeCollapse file tree

93 files changed

+1839
-447
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

93 files changed

+1839
-447
lines changed

‎RELEASES.md

Copy file name to clipboardExpand all lines: RELEASES.md
+148Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,151 @@
1+
Version 1.33.0 (2019-02-28)
2+
==========================
3+
4+
Language
5+
--------
6+
- [You can now use the `cfg(target_vendor)` attribute.][57465] E.g.
7+
`#[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); }`
8+
- [Integer patterns such as in a match expression can now be exhaustive.][56362]
9+
E.g. You can have match statement on a `u8` that covers `0..=255` and
10+
you would no longer be required to have a `_ => unreachable!()` case.
11+
- [You can now have multiple patterns in `if let` and `while let`
12+
expressions.][57532] You can do this with the same syntax as a `match`
13+
expression. E.g.
14+
```rust
15+
enum Creature {
16+
Crab(String),
17+
Lobster(String),
18+
Person(String),
19+
}
20+
21+
fn main() {
22+
let state = Creature::Crab("Ferris");
23+
24+
if let Creature::Crab(name) | Creature::Person(name) = state {
25+
println!("This creature's name is: {}", name);
26+
}
27+
}
28+
```
29+
- [You can now have irrefutable `if let` and `while let` patterns.][57535] Using
30+
this feature will by default produce a warning as this behaviour can be
31+
unintuitive. E.g. `if let _ = 5 {}`
32+
- [You can now use `let` bindings, assignments, expression statements,
33+
and irrefutable pattern destructuring in const functions.][57175]
34+
- [You can now call unsafe const functions.][57067] E.g.
35+
```rust
36+
const unsafe fn foo() -> i32 { 5 }
37+
const fn bar() -> i32 {
38+
unsafe { foo() }
39+
}
40+
```
41+
- [You can now specify multiple attributes in a `cfg_attr` attribute.][57332]
42+
E.g. `#[cfg_attr(all(), must_use, optimize)]`
43+
- [You can now specify a specific alignment with the `#[repr(packed)]`
44+
attribute.][57049] E.g. `#[repr(packed(2))] struct Foo(i16, i32);` is a struct
45+
with an alignment of 2 bytes and a size of 6 bytes.
46+
- [You can now import an item from a module as an `_`.][56303] This allows you to
47+
import a trait's impls, and not have the name in the namespace. E.g.
48+
```rust
49+
use std::io::Read as _;
50+
51+
// Allowed as there is only one `Read` in the module.
52+
pub trait Read {}
53+
```
54+
- [`extern` functions will now abort by default when panicking.][55982]
55+
This was previously undefined behaviour.
56+
57+
Compiler
58+
--------
59+
- [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
60+
command line argument.][56351]
61+
- [The mininum required LLVM version has been bumped to 6.0.][56642]
62+
- [Added support for the PowerPC64 architecture on FreeBSD.][57615]
63+
- [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
64+
tier 2 support.][57130] Visit the [platform support][platform-support] page for
65+
information on Rust's platform support.
66+
- [Added support for the `thumbv7neon-linux-androideabi` and
67+
`thumbv7neon-unknown-linux-gnueabihf` targets.][56947]
68+
- [Added support for the `x86_64-unknown-uefi` target.][56769]
69+
70+
Libraries
71+
---------
72+
- [The methods `overflowing_{add, sub, mul, shl, shr}` are now `const`
73+
functions for all numeric types.][57566]
74+
- [The methods `rotate_left`, `rotate_right`, and `wrapping_{add, sub, mul, shl, shr}`
75+
are now `const` functions for all numeric types.][57105]
76+
- [The methods `is_positive` and `is_negative` are now `const` functions for
77+
all signed numeric types.][57105]
78+
- [The `get` method for all `NonZero` types is now `const`.][57167]
79+
- [The methods `count_ones`, `count_zeros`, `leading_zeros`, `trailing_zeros`,
80+
`swap_bytes`, `from_be`, `from_le`, `to_be`, `to_le` are now `const` for all
81+
numeric types.][57234]
82+
- [`Ipv4Addr::new` is now a `const` function][57234]
83+
84+
Stabilized APIs
85+
---------------
86+
- [`unix::FileExt::read_exact_at`]
87+
- [`unix::FileExt::write_all_at`]
88+
- [`Option::transpose`]
89+
- [`Result::transpose`]
90+
- [`convert::identity`]
91+
- [`pin::Pin`]
92+
- [`marker::Unpin`]
93+
- [`marker::PhantomPinned`]
94+
- [`Vec::resize_with`]
95+
- [`VecDeque::resize_with`]
96+
- [`Duration::as_millis`]
97+
- [`Duration::as_micros`]
98+
- [`Duration::as_nanos`]
99+
100+
101+
Cargo
102+
-----
103+
- [Cargo should now rebuild a crate if a file was modified during the initial
104+
build.][cargo/6484]
105+
106+
Compatibility Notes
107+
-------------------
108+
- The methods `str::{trim_left, trim_right, trim_left_matches, trim_right_matches}`
109+
are now deprecated in the standard library, and their usage will now produce a warning.
110+
Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}`
111+
methods instead.
112+
113+
[57615]: https://github.com/rust-lang/rust/pull/57615/
114+
[57465]: https://github.com/rust-lang/rust/pull/57465/
115+
[57532]: https://github.com/rust-lang/rust/pull/57532/
116+
[57535]: https://github.com/rust-lang/rust/pull/57535/
117+
[57566]: https://github.com/rust-lang/rust/pull/57566/
118+
[57130]: https://github.com/rust-lang/rust/pull/57130/
119+
[57167]: https://github.com/rust-lang/rust/pull/57167/
120+
[57175]: https://github.com/rust-lang/rust/pull/57175/
121+
[57234]: https://github.com/rust-lang/rust/pull/57234/
122+
[57332]: https://github.com/rust-lang/rust/pull/57332/
123+
[56947]: https://github.com/rust-lang/rust/pull/56947/
124+
[57049]: https://github.com/rust-lang/rust/pull/57049/
125+
[57067]: https://github.com/rust-lang/rust/pull/57067/
126+
[56769]: https://github.com/rust-lang/rust/pull/56769/
127+
[56642]: https://github.com/rust-lang/rust/pull/56642/
128+
[56303]: https://github.com/rust-lang/rust/pull/56303/
129+
[56351]: https://github.com/rust-lang/rust/pull/56351/
130+
[55982]: https://github.com/rust-lang/rust/pull/55982/
131+
[56362]: https://github.com/rust-lang/rust/pull/56362
132+
[57105]: https://github.com/rust-lang/rust/pull/57105
133+
[cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/
134+
[`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at
135+
[`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at
136+
[`Option::transpose`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.transpose
137+
[`Result::transpose`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
138+
[`convert::identity`]: https://doc.rust-lang.org/std/convert/fn.identity.html
139+
[`pin::Pin`]: https://doc.rust-lang.org/std/pin/struct.Pin.html
140+
[`marker::Unpin`]: https://doc.rust-lang.org/stable/std/marker/trait.Unpin.html
141+
[`marker::PhantomPinned`]: https://doc.rust-lang.org/nightly/std/marker/struct.PhantomPinned.html
142+
[`Vec::resize_with`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.resize_with
143+
[`VecDeque::resize_with`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.resize_with
144+
[`Duration::as_millis`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_millis
145+
[`Duration::as_micros`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_micros
146+
[`Duration::as_nanos`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_nanos
147+
[platform-support]: https://forge.rust-lang.org/platform-support.html
148+
1149
Version 1.32.0 (2019-01-17)
2150
==========================
3151

‎src/libcore/marker.rs

Copy file name to clipboardExpand all lines: src/libcore/marker.rs
+18-9Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -597,34 +597,43 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
597597

598598
/// Types which can be safely moved after being pinned.
599599
///
600-
/// Since Rust itself has no notion of immovable types, and will consider moves to always be safe,
600+
/// Since Rust itself has no notion of immovable types, and considers moves
601+
/// (e.g. through assignment or [`mem::replace`]) to always be safe,
601602
/// this trait cannot prevent types from moving by itself.
602603
///
603-
/// Instead it can be used to prevent moves through the type system,
604-
/// by controlling the behavior of pointers wrapped in the [`Pin`] wrapper,
604+
/// Instead it is used to prevent moves through the type system,
605+
/// by controlling the behavior of pointers `P` wrapped in the [`Pin<P>`] wrapper,
605606
/// which "pin" the type in place by not allowing it to be moved out of them.
606607
/// See the [`pin module`] documentation for more information on pinning.
607608
///
608609
/// Implementing this trait lifts the restrictions of pinning off a type,
609-
/// which then allows it to move out with functions such as [`replace`].
610+
/// which then allows it to move out with functions such as [`mem::replace`].
611+
///
612+
/// `Unpin` has no consequence at all for non-pinned data. In particular,
613+
/// [`mem::replace`] happily moves `!Unpin` data (it works for any `&mut T`, not
614+
/// just when `T: Unpin`). However, you cannot use
615+
/// [`mem::replace`] on data wrapped inside a [`Pin<P>`] because you cannot get the
616+
/// `&mut T` you need for that, and *that* is what makes this system work.
610617
///
611618
/// So this, for example, can only be done on types implementing `Unpin`:
612619
///
613620
/// ```rust
614-
/// use std::mem::replace;
621+
/// use std::mem;
615622
/// use std::pin::Pin;
616623
///
617624
/// let mut string = "this".to_string();
618625
/// let mut pinned_string = Pin::new(&mut string);
619626
///
620-
/// // dereferencing the pointer mutably is only possible because String implements Unpin
621-
/// replace(&mut *pinned_string, "other".to_string());
627+
/// // We need a mutable reference to call `mem::replace`.
628+
/// // We can obtain such a reference by (implicitly) invoking `Pin::deref_mut`,
629+
/// // but that is only possible because `String` implements `Unpin`.
630+
/// mem::replace(&mut *pinned_string, "other".to_string());
622631
/// ```
623632
///
624633
/// This trait is automatically implemented for almost every type.
625634
///
626-
/// [`replace`]: ../../std/mem/fn.replace.html
627-
/// [`Pin`]: ../pin/struct.Pin.html
635+
/// [`mem::replace`]: ../../std/mem/fn.replace.html
636+
/// [`Pin<P>`]: ../pin/struct.Pin.html
628637
/// [`pin module`]: ../../std/pin/index.html
629638
#[stable(feature = "pin", since = "1.33.0")]
630639
pub auto trait Unpin {}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.