Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 16 pull requests #58669

Merged
merged 65 commits into from
Feb 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
eb5b096
RangeInclusive internal iteration performance improvement.
matthieu-m Feb 3, 2019
a15916b
[WIP] add better error message for partial move
clintfred Feb 5, 2019
50be479
Updated RELEASES.md for 1.33.0
Feb 6, 2019
d4c52bf
error output updated by ./x.py test --stage 1 src/test/ui --increment…
clintfred Feb 6, 2019
6c71e7d
Update RELEASES.md
Aaronepower Feb 7, 2019
fb3ae57
Update RELEASES.md
mark-i-m Feb 9, 2019
4fed67f
Fix exhaustion of inclusive range try_fold and try_rfold
matthieu-m Feb 9, 2019
73921f6
Update RELEASES.md
Centril Feb 12, 2019
8a026f1
Update RELEASES.md
Centril Feb 12, 2019
4c0a3d5
Update RELEASES.md
Centril Feb 12, 2019
ee3371e
Update RELEASES.md
Centril Feb 12, 2019
4e5eda3
compute is_partial_move outside of the move_site loop for clarity
clintfred Feb 13, 2019
a496450
Update RELEASES.md
Centril Feb 13, 2019
96fd218
check if `used_place` and `moved_place` are equal when determining if…
clintfred Feb 13, 2019
755b320
simplified conditional
clintfred Feb 13, 2019
283ffcf
Check the self-type of inherent associated constants
matthewjasper Feb 11, 2019
347a42e
SGX target: fix panic = abort
Feb 14, 2019
c34aac7
help suggestion when trying to delimit string literals with directed …
pmccarter Feb 17, 2019
71cd4c8
ui test for directed quote help suggestion #58436
pmccarter Feb 17, 2019
d26bf74
Change `Token::interpolated_to_tokenstream()`.
nnethercote Feb 14, 2019
f8801f3
Remove `LazyTokenStream`.
nnethercote Feb 14, 2019
f0d8fbd
Avoid a `clone()` in `transcribe()`.
nnethercote Feb 15, 2019
82ad4f1
Make `interpolated_to_tokenstream` a method on `Nonterminal`.
nnethercote Feb 17, 2019
895a794
Remove some unnecessary `into()` calls.
nnethercote Feb 17, 2019
de05548
re-blessing error output: ./x.py test src/test/ui --stage 1 --bless
clintfred Feb 18, 2019
8e219e7
Turn duration consts into associated consts
Feb 20, 2019
2621564
Update RELEASES.md
Aaronepower Feb 20, 2019
d072510
Update RELEASES.md
Aaronepower Feb 20, 2019
02fe6a7
./x.py test src/test/ui --stage 1 --bless -i --compare-mode=nll
clintfred Feb 20, 2019
f223c03
Add examples for duration constants
Feb 20, 2019
36f18f2
Allow Self::Module to be mutated.
gabi-250 Feb 20, 2019
42d749c
Update RELEASES.md
tspiteri Feb 20, 2019
c6d24cd
Enable feature duration_constants in examples
Feb 21, 2019
8060eb4
Update RELEASES.md
Aaronepower Feb 21, 2019
0ab2aed
Update RELEASES.md
Aaronepower Feb 21, 2019
e5d1fa5
codegen and write_metadata can mutate ModuleLLvm.
gabi-250 Feb 21, 2019
9f58c5f
Optimise vec![false; N] to zero-alloc
RReverser Feb 21, 2019
b5ae4d5
Don't generate minification variable if minification disabled
GuillaumeGomez Feb 22, 2019
e555854
Make target pointer-width specific variants of (very old) huge-array-…
pnkfelix Feb 22, 2019
b72ba05
Switch from error patterns to `//~ ERROR` markers.
pnkfelix Feb 22, 2019
fda51c2
Update RELEASES.md
Centril Feb 22, 2019
cc1cd83
Do not underflow after resetting unmatched braces count
estebank Feb 22, 2019
5f27a25
Invalid byte alignment expected/provided in message #58617
pmccarter Feb 22, 2019
8ee1c07
Change byte align message wording #58617
pmccarter Feb 22, 2019
5952c61
tidy line length override #58617
pmccarter Feb 22, 2019
d0c110f
#58658 bless after line split for tidy
pmccarter Feb 23, 2019
42d5cf8
reduce an mir code repetition like (n << amt) >> amt
kenta7777 Feb 23, 2019
1932d7a
Transition librustdoc to 2018 edition
h-michael Feb 23, 2019
1fe87df
Fix tidy check errors
h-michael Feb 23, 2019
c49da5b
Rollup merge of #58100 - h-michael:librustdoc-2018, r=Centril
Centril Feb 23, 2019
f19bec8
Rollup merge of #58122 - matthieu-m:range_incl_perf, r=dtolnay
Centril Feb 23, 2019
1d6657d
Rollup merge of #58199 - clintfred:partial-move-err-msg, r=estebank
Centril Feb 23, 2019
abd6f50
Rollup merge of #58227 - Aaronepower:master, r=Centril
Centril Feb 23, 2019
3688643
Rollup merge of #58353 - matthewjasper:typeck-pattern-constants, r=ar…
Centril Feb 23, 2019
4f99061
Rollup merge of #58453 - jethrogb:jb/sgx-panic-abort, r=nagisa
Centril Feb 23, 2019
585d4d2
Rollup merge of #58476 - nnethercote:rm-LazyTokenStream, r=petrochenkov
Centril Feb 23, 2019
18dd2d2
Rollup merge of #58526 - pmccarter:master, r=estebank
Centril Feb 23, 2019
73e661a
Rollup merge of #58595 - stjepang:make-duration-consts-associated, r=…
Centril Feb 23, 2019
8ccda24
Rollup merge of #58609 - gabi-250:mutable-refs, r=oli-obk
Centril Feb 23, 2019
93bfa92
Rollup merge of #58628 - RReverser:optimise-vec-false, r=oli-obk
Centril Feb 23, 2019
69cb908
Rollup merge of #58643 - GuillaumeGomez:extra-variables, r=Manishearth
Centril Feb 23, 2019
c2ad75e
Rollup merge of #58648 - pnkfelix:issue-23926-update-tests, r=nikomat…
Centril Feb 23, 2019
2db0e48
Rollup merge of #58654 - estebank:underflow, r=nikomatsakis
Centril Feb 23, 2019
d038fb2
Rollup merge of #58658 - pmccarter:align_msg, r=matthewjasper
Centril Feb 23, 2019
a36d1b9
Rollup merge of #58667 - kenta7777:reduce-mir-code-repetition, r=petr…
Centril Feb 23, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,151 @@
Version 1.33.0 (2019-02-28)
==========================

