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

[beta] Rollup backports #60838

Merged
merged 7 commits into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
100 changes: 99 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,108 @@
Version 1.35.0 (2019-05-23)
==========================

Language
--------
- [`FnOnce`, `FnMut`, and the `Fn` traits are now implemented for `Box<FnOnce>`,
`Box<FnMut>`, and `Box<Fn>` respectively.][59500]
- [You can now coerce closures into unsafe function pointers.][59580] e.g.
```rust
unsafe fn call_unsafe(func: unsafe fn()) {
func()
}

pub fn main() {
unsafe { call_unsafe(|| {}); }
}
```


Compiler
--------
- [Added the `armv6-unknown-freebsd-gnueabihf` and
`armv7-unknown-freebsd-gnueabihf` targets.][58080]
- [Added the `wasm32-unknown-wasi` target.][59464]


Libraries
---------
- [`Thread` will now show its ID in `Debug` output.][59460]
- [`StdinLock`, `StdoutLock`, and `StderrLock` now implement `AsRawFd`.][59512]
- [`alloc::System` now implements `Default`.][59451]
- [Expanded `Debug` output (`{:#?}`) for structs now has a trailing comma on the
last field.][59076]
- [`char::{ToLowercase, ToUppercase}` now
implement `ExactSizeIterator`.][58778]
- [All `NonZero` numeric types now implement `FromStr`.][58717]
- [Removed the `Read` trait bounds
on the `BufReader::{get_ref, get_mut, into_inner}` methods.][58423]
- [You can now call the `dbg!` macro without any parameters to print the file
and line where it is called.][57847]
- [In place ASCII case conversions are now up to 4× faster.][59283]
e.g. `str::make_ascii_lowercase`
- [`hash_map::{OccupiedEntry, VacantEntry}` now implement `Sync`
and `Send`.][58369]

Stabilized APIs
---------------
- [`f32::copysign`]
- [`f64::copysign`]
- [`RefCell::replace_with`]
- [`RefCell::map_split`]
- [`ptr::hash`]
- [`Range::contains`]
- [`RangeFrom::contains`]
- [`RangeTo::contains`]
- [`RangeInclusive::contains`]
- [`RangeToInclusive::contains`]
- [`Option::copied`]

Cargo
-----
- [You can now set `cargo:rustc-cdylib-link-arg` at build time to pass custom
linker arguments when building a `cdylib`.][cargo/6298] Its usage is highly
platform specific.

Misc
----
- [The Rust toolchain is now available natively for musl based distros.][58575]

