diff --git a/.gitignore b/.gitignore index d00b69d..dec69a4 100644 --- a/.gitignore +++ b/.gitignore @@ -335,3 +335,18 @@ /rust-1.50.0-powerpc64le-unknown-linux-gnu.tar.xz /rust-1.50.0-s390x-unknown-linux-gnu.tar.xz /rust-1.50.0-x86_64-unknown-linux-gnu.tar.xz +/rustc-1.52.0-src.tar.xz +/rust-1.51.0-aarch64-unknown-linux-gnu.tar.xz +/rust-1.51.0-armv7-unknown-linux-gnueabihf.tar.xz +/rust-1.51.0-i686-unknown-linux-gnu.tar.xz +/rust-1.51.0-powerpc64le-unknown-linux-gnu.tar.xz +/rust-1.51.0-s390x-unknown-linux-gnu.tar.xz +/rust-1.51.0-x86_64-unknown-linux-gnu.tar.xz +/rustc-1.52.1-src.tar.xz +/rustc-1.53.0-src.tar.xz +/rust-1.52.0-aarch64-unknown-linux-gnu.tar.xz +/rust-1.52.0-armv7-unknown-linux-gnueabihf.tar.xz +/rust-1.52.0-i686-unknown-linux-gnu.tar.xz +/rust-1.52.0-powerpc64le-unknown-linux-gnu.tar.xz +/rust-1.52.0-s390x-unknown-linux-gnu.tar.xz +/rust-1.52.0-x86_64-unknown-linux-gnu.tar.xz diff --git a/0001-Use-lld-provided-by-system-for-wasm.patch b/0001-Use-lld-provided-by-system-for-wasm.patch new file mode 100644 index 0000000..4dcb322 --- /dev/null +++ b/0001-Use-lld-provided-by-system-for-wasm.patch @@ -0,0 +1,26 @@ +From 3582a262d27fd5a2f8705bad6018241eaca8aadd Mon Sep 17 00:00:00 2001 +From: Ivan Mironov +Date: Sun, 8 Dec 2019 17:23:08 +0500 +Subject: [PATCH] Use lld provided by system for wasm + +--- + compiler/rustc_target/src/spec/wasm_base.rs | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/compiler/rustc_target/src/spec/wasm_base.rs b/compiler/rustc_target/src/spec/wasm_base.rs +index b208eb92f8ff..94a701a11c8b 100644 +--- a/compiler/rustc_target/src/spec/wasm_base.rs ++++ b/compiler/rustc_target/src/spec/wasm_base.rs +@@ -98,8 +98,7 @@ pub fn options() -> TargetOptions { + // arguments just yet + limit_rdylib_exports: false, + +- // we use the LLD shipped with the Rust toolchain by default +- linker: Some("rust-lld".to_owned()), ++ linker: Some("lld".to_owned()), + lld_flavor: LldFlavor::Wasm, + + // No need for indirection here, simd types can always be passed by +-- +2.31.1 + diff --git a/rust.spec b/rust.spec index 2005c52..6a7d061 100644 --- a/rust.spec +++ b/rust.spec @@ -9,19 +9,28 @@ # e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24 # or nightly wants some beta-YYYY-MM-DD # Note that cargo matches the program version here, not its crate version. -%global bootstrap_rust 1.51.0 -%global bootstrap_cargo 1.51.0 -%global bootstrap_channel 1.51.0 -%global bootstrap_date 2021-03-23 +%global bootstrap_rust 1.52.0 +%global bootstrap_cargo 1.52.0 +%global bootstrap_channel 1.52.0 +%global bootstrap_date 2021-05-06 # Only the specified arches will use bootstrap binaries. #global bootstrap_arches %%{rust_arches} +# Define a space-separated list of targets to ship rust-std-static-$triple for +# cross-compilation. The packages are noarch, but they're not fully +# reproducible between hosts, so only x86_64 actually builds it. +%ifarch x86_64 +%if 0%{?fedora} +%global cross_targets wasm32-unknown-unknown +%endif +%endif + # Using llvm-static may be helpful as an opt-in, e.g. to aid LLVM rebases. %bcond_with llvm_static # We can also choose to just use Rust's bundled LLVM, in case the system LLVM -# is insufficient. Rust currently requires LLVM 9.0+. +# is insufficient. Rust currently requires LLVM 10.0+. %bcond_with bundled_llvm # Requires stable libgit2 1.1 @@ -56,8 +65,8 @@ %endif Name: rust -Version: 1.51.0 -Release: 3.0.riscv64%{?dist} +Version: 1.53.0 +Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -75,29 +84,8 @@ Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz # https://github.com/rust-lang/rust/issues/80810#issuecomment-781784032 Patch1: 0001-Revert-Auto-merge-of-79547.patch -# CVE-2021-28876 rust: panic safety issue in Zip implementation -# https://github.com/rust-lang/rust/pull/81741 -Patch2: rustc-1.51.0-backport-pr81741.patch - -# CVE-2021-28879 rust: integer overflow in the Zip implementation can lead to a buffer overflow -# https://github.com/rust-lang/rust/pull/82289 -Patch3: rustc-1.51.0-backport-pr82289.patch - -# CVE-2021-28878 rust: memory safety violation in Zip implementation when next_back() and next() are used together -# https://github.com/rust-lang/rust/pull/82292 -Patch4: rustc-1.51.0-backport-pr82292.patch - -# Fix bootstrap for stage0 rust 1.51 -# https://github.com/rust-lang/rust/pull/81910 -Patch5: rustc-1.51.0-backport-pr81910.patch - -# CVE-2020-36323 rust: optimization for joining strings can cause uninitialized bytes to be exposed -# https://github.com/rust-lang/rust/pull/81728 -Patch6: rustc-1.51.0-backport-pr81728.patch - -# CVE-2021-31162 rust: double free in Vec::from_iter function if freeing the element panics -# https://github.com/rust-lang/rust/pull/83629 -Patch7: rustc-1.51.0-backport-pr83629.patch +# By default, rust tries to use "rust-lld" as a linker for WebAssembly. +Patch2: 0001-Use-lld-provided-by-system-for-wasm.patch ### RHEL-specific patches below ### @@ -106,7 +94,7 @@ Patch100: rustc-1.48.0-disable-libssh2.patch # libcurl on RHEL7 doesn't have http2, but since cargo requests it, curl-sys # will try to build it statically -- instead we turn off the feature. -Patch101: rustc-1.51.0-disable-http2.patch +Patch101: rustc-1.53.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) @@ -192,16 +180,12 @@ BuildRequires: pkgconfig(libssh2) >= 1.6.0 BuildRequires: %{python} %if %with bundled_llvm -BuildRequires: cmake3 >= 3.4.3 -Provides: bundled(llvm) = 11.0.1 +BuildRequires: cmake3 >= 3.13.4 +Provides: bundled(llvm) = 12.0.0 %else BuildRequires: cmake >= 2.8.11 %if 0%{?epel} == 7 -%global llvm llvm9.0 -%endif -%if 0%{?fedora} >= 34 -# we're not ready for llvm-12 yet -%global llvm llvm11 +%global llvm llvm11.0 %endif %if %defined llvm %global llvm_root %{_libdir}/%{llvm} @@ -209,7 +193,7 @@ BuildRequires: cmake >= 2.8.11 %global llvm llvm %global llvm_root %{_prefix} %endif -BuildRequires: %{llvm}-devel >= 9.0 +BuildRequires: %{llvm}-devel >= 10.0 %if %with llvm_static BuildRequires: %{llvm}-static BuildRequires: libffi-devel @@ -262,6 +246,19 @@ Requires: /usr/bin/cc %endif %endif +# We're going to override --libdir when configuring to get rustlib into a +# common path, but we'll fix the shared libraries during install. +%global common_libdir %{_prefix}/lib +%global rustlibdir %{common_libdir}/rustlib + +%if %defined cross_targets +# brp-strip-static-archive breaks the archive index for wasm +%global __os_install_post \ +%__os_install_post \ +find %{buildroot}%{rustlibdir} -type f -path '*/wasm*/lib/*.rlib' -exec ranlib '{}' ';' \ +%{nil} +%endif + %description Rust is a systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. @@ -276,6 +273,32 @@ Summary: Standard library for Rust This package includes the standard libraries for building applications written in Rust. +%if %defined cross_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do + local requires = rpm.expand("Requires: rust = %{version}-%{release}") + if string.sub(triple, 1, 4) == "wasm" then + requires = requires .. "\nRequires: lld >= 8.0" + end + local subs = { + triple = triple, + requires = requires, + } + local s = string.gsub([[ +%package std-static-{{triple}} +Summary: Standard library for Rust +BuildArch: noarch +{{requires}} + +%description std-static-{{triple}} +This package includes the standard libraries for building applications +written in Rust for the {{triple}} target. +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + %package debugger-common Summary: Common debugger pretty printers for Rust @@ -434,11 +457,6 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -524,11 +542,6 @@ find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+' %build export %{rust_env} -# We're going to override --libdir when configuring to get rustlib into a -# common path, but we'll fix the shared libraries during install. -%global common_libdir %{_prefix}/lib -%global rustlibdir %{common_libdir}/rustlib - %ifarch %{arm} %{ix86} s390x riscv64 # full debuginfo is exhausting memory; just do libstd for now # https://github.com/rust-lang/rust/issues/45854 @@ -543,13 +556,6 @@ export %{rust_env} %define enable_debuginfo --debuginfo-level=2 %endif -# We want the best optimization for std, but it caused problems for rpm-ostree -# on ppc64le to have all of the compiler_builtins in a single object: -# https://bugzilla.redhat.com/show_bug.cgi?id=1713090 -%ifnarch %{power64} -%define codegen_units_std --set rust.codegen-units-std=1 -%endif - # Some builders have relatively little memory for their CPU count. # At least 2GB per CPU is a good rule of thumb for building rustc. ncpus=$(/usr/bin/getconf _NPROCESSORS_ONLN) @@ -568,6 +574,7 @@ fi %{!?with_llvm_static: --enable-llvm-link-shared } } \ --disable-rpath \ %{enable_debuginfo} \ + --set rust.codegen-units-std=1 \ --enable-extended \ --tools=analysis,cargo,clippy,rls,rustfmt,src \ --enable-vendor \ @@ -579,12 +586,23 @@ fi %{python} ./x.py build -j "$ncpus" --stage 2 %{python} ./x.py doc --stage 2 +%if %defined cross_targets +for triple in %{cross_targets}; do + %{python} ./x.py build --stage 2 --target=$triple std +done +%endif %install export %{rust_env} DESTDIR=%{buildroot} %{python} ./x.py install +%if %defined cross_targets +for triple in %{cross_targets}; do + DESTDIR=%{buildroot} %{python} ./x.py install --target=$triple std +done +%endif + # Make sure the shared libraries are in the proper libdir %if "%{_libdir}" != "%{common_libdir}" mkdir -p %{buildroot}%{_libdir} @@ -687,6 +705,26 @@ export %{rust_env} %{rustlibdir}/%{rust_triple}/lib/*.rlib +%if %defined cross_targets +%{lua: do + for triple in string.gmatch(rpm.expand("%{cross_targets}"), "%S+") do + local subs = { + triple = triple, + rustlibdir = rpm.expand("%{rustlibdir}"), + } + local s = string.gsub([[ +%files std-static-{{triple}} +%dir {{rustlibdir}} +%dir {{rustlibdir}}/{{triple}} +%dir {{rustlibdir}}/{{triple}}/lib +{{rustlibdir}}/{{triple}}/lib/*.rlib +]], "{{(%w+)}}", subs) + print(s) + end +end} +%endif + + %files debugger-common %dir %{rustlibdir} %dir %{rustlibdir}/etc @@ -717,6 +755,7 @@ export %{rust_env} %{_docdir}/%{name}/html/*.png %{_docdir}/%{name}/html/*.svg %{_docdir}/%{name}/html/*.woff +%{_docdir}/%{name}/html/*.woff2 %license %{_docdir}/%{name}/html/*.txt %license %{_docdir}/%{name}/html/*.md @@ -769,9 +808,23 @@ export %{rust_env} %changelog -* Sun Apr 18 2021 David Abdurachmanov - 1.51.0-3.0.riscv64 +* Sat Jul 10 2021 David Abdurachmanov - 1.53.0-1.0.riscv64 - Add riscv64 +* Thu Jun 17 2021 Josh Stone - 1.53.0-1 +- Update to 1.53.0. + +* Wed Jun 02 2021 Josh Stone - 1.52.1-2 +- Set rust.codegen-units-std=1 for all targets again. +- Add rust-std-static-wasm32-unknown-unknown. +- Rebuild f34 with LLVM 12. + +* Mon May 10 2021 Josh Stone - 1.52.1-1 +- Update to 1.52.1. + +* Thu May 06 2021 Josh Stone - 1.52.0-1 +- Update to 1.52.0. + * Fri Apr 16 2021 Josh Stone - 1.51.0-3 - Security fixes for CVE-2020-36323, CVE-2021-31162 diff --git a/rustc-1.51.0-backport-pr81728.patch b/rustc-1.51.0-backport-pr81728.patch deleted file mode 100644 index 20373f4..0000000 --- a/rustc-1.51.0-backport-pr81728.patch +++ /dev/null @@ -1,181 +0,0 @@ -From 70f17ca715d3d7e2fd79cc909b95fd3a6357c13e Mon Sep 17 00:00:00 2001 -From: Yechan Bae -Date: Wed, 3 Feb 2021 16:36:33 -0500 -Subject: [PATCH 1/2] Fixes #80335 - ---- - library/alloc/src/str.rs | 42 ++++++++++++++++++++++---------------- - library/alloc/tests/str.rs | 30 +++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+), 18 deletions(-) - -diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs -index 70e0c7dba5ea..a7584c6b6510 100644 ---- a/library/alloc/src/str.rs -+++ b/library/alloc/src/str.rs -@@ -90,8 +90,8 @@ fn join(slice: &Self, sep: &str) -> String { - } - } - --macro_rules! spezialize_for_lengths { -- ($separator:expr, $target:expr, $iter:expr; $($num:expr),*) => { -+macro_rules! specialize_for_lengths { -+ ($separator:expr, $target:expr, $iter:expr; $($num:expr),*) => {{ - let mut target = $target; - let iter = $iter; - let sep_bytes = $separator; -@@ -102,7 +102,8 @@ macro_rules! spezialize_for_lengths { - $num => { - for s in iter { - copy_slice_and_advance!(target, sep_bytes); -- copy_slice_and_advance!(target, s.borrow().as_ref()); -+ let content_bytes = s.borrow().as_ref(); -+ copy_slice_and_advance!(target, content_bytes); - } - }, - )* -@@ -110,11 +111,13 @@ macro_rules! spezialize_for_lengths { - // arbitrary non-zero size fallback - for s in iter { - copy_slice_and_advance!(target, sep_bytes); -- copy_slice_and_advance!(target, s.borrow().as_ref()); -+ let content_bytes = s.borrow().as_ref(); -+ copy_slice_and_advance!(target, content_bytes); - } - } - } -- }; -+ target -+ }} - } - - macro_rules! copy_slice_and_advance { -@@ -153,7 +156,7 @@ fn join_generic_copy(slice: &[S], sep: &[T]) -> Vec - // if the `len` calculation overflows, we'll panic - // we would have run out of memory anyway and the rest of the function requires - // the entire Vec pre-allocated for safety -- let len = sep_len -+ let reserved_len = sep_len - .checked_mul(iter.len()) - .and_then(|n| { - slice.iter().map(|s| s.borrow().as_ref().len()).try_fold(n, usize::checked_add) -@@ -161,22 +164,25 @@ fn join_generic_copy(slice: &[S], sep: &[T]) -> Vec - .expect("attempt to join into collection with len > usize::MAX"); - - // crucial for safety -- let mut result = Vec::with_capacity(len); -- assert!(result.capacity() >= len); -+ let mut result = Vec::with_capacity(reserved_len); -+ debug_assert!(result.capacity() >= reserved_len); - - result.extend_from_slice(first.borrow().as_ref()); - - unsafe { -- { -- let pos = result.len(); -- let target = result.get_unchecked_mut(pos..len); -- -- // copy separator and slices over without bounds checks -- // generate loops with hardcoded offsets for small separators -- // massive improvements possible (~ x2) -- spezialize_for_lengths!(sep, target, iter; 0, 1, 2, 3, 4); -- } -- result.set_len(len); -+ let pos = result.len(); -+ let target = result.get_unchecked_mut(pos..reserved_len); -+ -+ // copy separator and slices over without bounds checks -+ // generate loops with hardcoded offsets for small separators -+ // massive improvements possible (~ x2) -+ let remain = specialize_for_lengths!(sep, target, iter; 0, 1, 2, 3, 4); -+ -+ // issue #80335: A weird borrow implementation can return different -+ // slices for the length calculation and the actual copy, so -+ // `remain.len()` might be non-zero. -+ let result_len = reserved_len - remain.len(); -+ result.set_len(result_len); - } - result - } -diff --git a/library/alloc/tests/str.rs b/library/alloc/tests/str.rs -index 604835e6cc4a..6df8d8c2f354 100644 ---- a/library/alloc/tests/str.rs -+++ b/library/alloc/tests/str.rs -@@ -160,6 +160,36 @@ fn test_join_for_different_lengths_with_long_separator() { - test_join!("~~~~~a~~~~~bc", ["", "a", "bc"], "~~~~~"); - } - -+#[test] -+fn test_join_isue_80335() { -+ use core::{borrow::Borrow, cell::Cell}; -+ -+ struct WeirdBorrow { -+ state: Cell, -+ } -+ -+ impl Default for WeirdBorrow { -+ fn default() -> Self { -+ WeirdBorrow { state: Cell::new(false) } -+ } -+ } -+ -+ impl Borrow for WeirdBorrow { -+ fn borrow(&self) -> &str { -+ let state = self.state.get(); -+ if state { -+ "0" -+ } else { -+ self.state.set(true); -+ "123456" -+ } -+ } -+ } -+ -+ let arr: [WeirdBorrow; 3] = Default::default(); -+ test_join!("0-0-0", arr, "-"); -+} -+ - #[test] - #[cfg_attr(miri, ignore)] // Miri is too slow - fn test_unsafe_slice() { --- -2.31.1 - - -From 10020817d2e6756be1ff2ac3c182af97cf7fe904 Mon Sep 17 00:00:00 2001 -From: Yechan Bae -Date: Sat, 20 Mar 2021 13:42:54 -0400 -Subject: [PATCH 2/2] Update the comment - ---- - library/alloc/src/str.rs | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs -index a7584c6b6510..4d1e876457b8 100644 ---- a/library/alloc/src/str.rs -+++ b/library/alloc/src/str.rs -@@ -163,7 +163,7 @@ fn join_generic_copy(slice: &[S], sep: &[T]) -> Vec - }) - .expect("attempt to join into collection with len > usize::MAX"); - -- // crucial for safety -+ // prepare an uninitialized buffer - let mut result = Vec::with_capacity(reserved_len); - debug_assert!(result.capacity() >= reserved_len); - -@@ -178,9 +178,9 @@ fn join_generic_copy(slice: &[S], sep: &[T]) -> Vec - // massive improvements possible (~ x2) - let remain = specialize_for_lengths!(sep, target, iter; 0, 1, 2, 3, 4); - -- // issue #80335: A weird borrow implementation can return different -- // slices for the length calculation and the actual copy, so -- // `remain.len()` might be non-zero. -+ // A weird borrow implementation may return different -+ // slices for the length calculation and the actual copy. -+ // Make sure we don't expose uninitialized bytes to the caller. - let result_len = reserved_len - remain.len(); - result.set_len(result_len); - } --- -2.31.1 - diff --git a/rustc-1.51.0-backport-pr81741.patch b/rustc-1.51.0-backport-pr81741.patch deleted file mode 100644 index 8ef22ee..0000000 --- a/rustc-1.51.0-backport-pr81741.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 40d3f2d7ef5835317fe9df9ecc01f4c363def4fd Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= -Date: Thu, 4 Feb 2021 10:23:01 +0200 -Subject: [PATCH] Increment `self.index` before calling - `Iterator::self.a.__iterator_get_unchecked` in `Zip` `TrustedRandomAccess` - specialization - -Otherwise if `Iterator::self.a.__iterator_get_unchecked` panics the -index would not have been incremented yet and another call to -`Iterator::next` would read from the same index again, which is not -allowed according to the API contract of `TrustedRandomAccess` for -`!Clone`. - -Fixes https://github.com/rust-lang/rust/issues/81740 - -(cherry picked from commit 86a4b27475aab52b998c15f5758540697cc9cff0) ---- - library/core/src/iter/adapters/zip.rs | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs -index 98b8dca96140..9f9835345200 100644 ---- a/library/core/src/iter/adapters/zip.rs -+++ b/library/core/src/iter/adapters/zip.rs -@@ -198,12 +198,13 @@ fn next(&mut self) -> Option<(A::Item, B::Item)> { - Some((self.a.__iterator_get_unchecked(i), self.b.__iterator_get_unchecked(i))) - } - } else if A::may_have_side_effect() && self.index < self.a.size() { -+ let i = self.index; -+ self.index += 1; - // match the base implementation's potential side effects -- // SAFETY: we just checked that `self.index` < `self.a.len()` -+ // SAFETY: we just checked that `i` < `self.a.len()` - unsafe { -- self.a.__iterator_get_unchecked(self.index); -+ self.a.__iterator_get_unchecked(i); - } -- self.index += 1; - None - } else { - None --- -2.31.1 - diff --git a/rustc-1.51.0-backport-pr81910.patch b/rustc-1.51.0-backport-pr81910.patch deleted file mode 100644 index e2f91b6..0000000 --- a/rustc-1.51.0-backport-pr81910.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 852684d306cee955ed751f1e8d8eec6adaecff3b Mon Sep 17 00:00:00 2001 -From: Joshua Nelson -Date: Mon, 8 Feb 2021 22:51:21 -0500 -Subject: [PATCH] Use format string in bootstrap panic instead of a string - directly - -This fixes the following warning when compiling with nightly: - -``` -warning: panic message is not a string literal - --> src/bootstrap/builder.rs:1515:24 - | -1515 | panic!(out); - | ^^^ - | - = note: `#[warn(non_fmt_panic)]` on by default - = note: this is no longer accepted in Rust 2021 -help: add a "{}" format string to Display the message - | -1515 | panic!("{}", out); - | ^^^^^ -help: or use std::panic::panic_any instead - | -1515 | std::panic::panic_any(out); - | ^^^^^^^^^^^^^^^^^^^^^^ -``` - -(cherry picked from commit 31c93397bde772764cda3058e16f9cef61895090) ---- - src/bootstrap/builder.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs -index f1a160250dbe..0f5fcb4af400 100644 ---- a/src/bootstrap/builder.rs -+++ b/src/bootstrap/builder.rs -@@ -1490,7 +1490,7 @@ pub fn ensure(&'a self, step: S) -> S::Output { - for el in stack.iter().rev() { - out += &format!("\t{:?}\n", el); - } -- panic!(out); -+ panic!("{}", out); - } - if let Some(out) = self.cache.get(&step) { - self.verbose(&format!("{}c {:?}", " ".repeat(stack.len()), step)); --- -2.31.1 - diff --git a/rustc-1.51.0-backport-pr82289.patch b/rustc-1.51.0-backport-pr82289.patch deleted file mode 100644 index 5cf5433..0000000 --- a/rustc-1.51.0-backport-pr82289.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 5222e2ba2d97cd716a379b4ae6bc62c5f7c2dd36 Mon Sep 17 00:00:00 2001 -From: Giacomo Stevanato -Date: Fri, 19 Feb 2021 12:15:37 +0100 -Subject: [PATCH 1/3] Increment self.len in specialized ZipImpl to avoid - underflow in size_hint - -(cherry picked from commit 66a260617a88ed1ad55a46f03c5a90d5ad3004d3) ---- - library/core/src/iter/adapters/zip.rs | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs -index 9f9835345200..f08bfac837fe 100644 ---- a/library/core/src/iter/adapters/zip.rs -+++ b/library/core/src/iter/adapters/zip.rs -@@ -200,6 +200,7 @@ fn next(&mut self) -> Option<(A::Item, B::Item)> { - } else if A::may_have_side_effect() && self.index < self.a.size() { - let i = self.index; - self.index += 1; -+ self.len += 1; - // match the base implementation's potential side effects - // SAFETY: we just checked that `i` < `self.a.len()` - unsafe { --- -2.31.1 - - -From d39669fc8282830a374d19d204f7b4ee8eb1e381 Mon Sep 17 00:00:00 2001 -From: Giacomo Stevanato -Date: Fri, 19 Feb 2021 12:16:12 +0100 -Subject: [PATCH 2/3] Add test for underflow in specialized Zip's size_hint - -(cherry picked from commit 8b9ac4d4155c74db5b317046033ab9c05a09e351) ---- - library/core/tests/iter/adapters/zip.rs | 20 ++++++++++++++++++++ - 1 file changed, 20 insertions(+) - -diff --git a/library/core/tests/iter/adapters/zip.rs b/library/core/tests/iter/adapters/zip.rs -index 1fce0951e365..a59771039295 100644 ---- a/library/core/tests/iter/adapters/zip.rs -+++ b/library/core/tests/iter/adapters/zip.rs -@@ -245,3 +245,23 @@ fn test_double_ended_zip() { - assert_eq!(it.next_back(), Some((3, 3))); - assert_eq!(it.next(), None); - } -+ -+#[test] -+fn test_issue_82282() { -+ fn overflowed_zip(arr: &[i32]) -> impl Iterator { -+ static UNIT_EMPTY_ARR: [(); 0] = []; -+ -+ let mapped = arr.into_iter().map(|i| *i); -+ let mut zipped = mapped.zip(UNIT_EMPTY_ARR.iter()); -+ zipped.next(); -+ zipped -+ } -+ -+ let arr = [1, 2, 3]; -+ let zip = overflowed_zip(&arr).zip(overflowed_zip(&arr)); -+ -+ assert_eq!(zip.size_hint(), (0, Some(0))); -+ for _ in zip { -+ panic!(); -+ } -+} --- -2.31.1 - - -From 4b382167dd5ed5a6eac0cf314bfb86e3704b6e76 Mon Sep 17 00:00:00 2001 -From: Giacomo Stevanato -Date: Fri, 19 Feb 2021 12:17:48 +0100 -Subject: [PATCH 3/3] Remove useless comparison since now self.index <= - self.len is an invariant - -(cherry picked from commit aeb4ea739efb70e0002a4a9c4c7b8027dd0620b3) ---- - library/core/src/iter/adapters/zip.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs -index f08bfac837fe..dcbcb1ce7200 100644 ---- a/library/core/src/iter/adapters/zip.rs -+++ b/library/core/src/iter/adapters/zip.rs -@@ -261,7 +261,7 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)> - if sz_a != sz_b { - let sz_a = self.a.size(); - if a_side_effect && sz_a > self.len { -- for _ in 0..sz_a - cmp::max(self.len, self.index) { -+ for _ in 0..sz_a - self.len { - self.a.next_back(); - } - } --- -2.31.1 - diff --git a/rustc-1.51.0-backport-pr82292.patch b/rustc-1.51.0-backport-pr82292.patch deleted file mode 100644 index 4baf72a..0000000 --- a/rustc-1.51.0-backport-pr82292.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 0babb88efc4d36f3defafc3c3c0343793fa05d52 Mon Sep 17 00:00:00 2001 -From: Giacomo Stevanato -Date: Wed, 3 Mar 2021 21:09:01 +0100 -Subject: [PATCH 1/2] Prevent Zip specialization from calling - __iterator_get_unchecked twice with the same index after calling next_back - -(cherry picked from commit 2371914a05f8f2763dffe6e2511d0870bcd6b461) ---- - library/core/src/iter/adapters/zip.rs | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/library/core/src/iter/adapters/zip.rs b/library/core/src/iter/adapters/zip.rs -index dcbcb1ce7200..7dac0c63ca2d 100644 ---- a/library/core/src/iter/adapters/zip.rs -+++ b/library/core/src/iter/adapters/zip.rs -@@ -13,9 +13,10 @@ - pub struct Zip { - a: A, - b: B, -- // index and len are only used by the specialized version of zip -+ // index, len and a_len are only used by the specialized version of zip - index: usize, - len: usize, -+ a_len: usize, - } - impl Zip { - pub(in crate::iter) fn new(a: A, b: B) -> Zip { -@@ -110,6 +111,7 @@ impl ZipImpl for Zip - b, - index: 0, // unused - len: 0, // unused -+ a_len: 0, // unused - } - } - -@@ -184,8 +186,9 @@ impl ZipImpl for Zip - B: TrustedRandomAccess + Iterator, - { - fn new(a: A, b: B) -> Self { -- let len = cmp::min(a.size(), b.size()); -- Zip { a, b, index: 0, len } -+ let a_len = a.size(); -+ let len = cmp::min(a_len, b.size()); -+ Zip { a, b, index: 0, len, a_len } - } - - #[inline] -@@ -197,7 +200,7 @@ fn next(&mut self) -> Option<(A::Item, B::Item)> { - unsafe { - Some((self.a.__iterator_get_unchecked(i), self.b.__iterator_get_unchecked(i))) - } -- } else if A::may_have_side_effect() && self.index < self.a.size() { -+ } else if A::may_have_side_effect() && self.index < self.a_len { - let i = self.index; - self.index += 1; - self.len += 1; -@@ -264,6 +267,7 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)> - for _ in 0..sz_a - self.len { - self.a.next_back(); - } -+ self.a_len = self.len; - } - let sz_b = self.b.size(); - if b_side_effect && sz_b > self.len { -@@ -275,6 +279,7 @@ fn next_back(&mut self) -> Option<(A::Item, B::Item)> - } - if self.index < self.len { - self.len -= 1; -+ self.a_len -= 1; - let i = self.len; - // SAFETY: `i` is smaller than the previous value of `self.len`, - // which is also smaller than or equal to `self.a.len()` and `self.b.len()` --- -2.31.1 - - -From 19af66a6f3e2bbb4780bb9eae7eb53bd13e3dd0f Mon Sep 17 00:00:00 2001 -From: Giacomo Stevanato -Date: Fri, 19 Feb 2021 15:25:09 +0100 -Subject: [PATCH 2/2] Add relevant test - -(cherry picked from commit c1bfb9a78db6d481be1d03355672712c766e20b0) ---- - library/core/tests/iter/adapters/zip.rs | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/library/core/tests/iter/adapters/zip.rs b/library/core/tests/iter/adapters/zip.rs -index a59771039295..000c15f72c88 100644 ---- a/library/core/tests/iter/adapters/zip.rs -+++ b/library/core/tests/iter/adapters/zip.rs -@@ -265,3 +265,26 @@ fn overflowed_zip(arr: &[i32]) -> impl Iterator { - panic!(); - } - } -+ -+#[test] -+fn test_issue_82291() { -+ use std::cell::Cell; -+ -+ let mut v1 = [()]; -+ let v2 = [()]; -+ -+ let called = Cell::new(0); -+ -+ let mut zip = v1 -+ .iter_mut() -+ .map(|r| { -+ called.set(called.get() + 1); -+ r -+ }) -+ .zip(&v2); -+ -+ zip.next_back(); -+ assert_eq!(called.get(), 1); -+ zip.next(); -+ assert_eq!(called.get(), 1); -+} --- -2.31.1 - diff --git a/rustc-1.51.0-backport-pr83629.patch b/rustc-1.51.0-backport-pr83629.patch deleted file mode 100644 index 7f68d95..0000000 --- a/rustc-1.51.0-backport-pr83629.patch +++ /dev/null @@ -1,142 +0,0 @@ -From 3834e7b7393bf1a0d7df02ccd1d2e896c1465769 Mon Sep 17 00:00:00 2001 -From: The8472 -Date: Mon, 29 Mar 2021 04:22:34 +0200 -Subject: [PATCH 1/2] add testcase for double-drop during Vec in-place - collection - ---- - library/alloc/tests/vec.rs | 38 +++++++++++++++++++++++++++++++++++++- - 1 file changed, 37 insertions(+), 1 deletion(-) - -diff --git a/library/alloc/tests/vec.rs b/library/alloc/tests/vec.rs -index 5c7ff67bc621..4cdb7eefcdf1 100644 ---- a/library/alloc/tests/vec.rs -+++ b/library/alloc/tests/vec.rs -@@ -954,7 +954,7 @@ fn test_from_iter_specialization_head_tail_drop() { - } - - #[test] --fn test_from_iter_specialization_panic_drop() { -+fn test_from_iter_specialization_panic_during_iteration_drops() { - let drop_count: Vec<_> = (0..=2).map(|_| Rc::new(())).collect(); - let src: Vec<_> = drop_count.iter().cloned().collect(); - let iter = src.into_iter(); -@@ -977,6 +977,42 @@ fn test_from_iter_specialization_panic_drop() { - ); - } - -+#[test] -+fn test_from_iter_specialization_panic_during_drop_leaks() { -+ static mut DROP_COUNTER: usize = 0; -+ -+ #[derive(Debug)] -+ enum Droppable { -+ DroppedTwice(Box), -+ PanicOnDrop, -+ } -+ -+ impl Drop for Droppable { -+ fn drop(&mut self) { -+ match self { -+ Droppable::DroppedTwice(_) => { -+ unsafe { -+ DROP_COUNTER += 1; -+ } -+ println!("Dropping!") -+ } -+ Droppable::PanicOnDrop => { -+ if !std::thread::panicking() { -+ panic!(); -+ } -+ } -+ } -+ } -+ } -+ -+ let _ = std::panic::catch_unwind(AssertUnwindSafe(|| { -+ let v = vec![Droppable::DroppedTwice(Box::new(123)), Droppable::PanicOnDrop]; -+ let _ = v.into_iter().take(0).collect::>(); -+ })); -+ -+ assert_eq!(unsafe { DROP_COUNTER }, 1); -+} -+ - #[test] - fn test_cow_from() { - let borrowed: &[_] = &["borrowed", "(slice)"]; --- -2.31.1 - - -From 8e2706343e1ce1c5a2d3a2ceaaaa010aaeb21d93 Mon Sep 17 00:00:00 2001 -From: The8472 -Date: Mon, 29 Mar 2021 04:22:48 +0200 -Subject: [PATCH 2/2] fix double-drop in in-place collect specialization - ---- - library/alloc/src/vec/into_iter.rs | 27 ++++++++++++++------- - library/alloc/src/vec/source_iter_marker.rs | 4 +-- - 2 files changed, 20 insertions(+), 11 deletions(-) - -diff --git a/library/alloc/src/vec/into_iter.rs b/library/alloc/src/vec/into_iter.rs -index f131d06bb18f..74adced53f6d 100644 ---- a/library/alloc/src/vec/into_iter.rs -+++ b/library/alloc/src/vec/into_iter.rs -@@ -85,20 +85,29 @@ fn as_raw_mut_slice(&mut self) -> *mut [T] { - ptr::slice_from_raw_parts_mut(self.ptr as *mut T, self.len()) - } - -- pub(super) fn drop_remaining(&mut self) { -- unsafe { -- ptr::drop_in_place(self.as_mut_slice()); -- } -- self.ptr = self.end; -- } -+ /// Drops remaining elements and relinquishes the backing allocation. -+ /// -+ /// This is roughly equivalent to the following, but more efficient -+ /// -+ /// ``` -+ /// # let mut into_iter = Vec::::with_capacity(10).into_iter(); -+ /// (&mut into_iter).for_each(core::mem::drop); -+ /// unsafe { core::ptr::write(&mut into_iter, Vec::new().into_iter()); } -+ /// ``` -+ pub(super) fn forget_allocation_drop_remaining(&mut self) { -+ let remaining = self.as_raw_mut_slice(); - -- /// Relinquishes the backing allocation, equivalent to -- /// `ptr::write(&mut self, Vec::new().into_iter())` -- pub(super) fn forget_allocation(&mut self) { -+ // overwrite the individual fields instead of creating a new -+ // struct and then overwriting &mut self. -+ // this creates less assembly - self.cap = 0; - self.buf = unsafe { NonNull::new_unchecked(RawVec::NEW.ptr()) }; - self.ptr = self.buf.as_ptr(); - self.end = self.buf.as_ptr(); -+ -+ unsafe { -+ ptr::drop_in_place(remaining); -+ } - } - } - -diff --git a/library/alloc/src/vec/source_iter_marker.rs b/library/alloc/src/vec/source_iter_marker.rs -index 8c0e95559fa1..9301f7a5184e 100644 ---- a/library/alloc/src/vec/source_iter_marker.rs -+++ b/library/alloc/src/vec/source_iter_marker.rs -@@ -78,9 +78,9 @@ impl SpecFromIter for Vec - } - - // drop any remaining values at the tail of the source -- src.drop_remaining(); - // but prevent drop of the allocation itself once IntoIter goes out of scope -- src.forget_allocation(); -+ // if the drop panics then we also leak any elements collected into dst_buf -+ src.forget_allocation_drop_remaining(); - - let vec = unsafe { - let len = dst.offset_from(dst_buf) as usize; --- -2.31.1 - diff --git a/rustc-1.51.0-disable-http2.patch b/rustc-1.53.0-disable-http2.patch similarity index 72% rename from rustc-1.51.0-disable-http2.patch rename to rustc-1.53.0-disable-http2.patch index 2517a34..94040b3 100644 --- a/rustc-1.51.0-disable-http2.patch +++ b/rustc-1.53.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2021-03-09 10:30:08.626424998 -0800 -+++ rustc-beta-src/Cargo.lock 2021-03-09 10:32:38.096207704 -0800 -@@ -899,7 +899,6 @@ +--- rustc-beta-src/Cargo.lock.orig 2021-06-04 15:56:04.141227630 -0700 ++++ rustc-beta-src/Cargo.lock 2021-06-04 16:03:04.461396826 -0700 +@@ -885,7 +885,6 @@ dependencies = [ "cc", "libc", @@ -8,8 +8,8 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -1860,16 +1859,6 @@ - ] +@@ -1904,16 +1903,6 @@ + checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] -name = "libnghttp2-sys" @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-03-05 08:34:15.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-03-09 10:32:38.096207704 -0800 +--- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2021-06-04 15:56:04.143227587 -0700 ++++ rustc-beta-src/src/tools/cargo/Cargo.toml 2021-06-04 15:57:56.931857927 -0700 @@ -25,7 +25,7 @@ + cargo-util = { path = "crates/cargo-util", version = "0.1.0" } crates-io = { path = "crates/crates-io", version = "0.33.0" } crossbeam-utils = "0.8" - crypto-hash = "0.3.1" -curl = { version = "0.4.23", features = ["http2"] } +curl = { version = "0.4.23", features = [] } curl-sys = "0.4.22" env_logger = "0.8.1" pretty_env_logger = { version = "0.4", optional = true } ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-03-05 08:34:15.000000000 -0800 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-03-09 10:32:38.096207704 -0800 -@@ -412,14 +412,8 @@ +--- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2021-05-22 15:22:31.000000000 -0700 ++++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2021-06-04 16:00:03.903190293 -0700 +@@ -416,14 +416,8 @@ // Also note that pipelining is disabled as curl authors have indicated // that it's buggy, and we've empirically seen that it's buggy with HTTP // proxies. @@ -46,7 +46,7 @@ - let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); - multi - .pipelining(false, multiplexing) -- .chain_err(|| "failed to enable multiplexing/pipelining in curl")?; +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; - - // let's not flood crates.io with connections - multi.set_max_host_connections(2)?; @@ -55,7 +55,7 @@ Ok(PackageSet { packages: package_ids -@@ -592,7 +586,7 @@ +@@ -596,7 +590,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; diff --git a/sources b/sources index 9834690..0df131d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (rustc-1.51.0-src.tar.xz) = ded91468ddf3e6627f00e7ec3d44452aa24eb727a183c0de9d90264f593119a54300d56b09251a88260db480b48554181ae195c538996a32d68d48b6587ac0df +SHA512 (rustc-1.53.0-src.tar.xz) = 70485cf7a0f7fc36ee31644e546374079dc387a85b44e5e793707fd0a4d7ca05d311291e78b86db955485d8f21c47ff9e1908acc4da68ba04929287213a40c24 diff --git a/sources-bootstrap b/sources-bootstrap index 2ad0ad0..0f64443 100644 --- a/sources-bootstrap +++ b/sources-bootstrap @@ -1,7 +1,7 @@ -SHA512 (rustc-1.51.0-src.tar.xz) = ded91468ddf3e6627f00e7ec3d44452aa24eb727a183c0de9d90264f593119a54300d56b09251a88260db480b48554181ae195c538996a32d68d48b6587ac0df -SHA512 (rust-1.50.0-aarch64-unknown-linux-gnu.tar.xz) = e6b409afc8e85a88ecb9ff439a6eb9dcb93d5553e81549fb4f332b9e2d946dce0424319c5092e60aab9435944af70d0117d15c12d54d2059ef73c1fdf36d8273 -SHA512 (rust-1.50.0-armv7-unknown-linux-gnueabihf.tar.xz) = c3314436afc4ebed697bf6828b9eacbc12f96838b156241331a3b71e99e1438f8ad82e701615ea302ebfc459464479442fe653232bd319cf824027362438970d -SHA512 (rust-1.50.0-i686-unknown-linux-gnu.tar.xz) = bff117733d11731f56e8659265d0b47327e2af3f7c46aca494747a92b4f634dd35fa9731a1be59dd69821042f88bded253e1d7b5693ca237c9a167408ca7f898 -SHA512 (rust-1.50.0-powerpc64le-unknown-linux-gnu.tar.xz) = e3dc75ba7dff3a358042542afa398ec8771a23f5f699454a876ddc1f3583d399fe5350696a5da62d71ca97ea882c9ae1fcb60dc2e9fdf76bc7a9af892096371e -SHA512 (rust-1.50.0-s390x-unknown-linux-gnu.tar.xz) = 733513af2a7ef7a782a5ebfbd080071194ac47084022b54b4830de84facef9986d65525f8666a4c226e9878e43b00ebced26d6077e5fb1b7f775ac8f290fba97 -SHA512 (rust-1.50.0-x86_64-unknown-linux-gnu.tar.xz) = ab49e3ecb14e4af8e48548845184e9ab3d564ab2341c1e5462b7847347c79d13324211b860988d219ccb646143bf142fb14c3ab03663b06cfe9ca275128d9fa0 +SHA512 (rustc-1.53.0-src.tar.xz) = 70485cf7a0f7fc36ee31644e546374079dc387a85b44e5e793707fd0a4d7ca05d311291e78b86db955485d8f21c47ff9e1908acc4da68ba04929287213a40c24 +SHA512 (rust-1.52.0-aarch64-unknown-linux-gnu.tar.xz) = 7a26e14be6b27c7084c7c85b312341ab991c2df91ea53128f14707a4c725dd03ba7df30b9e9fcef39a509ab4f5d5feb028b99d6d9ffcc059996ed29b83eb90b9 +SHA512 (rust-1.52.0-armv7-unknown-linux-gnueabihf.tar.xz) = 100b9abdc3dc7852f880eea205056a7a6b78af39fc3b7019ebcac712d5eee3c053f0508a6dc1f9da13074ca476e9fb33514bb83098d3b41964e878c0fc6498d4 +SHA512 (rust-1.52.0-i686-unknown-linux-gnu.tar.xz) = 10fcf9e891ae8bc6e83b5e71c83b34773c18b024c9e9b580cfae714b4e135d313ba5434fc28c2dffa3db2e50669b3acd07e6874de0cfab89b343db92bfbdff80 +SHA512 (rust-1.52.0-powerpc64le-unknown-linux-gnu.tar.xz) = 916a3338c850cf804535e25aebc0fdcf6cea8fe9e5df9fed11fbf03ae81fb8220321dc41edd7133f287dfee0dbf19730ff8b020f32322850329865db76bab95e +SHA512 (rust-1.52.0-s390x-unknown-linux-gnu.tar.xz) = 6a91adf7c1947b63db0bf02b4aa4a36fbbfcc5b40d9c18175e4c5efe785b8a17ff21a887476cf76f7e3d3854f2cc362b5d2dc8243493291a4d19a705276e6355 +SHA512 (rust-1.52.0-x86_64-unknown-linux-gnu.tar.xz) = 27a8db421ae62af92e2c34dcc1fdd617bf7e8de2c68205773a3037be496ccbf21f5549dd18377a9730102e7915519824231218fef9a09abe9d116441d6ce28d2