Language
--------
- [You can now use the `cfg(target_vendor)` attribute.][57465] E.g.
`#[cfg(target_vendor="linux")] fn main() { println!("Hello Linux!"); }`
- [Integer patterns such as in a match expression can now be exhaustive.][56362]
E.g. You can have match statement on a `u8` that covers `0..=255` and
you would no longer be required to have a `_ => unreachable!()` case.
- [You can now have multiple patterns in `if let` and `while let`
expressions.][57532] You can do this with the same syntax as a `match`
expression. E.g.
```rust
enum Creature {
Crab(String),
Lobster(String),
Person(String),
}

fn main() {
let state = Creature::Crab("Ferris");

if let Creature::Crab(name) | Creature::Person(name) = state {
println!("This creature's name is: {}", name);
}
}
```
- [You can now have irrefutable `if let` and `while let` patterns.][57535] Using
this feature will by default produce a warning as this behaviour can be
unintuitive. E.g. `if let _ = 5 {}`
- [You can now use `let` bindings, assignments, expression statements,
and irrefutable pattern destructuring in const functions.][57175]
- [You can now call unsafe const functions.][57067] E.g.
```rust
const unsafe fn foo() -> i32 { 5 }
const fn bar() -> i32 {
unsafe { foo() }
}
```
- [You can now specify multiple attributes in a `cfg_attr` attribute.][57332]
E.g. `#[cfg_attr(all(), must_use, optimize)]`
- [You can now specify a specific alignment with the `#[repr(packed)]`
attribute.][57049] E.g. `#[repr(packed(2))] struct Foo(i16, i32);` is a struct
with an alignment of 2 bytes and a size of 6 bytes.
- [You can now import an item from a module as an `_`.][56303] This allows you to
import a trait's impls, and not have the name in the namespace. E.g.
```rust
use std::io::Read as _;

// Allowed as there is only one `Read` in the module.
pub trait Read {}
```
- [`extern` functions will now abort by default when panicking.][55982]
This was previously undefined behaviour.