[59460]: https://github.com/rust-lang/rust/pull/59460/
[59464]: https://github.com/rust-lang/rust/pull/59464/
[59500]: https://github.com/rust-lang/rust/pull/59500/
[59512]: https://github.com/rust-lang/rust/pull/59512/
[59580]: https://github.com/rust-lang/rust/pull/59580/
[59283]: https://github.com/rust-lang/rust/pull/59283/
[59451]: https://github.com/rust-lang/rust/pull/59451/
[59076]: https://github.com/rust-lang/rust/pull/59076/
[58778]: https://github.com/rust-lang/rust/pull/58778/
[58717]: https://github.com/rust-lang/rust/pull/58717/
[58369]: https://github.com/rust-lang/rust/pull/58369/
[58423]: https://github.com/rust-lang/rust/pull/58423/
[58080]: https://github.com/rust-lang/rust/pull/58080/
[57847]: https://github.com/rust-lang/rust/pull/57847/
[58575]: https://github.com/rust-lang/rust/pull/58575
[cargo/6298]: https://github.com/rust-lang/cargo/pull/6298/
[`f32::copysign`]: https://doc.rust-lang.org/stable/std/primitive.f32.html#method.copysign
[`f64::copysign`]: https://doc.rust-lang.org/stable/std/primitive.f64.html#method.copysign
[`RefCell::replace_with`]: https://doc.rust-lang.org/stable/std/cell/struct.RefCell.html#method.replace_with
[`RefCell::map_split`]: https://doc.rust-lang.org/stable/std/cell/struct.RefCell.html#method.map_split
[`ptr::hash`]: https://doc.rust-lang.org/stable/std/ptr/fn.hash.html
[`Range::contains`]: https://doc.rust-lang.org/std/ops/struct.Range.html#method.contains
[`RangeFrom::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeFrom.html#method.contains
[`RangeTo::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeTo.html#method.contains
[`RangeInclusive::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeInclusive.html#method.contains
[`RangeToInclusive::contains`]: https://doc.rust-lang.org/std/ops/struct.RangeToInclusive.html#method.contains
[`Option::copied`]: https://doc.rust-lang.org/std/option/enum.Option.html#method.copied

Version 1.34.2 (2019-05-14)
===========================

* [Destabilize the `Error::type_id` function due to a security
vulnerability][60785]
vulnerability][60785] ([CVE-2019-12083])

[60785]: https://github.com/rust-lang/rust/pull/60785
[CVE-2019-12083]: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-12083

Version 1.34.1 (2019-04-25)
===========================
Expand Down
10 changes: 6 additions & 4 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
//!
//! *[See also the array primitive type](../../std/primitive.array.html).*

#![unstable(feature = "fixed_size_array",
reason = "traits and impls are better expressed through generic \
integer constants",
issue = "27778")]
#![stable(feature = "core_array", since = "1.36.0")]

use borrow::{Borrow, BorrowMut};
use cmp::Ordering;
Expand All @@ -30,13 +27,17 @@ use slice::{Iter, IterMut};
/// Note that the traits AsRef and AsMut provide similar methods for types that
/// may not be fixed-size arrays. Implementors should prefer those traits
/// instead.
#[unstable(feature = "fixed_size_array", issue = "27778")]
pub unsafe trait FixedSizeArray<T> {
/// Converts the array to immutable slice
#[unstable(feature = "fixed_size_array", issue = "27778")]
fn as_slice(&self) -> &[T];
/// Converts the array to mutable slice
#[unstable(feature = "fixed_size_array", issue = "27778")]
fn as_mut_slice(&mut self) -> &mut [T];
}

#[unstable(feature = "fixed_size_array", issue = "27778")]
unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
#[inline]
fn as_slice(&self) -> &[T] {
Expand All @@ -53,6 +54,7 @@ unsafe impl<T, A: Unsize<[T]>> FixedSizeArray<T> for A {
#[derive(Debug, Copy, Clone)]
pub struct TryFromSliceError(());

#[stable(feature = "core_array", since = "1.36.0")]
impl fmt::Display for TryFromSliceError {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
10 changes: 6 additions & 4 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,12 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> {
}

// walk type and init value
self.visit_ty(typ);
if let Some(expr) = expr {
self.visit_expr(expr);
}
self.nest_tables(id, |v| {
v.visit_ty(typ);
if let Some(expr) = expr {
v.visit_expr(expr);
}
});
}

// FIXME tuple structs should generate tuple-specific data.
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@
#![feature(exact_size_is_empty)]
#![feature(exhaustive_patterns)]
#![feature(external_doc)]
#![feature(fixed_size_array)]
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(futures_api)]
Expand Down Expand Up @@ -436,6 +435,8 @@ pub use core::char;
pub use core::u128;
#[stable(feature = "core_hint", since = "1.27.0")]
pub use core::hint;
#[stable(feature = "core_array", since = "1.36.0")]
pub use core::array;

pub mod f32;
pub mod f64;
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/save-analysis/issue-59134-0.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// compile-flags: -Zsave-analysis

// Check that this doesn't ICE when processing associated const (field expr).

pub fn f() {
trait Trait {}
impl Trait {
const FLAG: u32 = bogus.field; //~ ERROR cannot find value `bogus`
}
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/save-analysis/issue-59134-0.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0425]: cannot find value `bogus` in this scope
--> $DIR/issue-59134-0.rs:8:27
|
LL | const FLAG: u32 = bogus.field;
| ^^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
12 changes: 12 additions & 0 deletions src/test/ui/save-analysis/issue-59134-1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// compile-flags: -Zsave-analysis

// Check that this doesn't ICE when processing associated const (type).

fn func() {
trait Trait {
type MyType;
const CONST: Self::MyType = bogus.field; //~ ERROR cannot find value `bogus`
}
}

fn main() {}
9 changes: 9 additions & 0 deletions src/test/ui/save-analysis/issue-59134-1.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0425]: cannot find value `bogus` in this scope
--> $DIR/issue-59134-1.rs:8:37
|
LL | const CONST: Self::MyType = bogus.field;
| ^^^^^ not found in this scope

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.