From 3c8db22e9c564af5f93b06e3f293ba6e64652e1e Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Wed, 8 May 2019 23:45:19 +0200 Subject: [PATCH 1/6] save-analysis: Fix ICE when processing associated constant --- src/librustc_save_analysis/dump_visitor.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 7d4002525942b..3e86eff549882 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -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. From b696573c8ae3af1d1cb58d35c8bca9864ff7a491 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 9 May 2019 14:06:36 +0200 Subject: [PATCH 2/6] save-analysis: Add UI testsuite --- src/test/ui/save-analysis/issue-59134-0.rs | 12 ++++++++++++ src/test/ui/save-analysis/issue-59134-0.stderr | 9 +++++++++ src/test/ui/save-analysis/issue-59134-1.rs | 12 ++++++++++++ src/test/ui/save-analysis/issue-59134-1.stderr | 9 +++++++++ 4 files changed, 42 insertions(+) create mode 100644 src/test/ui/save-analysis/issue-59134-0.rs create mode 100644 src/test/ui/save-analysis/issue-59134-0.stderr create mode 100644 src/test/ui/save-analysis/issue-59134-1.rs create mode 100644 src/test/ui/save-analysis/issue-59134-1.stderr diff --git a/src/test/ui/save-analysis/issue-59134-0.rs b/src/test/ui/save-analysis/issue-59134-0.rs new file mode 100644 index 0000000000000..93c7fbbca8461 --- /dev/null +++ b/src/test/ui/save-analysis/issue-59134-0.rs @@ -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() {} \ No newline at end of file diff --git a/src/test/ui/save-analysis/issue-59134-0.stderr b/src/test/ui/save-analysis/issue-59134-0.stderr new file mode 100644 index 0000000000000..4e9b2e6fdeb4d --- /dev/null +++ b/src/test/ui/save-analysis/issue-59134-0.stderr @@ -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`. diff --git a/src/test/ui/save-analysis/issue-59134-1.rs b/src/test/ui/save-analysis/issue-59134-1.rs new file mode 100644 index 0000000000000..085f22cacbc58 --- /dev/null +++ b/src/test/ui/save-analysis/issue-59134-1.rs @@ -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() {} \ No newline at end of file diff --git a/src/test/ui/save-analysis/issue-59134-1.stderr b/src/test/ui/save-analysis/issue-59134-1.stderr new file mode 100644 index 0000000000000..bdc335eaac041 --- /dev/null +++ b/src/test/ui/save-analysis/issue-59134-1.stderr @@ -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`. From ae22067ae95508b4f673fcd6465e1bed187e9ee7 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Thu, 9 May 2019 16:15:53 +0200 Subject: [PATCH 3/6] Appease tidy --- src/test/ui/save-analysis/issue-59134-0.rs | 2 +- src/test/ui/save-analysis/issue-59134-1.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/ui/save-analysis/issue-59134-0.rs b/src/test/ui/save-analysis/issue-59134-0.rs index 93c7fbbca8461..3158328b3ff15 100644 --- a/src/test/ui/save-analysis/issue-59134-0.rs +++ b/src/test/ui/save-analysis/issue-59134-0.rs @@ -9,4 +9,4 @@ pub fn f() { } } -fn main() {} \ No newline at end of file +fn main() {} diff --git a/src/test/ui/save-analysis/issue-59134-1.rs b/src/test/ui/save-analysis/issue-59134-1.rs index 085f22cacbc58..3cb629777a497 100644 --- a/src/test/ui/save-analysis/issue-59134-1.rs +++ b/src/test/ui/save-analysis/issue-59134-1.rs @@ -9,4 +9,4 @@ fn func() { } } -fn main() {} \ No newline at end of file +fn main() {} From 08aff9fe3a769fdd7959856e956340fc8de30b15 Mon Sep 17 00:00:00 2001 From: Yuki OKUSHI Date: Thu, 9 May 2019 11:58:39 +0900 Subject: [PATCH 4/6] Stabilize and re-export core::array --- src/libcore/array.rs | 10 ++++++---- src/libstd/lib.rs | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/libcore/array.rs b/src/libcore/array.rs index dcd9ce6dad756..96cb2c5ade2f0 100644 --- a/src/libcore/array.rs +++ b/src/libcore/array.rs @@ -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; @@ -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 { /// 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> FixedSizeArray for A { #[inline] fn as_slice(&self) -> &[T] { @@ -53,6 +54,7 @@ unsafe impl> FixedSizeArray 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 { diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index d11dee8fc9707..8935245b34ef9 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -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)] @@ -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; From cf631c01e5e8df285d0ebf2ac5431b96ae42286f Mon Sep 17 00:00:00 2001 From: Aaron Power Date: Sat, 4 May 2019 16:42:06 +0200 Subject: [PATCH 5/6] Updated RELEASES.md for 1.35.0 --- RELEASES.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/RELEASES.md b/RELEASES.md index 48bd13105bbea..c50e5b2236fed 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,100 @@ +Version 1.35.0 (2019-05-23) +========================== + +Language +-------- +- [`FnOnce`, `FnMut`, and the `Fn` traits are now implemented for `Box`, + `Box`, and `Box` 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) =========================== From d32bd05ea82a4e17f6db059a02bb179aaea7de8f Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Tue, 14 May 2019 22:32:50 +0200 Subject: [PATCH 6/6] Add link to the 1.34.0 CVE --- RELEASES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index c50e5b2236fed..4185961187b39 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -99,9 +99,10 @@ 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) ===========================