Compiler
--------
- [You can now set a linker flavor for `rustc` with the `-Clinker-flavor`
command line argument.][56351]
- [The mininum required LLVM version has been bumped to 6.0.][56642]
- [Added support for the PowerPC64 architecture on FreeBSD.][57615]
- [The `x86_64-fortanix-unknown-sgx` target support has been upgraded to
tier 2 support.][57130] Visit the [platform support][platform-support] page for
information on Rust's platform support.
- [Added support for the `thumbv7neon-linux-androideabi` and
`thumbv7neon-unknown-linux-gnueabihf` targets.][56947]
- [Added support for the `x86_64-unknown-uefi` target.][56769]

Libraries
---------
- [The methods `overflowing_{add, sub, mul, shl, shr}` are now `const`
functions for all numeric types.][57566]
- [The methods `rotate_left`, `rotate_right`, and `wrapping_{add, sub, mul, shl, shr}`
are now `const` functions for all numeric types.][57105]
- [The methods `is_positive` and `is_negative` are now `const` functions for
all signed numeric types.][57105]
- [The `get` method for all `NonZero` types is now `const`.][57167]
- [The methods `count_ones`, `count_zeros`, `leading_zeros`, `trailing_zeros`,
`swap_bytes`, `from_be`, `from_le`, `to_be`, `to_le` are now `const` for all
numeric types.][57234]
- [`Ipv4Addr::new` is now a `const` function][57234]

Stabilized APIs
---------------
- [`unix::FileExt::read_exact_at`]
- [`unix::FileExt::write_all_at`]
- [`Option::transpose`]
- [`Result::transpose`]
- [`convert::identity`]
- [`pin::Pin`]
- [`marker::Unpin`]
- [`marker::PhantomPinned`]
- [`Vec::resize_with`]
- [`VecDeque::resize_with`]
- [`Duration::as_millis`]
- [`Duration::as_micros`]
- [`Duration::as_nanos`]


Cargo
-----
- [Cargo should now rebuild a crate if a file was modified during the initial
build.][cargo/6484]

Compatibility Notes
-------------------
- The methods `str::{trim_left, trim_right, trim_left_matches, trim_right_matches}`
are now deprecated in the standard library, and their usage will now produce a warning.
Please use the `str::{trim_start, trim_end, trim_start_matches, trim_end_matches}`
methods instead.

[57615]: https://github.com/rust-lang/rust/pull/57615/
[57465]: https://github.com/rust-lang/rust/pull/57465/
[57532]: https://github.com/rust-lang/rust/pull/57532/
[57535]: https://github.com/rust-lang/rust/pull/57535/
[57566]: https://github.com/rust-lang/rust/pull/57566/
[57130]: https://github.com/rust-lang/rust/pull/57130/
[57167]: https://github.com/rust-lang/rust/pull/57167/
[57175]: https://github.com/rust-lang/rust/pull/57175/
[57234]: https://github.com/rust-lang/rust/pull/57234/
[57332]: https://github.com/rust-lang/rust/pull/57332/
[56947]: https://github.com/rust-lang/rust/pull/56947/
[57049]: https://github.com/rust-lang/rust/pull/57049/
[57067]: https://github.com/rust-lang/rust/pull/57067/
[56769]: https://github.com/rust-lang/rust/pull/56769/
[56642]: https://github.com/rust-lang/rust/pull/56642/
[56303]: https://github.com/rust-lang/rust/pull/56303/
[56351]: https://github.com/rust-lang/rust/pull/56351/
[55982]: https://github.com/rust-lang/rust/pull/55982/
[56362]: https://github.com/rust-lang/rust/pull/56362
[57105]: https://github.com/rust-lang/rust/pull/57105
[cargo/6484]: https://github.com/rust-lang/cargo/pull/6484/
[`unix::FileExt::read_exact_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.read_exact_at
[`unix::FileExt::write_all_at`]: https://doc.rust-lang.org/std/os/unix/fs/trait.FileExt.html#method.write_all_at
[`Option::transpose`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.transpose
[`Result::transpose`]: https://doc.rust-lang.org/std/result/enum.Result.html#method.transpose
[`convert::identity`]: https://doc.rust-lang.org/std/convert/fn.identity.html
[`pin::Pin`]: https://doc.rust-lang.org/std/pin/struct.Pin.html
[`marker::Unpin`]: https://doc.rust-lang.org/stable/std/marker/trait.Unpin.html
[`marker::PhantomPinned`]: https://doc.rust-lang.org/nightly/std/marker/struct.PhantomPinned.html
[`Vec::resize_with`]: https://doc.rust-lang.org/std/vec/struct.Vec.html#method.resize_with
[`VecDeque::resize_with`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.resize_with
[`Duration::as_millis`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_millis
[`Duration::as_micros`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_micros
[`Duration::as_nanos`]: https://doc.rust-lang.org/std/time/struct.Duration.html#method.as_nanos
[platform-support]: https://forge.rust-lang.org/platform-support.html

Version 1.32.0 (2019-01-17)
==========================

Expand Down
1 change: 1 addition & 0 deletions src/liballoc/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,7 @@ impl_is_zero!(u64, |x| x == 0);
impl_is_zero!(u128, |x| x == 0);
impl_is_zero!(usize, |x| x == 0);

impl_is_zero!(bool, |x| x == false);
impl_is_zero!(char, |x| x == '\0');

impl_is_zero!(f32, |x: f32| x.to_bits() == 0);
Expand Down
61 changes: 58 additions & 3 deletions src/libcore/iter/range.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use convert::TryFrom;
use mem;
use ops::{self, Add, Sub};
use ops::{self, Add, Sub, Try};
use usize;

use super::{FusedIterator, TrustedLen};
Expand Down Expand Up @@ -368,11 +368,11 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
Some(Less) => {
self.is_empty = Some(false);
self.start = plus_n.add_one();
return Some(plus_n)
return Some(plus_n);
}
Some(Equal) => {
self.is_empty = Some(true);
return Some(plus_n)
return Some(plus_n);
}
_ => {}
}
Expand All @@ -382,6 +382,34 @@ impl<A: Step> Iterator for ops::RangeInclusive<A> {
None
}

#[inline]
fn try_fold<B, F, R>(&mut self, init: B, mut f: F) -> R
where
Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
{
self.compute_is_empty();

if self.is_empty() {
return Try::from_ok(init);
}

let mut accum = init;

while self.start < self.end {
let n = self.start.add_one();
let n = mem::replace(&mut self.start, n);
accum = f(accum, n)?;
}

self.is_empty = Some(true);

if self.start == self.end {
accum = f(accum, self.start.clone())?;
}

Try::from_ok(accum)
}

#[inline]
fn last(mut self) -> Option<A> {
self.next_back()
Expand Down Expand Up @@ -415,6 +443,33 @@ impl<A: Step> DoubleEndedIterator for ops::RangeInclusive<A> {
self.end.clone()
})
}

#[inline]
fn try_rfold<B, F, R>(&mut self, init: B, mut f: F) -> R where
Self: Sized, F: FnMut(B, Self::Item) -> R, R: Try<Ok=B>
{
self.compute_is_empty();

if self.is_empty() {
return Try::from_ok(init);
}

let mut accum = init;

while self.start < self.end {
let n = self.end.sub_one();
let n = mem::replace(&mut self.end, n);
accum = f(accum, n)?;
}

self.is_empty = Some(true);

if self.start == self.end {
accum = f(accum, self.start.clone())?;
}

Try::from_ok(accum)
}
}

#[stable(feature = "fused", since = "1.26.0")]
Expand Down
2 changes: 2 additions & 0 deletions src/libcore/ops/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,12 +334,14 @@ pub struct RangeInclusive<Idx> {
trait RangeInclusiveEquality: Sized {
fn canonicalized_is_empty(range: &RangeInclusive<Self>) -> bool;
}

impl<T> RangeInclusiveEquality for T {
#[inline]
default fn canonicalized_is_empty(range: &RangeInclusive<Self>) -> bool {
range.is_empty.unwrap_or_default()
}
}

impl<T: PartialOrd> RangeInclusiveEquality for T {
#[inline]
fn canonicalized_is_empty(range: &RangeInclusive<Self>) -> bool {
Expand Down
24 changes: 21 additions & 3 deletions src/libcore/tests/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,19 +1741,37 @@ fn test_range_inclusive_folds() {
assert_eq!((1..=10).sum::<i32>(), 55);
assert_eq!((1..=10).rev().sum::<i32>(), 55);

let mut it = 40..=50;
let mut it = 44..=50;
assert_eq!(it.try_fold(0, i8::checked_add), None);
assert_eq!(it, 44..=50);
assert_eq!(it, 47..=50);
assert_eq!(it.try_fold(0, i8::checked_add), None);
assert_eq!(it, 50..=50);
assert_eq!(it.try_fold(0, i8::checked_add), Some(50));
assert!(it.is_empty());
assert_eq!(it.try_fold(0, i8::checked_add), Some(0));
assert!(it.is_empty());

let mut it = 40..=47;
assert_eq!(it.try_rfold(0, i8::checked_add), None);
assert_eq!(it, 40..=44);
assert_eq!(it.try_rfold(0, i8::checked_add), None);
assert_eq!(it, 44..=47);
assert_eq!(it, 40..=41);
assert_eq!(it.try_rfold(0, i8::checked_add), Some(81));
assert!(it.is_empty());
assert_eq!(it.try_rfold(0, i8::checked_add), Some(0));
assert!(it.is_empty());

let mut it = 10..=20;
assert_eq!(it.try_fold(0, |a,b| Some(a+b)), Some(165));
assert!(it.is_empty());
assert_eq!(it.try_fold(0, |a,b| Some(a+b)), Some(0));
assert!(it.is_empty());

let mut it = 10..=20;
assert_eq!(it.try_rfold(0, |a,b| Some(a+b)), Some(165));
assert!(it.is_empty());
assert_eq!(it.try_rfold(0, |a,b| Some(a+b)), Some(0));
assert!(it.is_empty());
}

#[test]
Expand Down
68 changes: 52 additions & 16 deletions src/libcore/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,6 @@ const MILLIS_PER_SEC: u64 = 1_000;
const MICROS_PER_SEC: u64 = 1_000_000;
const MAX_NANOS_F64: f64 = ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f64;

/// The duration of one second.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const SECOND: Duration = Duration::from_secs(1);

/// The duration of one millisecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MILLISECOND: Duration = Duration::from_millis(1);

/// The duration of one microsecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MICROSECOND: Duration = Duration::from_micros(1);

/// The duration of one nanosecond.
#[unstable(feature = "duration_constants", issue = "57391")]
pub const NANOSECOND: Duration = Duration::from_nanos(1);

/// A `Duration` type to represent a span of time, typically used for system
/// timeouts.
///
Expand Down Expand Up @@ -75,6 +59,58 @@ pub struct Duration {
}

impl Duration {
/// The duration of one second.
///
/// # Examples
///
/// ```
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::SECOND, Duration::from_secs(1));
/// ```
#[unstable(feature = "duration_constants", issue = "57391")]
pub const SECOND: Duration = Duration::from_secs(1);

/// The duration of one millisecond.
///
/// # Examples
///
/// ```
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::MILLISECOND, Duration::from_millis(1));
/// ```
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MILLISECOND: Duration = Duration::from_millis(1);

/// The duration of one microsecond.
///
/// # Examples
///
/// ```
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::MICROSECOND, Duration::from_micros(1));
/// ```
#[unstable(feature = "duration_constants", issue = "57391")]
pub const MICROSECOND: Duration = Duration::from_micros(1);

/// The duration of one nanosecond.
///
/// # Examples
///
/// ```
/// #![feature(duration_constants)]
/// use std::time::Duration;
///
/// assert_eq!(Duration::NANOSECOND, Duration::from_nanos(1));
/// ```
#[unstable(feature = "duration_constants", issue = "57391")]
pub const NANOSECOND: Duration = Duration::from_nanos(1);

/// Creates a new `Duration` from the specified number of whole seconds and
/// additional nanoseconds.
///
Expand Down
Loading