update to 1.57.0
This commit is contained in:
parent
4144a54909
commit
fa5e5f7c16
@ -1,102 +0,0 @@
|
||||
From eaf7ea1fc339e1ff348ed941ed2e8c4d66f3e458 Mon Sep 17 00:00:00 2001
|
||||
From: Josh Stone <jistone@redhat.com>
|
||||
Date: Thu, 18 Feb 2021 19:14:58 -0800
|
||||
Subject: [PATCH] Revert "Auto merge of #79547 - erikdesjardins:byval,
|
||||
r=nagisa"
|
||||
|
||||
This reverts commit a094ff9590b83c8f94d898f92c2964a5803ded06, reversing
|
||||
changes made to d37afad0cc87bf709ad10c85319296ac53030f03.
|
||||
---
|
||||
compiler/rustc_middle/src/ty/layout.rs | 12 ++++++------
|
||||
...return-value-in-reg.rs => return-value-in-reg.rs} | 4 ++--
|
||||
src/test/codegen/union-abi.rs | 11 +++--------
|
||||
3 files changed, 11 insertions(+), 16 deletions(-)
|
||||
rename src/test/codegen/{arg-return-value-in-reg.rs => return-value-in-reg.rs} (74%)
|
||||
|
||||
diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs
|
||||
index b545b92c9252..545f6aee1a21 100644
|
||||
--- a/compiler/rustc_middle/src/ty/layout.rs
|
||||
+++ b/compiler/rustc_middle/src/ty/layout.rs
|
||||
@@ -2849,7 +2849,7 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
|
||||
|| abi == SpecAbi::RustIntrinsic
|
||||
|| abi == SpecAbi::PlatformIntrinsic
|
||||
{
|
||||
- let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>| {
|
||||
+ let fixup = |arg: &mut ArgAbi<'tcx, Ty<'tcx>>, is_ret: bool| {
|
||||
if arg.is_ignore() {
|
||||
return;
|
||||
}
|
||||
@@ -2887,9 +2887,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
|
||||
_ => return,
|
||||
}
|
||||
|
||||
- // Pass and return structures up to 2 pointers in size by value, matching `ScalarPair`.
|
||||
- // LLVM will usually pass these in 2 registers, which is more efficient than by-ref.
|
||||
- let max_by_val_size = Pointer.size(cx) * 2;
|
||||
+ // Return structures up to 2 pointers in size by value, matching `ScalarPair`. LLVM
|
||||
+ // will usually return these in 2 registers, which is more efficient than by-ref.
|
||||
+ let max_by_val_size = if is_ret { Pointer.size(cx) * 2 } else { Pointer.size(cx) };
|
||||
let size = arg.layout.size;
|
||||
|
||||
if arg.layout.is_unsized() || size > max_by_val_size {
|
||||
@@ -2901,9 +2901,9 @@ fn adjust_for_abi(&mut self, cx: &C, abi: SpecAbi) {
|
||||
arg.cast_to(Reg { kind: RegKind::Integer, size });
|
||||
}
|
||||
};
|
||||
- fixup(&mut self.ret);
|
||||
+ fixup(&mut self.ret, true);
|
||||
for arg in &mut self.args {
|
||||
- fixup(arg);
|
||||
+ fixup(arg, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
diff --git a/src/test/codegen/arg-return-value-in-reg.rs b/src/test/codegen/return-value-in-reg.rs
|
||||
similarity index 74%
|
||||
rename from src/test/codegen/arg-return-value-in-reg.rs
|
||||
rename to src/test/codegen/return-value-in-reg.rs
|
||||
index a69291d47821..4bc0136c5e32 100644
|
||||
--- a/src/test/codegen/arg-return-value-in-reg.rs
|
||||
+++ b/src/test/codegen/return-value-in-reg.rs
|
||||
@@ -1,4 +1,4 @@
|
||||
-//! Check that types of up to 128 bits are passed and returned by-value instead of via pointer.
|
||||
+//! This test checks that types of up to 128 bits are returned by-value instead of via out-pointer.
|
||||
|
||||
// compile-flags: -C no-prepopulate-passes -O
|
||||
// only-x86_64
|
||||
@@ -11,7 +11,7 @@ pub struct S {
|
||||
c: u32,
|
||||
}
|
||||
|
||||
-// CHECK: define i128 @modify(i128{{( %0)?}})
|
||||
+// CHECK: define i128 @modify(%S* noalias nocapture dereferenceable(16) %s)
|
||||
#[no_mangle]
|
||||
pub fn modify(s: S) -> S {
|
||||
S { a: s.a + s.a, b: s.b + s.b, c: s.c + s.c }
|
||||
diff --git a/src/test/codegen/union-abi.rs b/src/test/codegen/union-abi.rs
|
||||
index f282fd237054..afea01e9a2d0 100644
|
||||
--- a/src/test/codegen/union-abi.rs
|
||||
+++ b/src/test/codegen/union-abi.rs
|
||||
@@ -63,16 +63,11 @@ pub union UnionU128{a:u128}
|
||||
#[no_mangle]
|
||||
pub fn test_UnionU128(_: UnionU128) -> UnionU128 { loop {} }
|
||||
|
||||
-pub union UnionU128x2{a:(u128, u128)}
|
||||
-// CHECK: define void @test_UnionU128x2(i128 %_1.0, i128 %_1.1)
|
||||
-#[no_mangle]
|
||||
-pub fn test_UnionU128x2(_: UnionU128x2) { loop {} }
|
||||
-
|
||||
#[repr(C)]
|
||||
-pub union CUnionU128x2{a:(u128, u128)}
|
||||
-// CHECK: define void @test_CUnionU128x2(%CUnionU128x2* {{.*}} %_1)
|
||||
+pub union CUnionU128{a:u128}
|
||||
+// CHECK: define void @test_CUnionU128(%CUnionU128* {{.*}} %_1)
|
||||
#[no_mangle]
|
||||
-pub fn test_CUnionU128x2(_: CUnionU128x2) { loop {} }
|
||||
+pub fn test_CUnionU128(_: CUnionU128) { loop {} }
|
||||
|
||||
pub union UnionBool { b:bool }
|
||||
// CHECK: define zeroext i1 @test_UnionBool(i8 %b)
|
||||
--
|
||||
2.29.2
|
||||
|
||||
@ -1,108 +0,0 @@
|
||||
From 974192cd98b3efca8e5cd293f641f561e7487b30 Mon Sep 17 00:00:00 2001
|
||||
From: Cheng XU <git@xuc.me>
|
||||
Date: Tue, 30 Mar 2021 10:24:23 +0800
|
||||
Subject: [PATCH] Disallow octal format in Ipv4 string
|
||||
|
||||
In its original specification, leading zero in Ipv4 string is interpreted
|
||||
as octal literals. So a IP address 0127.0.0.1 actually means 87.0.0.1.
|
||||
|
||||
This confusion can lead to many security vulnerabilities. Therefore, in
|
||||
[IETF RFC 6943], it suggests to disallow octal/hexadecimal format in Ipv4
|
||||
string all together.
|
||||
|
||||
Existing implementation already disallows hexadecimal numbers. This commit
|
||||
makes Parser reject octal numbers.
|
||||
|
||||
Fixes #83648.
|
||||
|
||||
[IETF RFC 6943]: https://tools.ietf.org/html/rfc6943#section-3.1.1
|
||||
---
|
||||
library/std/src/net/ip.rs | 2 ++
|
||||
library/std/src/net/parser.rs | 14 +++++++++++++-
|
||||
library/std/src/net/parser/tests.rs | 8 ++++++++
|
||||
3 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/library/std/src/net/ip.rs b/library/std/src/net/ip.rs
|
||||
index 2aa305d7f831e..7f8c33dac561f 100644
|
||||
--- a/library/std/src/net/ip.rs
|
||||
+++ b/library/std/src/net/ip.rs
|
||||
@@ -67,7 +67,9 @@ pub enum IpAddr {
|
||||
///
|
||||
/// `Ipv4Addr` provides a [`FromStr`] implementation. The four octets are in decimal
|
||||
/// notation, divided by `.` (this is called "dot-decimal notation").
|
||||
+/// Notably, octal numbers and hexadecimal numbers are not allowed per [IETF RFC 6943].
|
||||
///
|
||||
+/// [IETF RFC 6943]: https://tools.ietf.org/html/rfc6943#section-3.1.1
|
||||
/// [`FromStr`]: crate::str::FromStr
|
||||
///
|
||||
/// # Examples
|
||||
diff --git a/library/std/src/net/parser.rs b/library/std/src/net/parser.rs
|
||||
index 7064ed3ed236d..88a8cb76befbf 100644
|
||||
--- a/library/std/src/net/parser.rs
|
||||
+++ b/library/std/src/net/parser.rs
|
||||
@@ -67,6 +67,11 @@ impl<'a> Parser<'a> {
|
||||
if self.state.is_empty() { result } else { None }.ok_or(AddrParseError(()))
|
||||
}
|
||||
|
||||
+ /// Peek the next character from the input
|
||||
+ fn peek_char(&self) -> Option<char> {
|
||||
+ self.state.first().map(|&b| char::from(b))
|
||||
+ }
|
||||
+
|
||||
/// Read the next character from the input
|
||||
fn read_char(&mut self) -> Option<char> {
|
||||
self.state.split_first().map(|(&b, tail)| {
|
||||
@@ -132,7 +137,14 @@ impl<'a> Parser<'a> {
|
||||
let mut groups = [0; 4];
|
||||
|
||||
for (i, slot) in groups.iter_mut().enumerate() {
|
||||
- *slot = p.read_separator('.', i, |p| p.read_number(10, None))?;
|
||||
+ *slot = p.read_separator('.', i, |p| {
|
||||
+ // Disallow octal number in IP string.
|
||||
+ // https://tools.ietf.org/html/rfc6943#section-3.1.1
|
||||
+ match (p.peek_char(), p.read_number(10, None)) {
|
||||
+ (Some('0'), Some(number)) if number != 0 => None,
|
||||
+ (_, number) => number,
|
||||
+ }
|
||||
+ })?;
|
||||
}
|
||||
|
||||
Some(groups.into())
|
||||
diff --git a/library/std/src/net/parser/tests.rs b/library/std/src/net/parser/tests.rs
|
||||
index 8d8889cd19d36..6d2d48ecad02f 100644
|
||||
--- a/library/std/src/net/parser/tests.rs
|
||||
+++ b/library/std/src/net/parser/tests.rs
|
||||
@@ -8,11 +8,15 @@ const SCOPE_ID: u32 = 1337;
|
||||
const IPV4: Ipv4Addr = Ipv4Addr::new(192, 168, 0, 1);
|
||||
const IPV4_STR: &str = "192.168.0.1";
|
||||
const IPV4_STR_PORT: &str = "192.168.0.1:8080";
|
||||
+const IPV4_STR_WITH_OCTAL: &str = "0127.0.0.1";
|
||||
+const IPV4_STR_WITH_HEX: &str = "0x10.0.0.1";
|
||||
|
||||
const IPV6: Ipv6Addr = Ipv6Addr::new(0x2001, 0xdb8, 0, 0, 0, 0, 0xc0a8, 0x1);
|
||||
const IPV6_STR_FULL: &str = "2001:db8:0:0:0:0:c0a8:1";
|
||||
const IPV6_STR_COMPRESS: &str = "2001:db8::c0a8:1";
|
||||
const IPV6_STR_V4: &str = "2001:db8::192.168.0.1";
|
||||
+const IPV6_STR_V4_WITH_OCTAL: &str = "2001:db8::0127.0.0.1";
|
||||
+const IPV6_STR_V4_WITH_HEX: &str = "2001:db8::0x10.0.0.1";
|
||||
const IPV6_STR_PORT: &str = "[2001:db8::c0a8:1]:8080";
|
||||
const IPV6_STR_PORT_SCOPE_ID: &str = "[2001:db8::c0a8:1%1337]:8080";
|
||||
|
||||
@@ -22,6 +26,8 @@ fn parse_ipv4() {
|
||||
assert_eq!(result, IPV4);
|
||||
|
||||
assert!(Ipv4Addr::from_str(IPV4_STR_PORT).is_err());
|
||||
+ assert!(Ipv4Addr::from_str(IPV4_STR_WITH_OCTAL).is_err());
|
||||
+ assert!(Ipv4Addr::from_str(IPV4_STR_WITH_HEX).is_err());
|
||||
assert!(Ipv4Addr::from_str(IPV6_STR_FULL).is_err());
|
||||
assert!(Ipv4Addr::from_str(IPV6_STR_COMPRESS).is_err());
|
||||
assert!(Ipv4Addr::from_str(IPV6_STR_V4).is_err());
|
||||
@@ -39,6 +45,8 @@ fn parse_ipv6() {
|
||||
let result: Ipv6Addr = IPV6_STR_V4.parse().unwrap();
|
||||
assert_eq!(result, IPV6);
|
||||
|
||||
+ assert!(Ipv6Addr::from_str(IPV6_STR_V4_WITH_OCTAL).is_err());
|
||||
+ assert!(Ipv6Addr::from_str(IPV6_STR_V4_WITH_HEX).is_err());
|
||||
assert!(Ipv6Addr::from_str(IPV4_STR).is_err());
|
||||
assert!(Ipv6Addr::from_str(IPV4_STR_PORT).is_err());
|
||||
assert!(Ipv6Addr::from_str(IPV6_STR_PORT).is_err());
|
||||
@ -12,7 +12,7 @@ index 243f6ac0..c2dd8785 100644
|
||||
--- a/src/tools/cargo/src/bin/cargo/cli.rs
|
||||
+++ b/src/tools/cargo/src/bin/cargo/cli.rs
|
||||
@@ -92,7 +92,12 @@ Run with 'cargo -Z [FLAG] [SUBCOMMAND]'"
|
||||
if is_verbose {
|
||||
} else if is_verbose {
|
||||
drop_println!(config, " {:<20} {}", name, path.display());
|
||||
} else {
|
||||
- drop_println!(config, " {}", name);
|
||||
@ -24,7 +24,7 @@ index 243f6ac0..c2dd8785 100644
|
||||
+ }
|
||||
}
|
||||
}
|
||||
}
|
||||
CommandInfo::Alias { target } => {
|
||||
--
|
||||
2.30.0
|
||||
|
||||
|
||||
@ -1,39 +0,0 @@
|
||||
From c2b79c6142da1a757f9b4a0b58883e39aade779c Mon Sep 17 00:00:00 2001
|
||||
From: caodongxia <315816521@qq.com>
|
||||
Date: Tue, 24 Aug 2021 09:11:28 +0800
|
||||
Subject: [PATCH] fix rustdoc error info
|
||||
|
||||
---
|
||||
compiler/rustc_session/src/config.rs | 2 +-
|
||||
vendor/rustc-ap-rustc_session/src/config.rs | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
|
||||
index a6d4dcb34..ab8ef7a3c 100644
|
||||
--- a/compiler/rustc_session/src/config.rs
|
||||
+++ b/compiler/rustc_session/src/config.rs
|
||||
@@ -891,7 +891,7 @@ pub fn build_target_config(opts: &Options, target_override: Option<Target>) -> T
|
||||
opts.error_format,
|
||||
&format!(
|
||||
"Error loading target specification: {}. \
|
||||
- Use `--print target-list` for a list of built-in targets",
|
||||
+ Use `rustc --print target-list` for a list of built-in targets",
|
||||
e
|
||||
),
|
||||
)
|
||||
diff --git a/vendor/rustc-ap-rustc_session/src/config.rs b/vendor/rustc-ap-rustc_session/src/config.rs
|
||||
index 9d73c3b44..223e4eead 100644
|
||||
--- a/vendor/rustc-ap-rustc_session/src/config.rs
|
||||
+++ b/vendor/rustc-ap-rustc_session/src/config.rs
|
||||
@@ -891,7 +891,7 @@ pub fn build_target_config(opts: &Options, target_override: Option<Target>) -> T
|
||||
opts.error_format,
|
||||
&format!(
|
||||
"Error loading target specification: {}. \
|
||||
- Use `--print target-list` for a list of built-in targets",
|
||||
+ Use `rustc --print target-list` for a list of built-in targets",
|
||||
e
|
||||
),
|
||||
)
|
||||
--
|
||||
2.27.0
|
||||
|
||||
59
remove-field-is-never-read-warning.patch
Normal file
59
remove-field-is-never-read-warning.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From aca8bcb48feca8c87b9af4e440835992d3f6d470 Mon Sep 17 00:00:00 2001
|
||||
From: Pietro Albini <pietro.albini@ferrous-systems.com>
|
||||
Date: Tue, 19 Oct 2021 09:29:19 +0200
|
||||
Subject: [PATCH] remove "field is never read" warning
|
||||
|
||||
---
|
||||
src/bootstrap/lib.rs | 1 -
|
||||
src/bootstrap/metadata.rs | 3 +--
|
||||
src/tools/bump-stage0/src/main.rs | 1 -
|
||||
3 files changed, 1 insertion(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
|
||||
index 2d4e1527897..3b3c8a9227d 100644
|
||||
--- a/src/bootstrap/lib.rs
|
||||
+++ b/src/bootstrap/lib.rs
|
||||
@@ -277,7 +277,6 @@ pub struct Build {
|
||||
struct Crate {
|
||||
name: Interned<String>,
|
||||
deps: HashSet<Interned<String>>,
|
||||
- id: String,
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs
|
||||
index a38391c7b88..65e229697dc 100644
|
||||
--- a/src/bootstrap/metadata.rs
|
||||
+++ b/src/bootstrap/metadata.rs
|
||||
@@ -14,7 +14,6 @@ struct Output {
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct Package {
|
||||
- id: String,
|
||||
name: String,
|
||||
source: Option<String>,
|
||||
manifest_path: String,
|
||||
@@ -50,7 +49,7 @@ pub fn build(build: &mut Build) {
|
||||
.filter(|dep| dep.source.is_none())
|
||||
.map(|dep| INTERNER.intern_string(dep.name))
|
||||
.collect();
|
||||
- build.crates.insert(name, Crate { name, id: package.id, deps, path });
|
||||
+ build.crates.insert(name, Crate { name, deps, path });
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs
|
||||
index 96d3c873843..d6364e28fef 100644
|
||||
--- a/src/tools/bump-stage0/src/main.rs
|
||||
+++ b/src/tools/bump-stage0/src/main.rs
|
||||
@@ -196,7 +196,6 @@ struct ManifestPackage {
|
||||
|
||||
#[derive(Debug, serde::Deserialize)]
|
||||
struct ManifestTargetPackage {
|
||||
- available: bool,
|
||||
url: Option<String>,
|
||||
hash: Option<String>,
|
||||
xz_url: Option<String>,
|
||||
--
|
||||
2.30.0
|
||||
|
||||
67
rust.spec
67
rust.spec
@ -1,9 +1,9 @@
|
||||
%global rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x
|
||||
%{!?channel: %global channel stable}
|
||||
%global bootstrap_rust 1.50.0
|
||||
%global bootstrap_cargo 1.50.0
|
||||
%global bootstrap_channel 1.50.0
|
||||
%global bootstrap_date 2021-02-11
|
||||
%global bootstrap_rust 1.56.0
|
||||
%global bootstrap_cargo 1.56.0
|
||||
%global bootstrap_channel 1.56.0
|
||||
%global bootstrap_date 2022-01-22
|
||||
%bcond_with llvm_static
|
||||
%bcond_with bundled_llvm
|
||||
%bcond_without bundled_libgit2
|
||||
@ -11,8 +11,8 @@
|
||||
%bcond_without curl_http2
|
||||
%bcond_without lldb
|
||||
Name: rust
|
||||
Version: 1.51.0
|
||||
Release: 9
|
||||
Version: 1.57.0
|
||||
Release: 1
|
||||
Summary: The Rust Programming Language
|
||||
License: (ASL 2.0 or MIT) and (BSD and MIT)
|
||||
URL: https://www.rust-lang.org
|
||||
@ -22,24 +22,14 @@ ExclusiveArch: %{rust_arches}
|
||||
%else
|
||||
%global rustc_package rustc-%{channel}-src
|
||||
%endif
|
||||
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
|
||||
Source1: rustc-%{version}-src.tar.xz.aa
|
||||
Source2: rustc-%{version}-src.tar.xz.ab
|
||||
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz
|
||||
|
||||
Patch0001: 0001-Revert-Auto-merge-of-79547.patch
|
||||
Patch0002: rustc-1.51.0-backport-pr81741.patch
|
||||
Patch0003: rustc-1.51.0-backport-pr82289.patch
|
||||
Patch0004: rustc-1.51.0-backport-pr82292.patch
|
||||
Patch0005: rustc-1.51.0-backport-pr81910.patch
|
||||
Patch0006: rustc-1.51.0-backport-pr81728.patch
|
||||
Patch0007: rustc-1.51.0-backport-pr83629.patch
|
||||
Patch0008: rustc-1.48.0-disable-libssh2.patch
|
||||
Patch0009: rustc-1.51.0-disable-http2.patch
|
||||
Patch0010: clippy-driver-usage-should-user-friendly.patch
|
||||
Patch0011: cargo-help-clippy-should-have-description-to-user.patch
|
||||
Patch0012: fix-a-println-wrong-format.patch
|
||||
Patch0013: CVE-2021-29922.patch
|
||||
Patch0014: fix-rustdoc-error-info.patch
|
||||
Patch0000: rustc-1.56.0-disable-libssh2.patch
|
||||
Patch0001: rustc-1.56.0-disable-http2.patch
|
||||
Patch0002: clippy-driver-usage-should-user-friendly.patch
|
||||
Patch0003: cargo-help-clippy-should-have-description-to-user.patch
|
||||
Patch0004: fix-a-println-wrong-format.patch
|
||||
Patch0005: remove-field-is-never-read-warning.patch
|
||||
%{lua: function rust_triple(arch)
|
||||
local abi = "gnu"
|
||||
if arch == "armv7hl" then
|
||||
@ -239,10 +229,6 @@ Obsoletes: %{name}-doc < %{version}-%{release} %{name}-cargo-doc < %{version}-
|
||||
Man pages and other related help documents for rust.
|
||||
|
||||
%prep
|
||||
cd ../SOURCES
|
||||
cat %{SOURCE1} %{SOURCE2} | tar xJ
|
||||
cd ..
|
||||
|
||||
%ifarch %{bootstrap_arches}
|
||||
%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
|
||||
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
|
||||
@ -251,28 +237,20 @@ test -f '%{local_rust_root}/bin/cargo'
|
||||
test -f '%{local_rust_root}/bin/rustc'
|
||||
%endif
|
||||
%setup -q -n %{rustc_package}
|
||||
%patch0001 -p1
|
||||
%patch0002 -p1
|
||||
%patch0003 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
%patch0006 -p1
|
||||
%patch0007 -p1
|
||||
%if %with disabled_libssh2
|
||||
%patch0008 -p1
|
||||
%patch0000 -p1
|
||||
%endif
|
||||
%if %without curl_http2
|
||||
%patch0009 -p1
|
||||
%patch0001 -p1
|
||||
rm -rf vendor/libnghttp2-sys/
|
||||
%endif
|
||||
%if "%{python}" != "python3"
|
||||
sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure
|
||||
%endif
|
||||
%patch0010 -p1
|
||||
%patch0011 -p1
|
||||
%patch0012 -p1
|
||||
%patch0013 -p1
|
||||
%patch0014 -p1
|
||||
%patch0002 -p1
|
||||
%patch0003 -p1
|
||||
%patch0004 -p1
|
||||
%patch0005 -p1
|
||||
rm -rf vendor/curl-sys/curl/
|
||||
rm -rf vendor/jemalloc-sys/jemalloc/
|
||||
rm -rf vendor/libssh2-sys/libssh2/
|
||||
@ -312,7 +290,7 @@ export %{rust_env}
|
||||
%ifarch %{arm} %{ix86} s390x
|
||||
%define enable_debuginfo --debuginfo-level=0 --debuginfo-level-std=2
|
||||
%else
|
||||
%define enable_debuginfo --debuginfo-level=2
|
||||
%define enable_debuginfo --debuginfo-level=1
|
||||
%endif
|
||||
%ifnarch %{power64}
|
||||
%define codegen_units_std --set rust.codegen-units-std=1
|
||||
@ -414,6 +392,7 @@ export %{rust_env}
|
||||
%dir %{rustlibdir}/%{rust_musl_triple}/lib
|
||||
%{rustlibdir}/%{rust_musl_triple}/lib/*.rlib
|
||||
%{rustlibdir}/%{rust_musl_triple}/lib/self-contained/*.o
|
||||
%{rustlibdir}/%{rust_musl_triple}/lib/self-contained/libunwind.a
|
||||
|
||||
%files debugger-common
|
||||
%dir %{rustlibdir}
|
||||
@ -479,6 +458,7 @@ export %{rust_env}
|
||||
%{_docdir}/%{name}/html/*.png
|
||||
%{_docdir}/%{name}/html/*.svg
|
||||
%{_docdir}/%{name}/html/*.woff
|
||||
%{_docdir}/%{name}/html/*.woff2
|
||||
%license %{_docdir}/%{name}/html/*.md
|
||||
%{_docdir}/cargo/html
|
||||
%{_mandir}/man1/rustc.1*
|
||||
@ -486,6 +466,9 @@ export %{rust_env}
|
||||
%{_mandir}/man1/cargo*.1*
|
||||
|
||||
%changelog
|
||||
* Mon Feb 14 2022 chenchen <chen_aka_jan@163.com> - 1.57.0-1
|
||||
- Update to 1.57.0
|
||||
|
||||
* Tue Aug 24 2021 caodongxia <caodongxia@huawei.com> - 1.51.0-9
|
||||
- Fix rustdoc error info
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
--- rustc-1.48.0-src/Cargo.lock.orig 2020-11-16 06:01:53.000000000 -0800
|
||||
+++ rustc-1.48.0-src/Cargo.lock 2020-11-16 09:27:44.425104404 -0800
|
||||
@@ -1676,7 +1676,6 @@
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
- "libssh2-sys",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
@@ -1693,20 +1692,6 @@
|
||||
]
|
||||
|
||||
[[package]]
|
||||
-name = "libssh2-sys"
|
||||
-version = "0.2.19"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "ca46220853ba1c512fc82826d0834d87b06bcd3c2a42241b7de72f3d2fe17056"
|
||||
-dependencies = [
|
||||
- "cc",
|
||||
- "libc",
|
||||
- "libz-sys",
|
||||
- "openssl-sys",
|
||||
- "pkg-config",
|
||||
- "vcpkg",
|
||||
-]
|
||||
-
|
||||
-[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
--- rustc-1.48.0-src/vendor/git2/Cargo.toml.orig 2020-11-16 06:27:49.000000000 -0800
|
||||
+++ rustc-1.48.0-src/vendor/git2/Cargo.toml 2020-11-16 09:27:44.425104404 -0800
|
||||
@@ -49,7 +49,7 @@
|
||||
version = "0.1.39"
|
||||
|
||||
[features]
|
||||
-default = ["ssh", "https", "ssh_key_from_memory"]
|
||||
+default = ["https"]
|
||||
https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"]
|
||||
ssh = ["libgit2-sys/ssh"]
|
||||
ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"]
|
||||
@ -1,181 +0,0 @@
|
||||
From 70f17ca715d3d7e2fd79cc909b95fd3a6357c13e Mon Sep 17 00:00:00 2001
|
||||
From: Yechan Bae <yechan@gatech.edu>
|
||||
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<B, T, S>(slice: &[S], sep: &[T]) -> Vec<T>
|
||||
// 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<B, T, S>(slice: &[S], sep: &[T]) -> Vec<T>
|
||||
.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<bool>,
|
||||
+ }
|
||||
+
|
||||
+ impl Default for WeirdBorrow {
|
||||
+ fn default() -> Self {
|
||||
+ WeirdBorrow { state: Cell::new(false) }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ impl Borrow<str> 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 <yechan@gatech.edu>
|
||||
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<B, T, S>(slice: &[S], sep: &[T]) -> Vec<T>
|
||||
})
|
||||
.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<B, T, S>(slice: &[S], sep: &[T]) -> Vec<T>
|
||||
// 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
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
From 40d3f2d7ef5835317fe9df9ecc01f4c363def4fd Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian@centricular.com>
|
||||
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
|
||||
|
||||
@ -1,48 +0,0 @@
|
||||
From 852684d306cee955ed751f1e8d8eec6adaecff3b Mon Sep 17 00:00:00 2001
|
||||
From: Joshua Nelson <jyn514@gmail.com>
|
||||
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<S: Step>(&'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
|
||||
|
||||
@ -1,96 +0,0 @@
|
||||
From 5222e2ba2d97cd716a379b4ae6bc62c5f7c2dd36 Mon Sep 17 00:00:00 2001
|
||||
From: Giacomo Stevanato <giaco.stevanato@gmail.com>
|
||||
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 <giaco.stevanato@gmail.com>
|
||||
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<Item = (i32, &())> {
|
||||
+ 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 <giaco.stevanato@gmail.com>
|
||||
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
|
||||
|
||||
@ -1,120 +0,0 @@
|
||||
From 0babb88efc4d36f3defafc3c3c0343793fa05d52 Mon Sep 17 00:00:00 2001
|
||||
From: Giacomo Stevanato <giaco.stevanato@gmail.com>
|
||||
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, B> {
|
||||
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<A: Iterator, B: Iterator> Zip<A, B> {
|
||||
pub(in crate::iter) fn new(a: A, b: B) -> Zip<A, B> {
|
||||
@@ -110,6 +111,7 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
|
||||
b,
|
||||
index: 0, // unused
|
||||
len: 0, // unused
|
||||
+ a_len: 0, // unused
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,8 +186,9 @@ impl<A, B> ZipImpl<A, B> for Zip<A, B>
|
||||
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 <giaco.stevanato@gmail.com>
|
||||
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<Item = (i32, &())> {
|
||||
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
|
||||
|
||||
@ -1,142 +0,0 @@
|
||||
From 3834e7b7393bf1a0d7df02ccd1d2e896c1465769 Mon Sep 17 00:00:00 2001
|
||||
From: The8472 <git@infinite-source.de>
|
||||
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<i32>),
|
||||
+ 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::<Vec<_>>();
|
||||
+ }));
|
||||
+
|
||||
+ 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 <git@infinite-source.de>
|
||||
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::<u8>::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<T, I> SpecFromIter<T, I> for Vec<T>
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
@ -1,66 +0,0 @@
|
||||
--- 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 @@
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
- "libnghttp2-sys",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
@@ -1860,16 +1859,6 @@
|
||||
]
|
||||
|
||||
[[package]]
|
||||
-name = "libnghttp2-sys"
|
||||
-version = "0.1.4+1.41.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1"
|
||||
-dependencies = [
|
||||
- "cc",
|
||||
- "libc",
|
||||
-]
|
||||
-
|
||||
-[[package]]
|
||||
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
|
||||
@@ -25,7 +25,7 @@
|
||||
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 @@
|
||||
// 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.
|
||||
- let mut multi = Multi::new();
|
||||
- let multiplexing = config.http_config()?.multiplexing.unwrap_or(true);
|
||||
- multi
|
||||
- .pipelining(false, multiplexing)
|
||||
- .chain_err(|| "failed to enable multiplexing/pipelining in curl")?;
|
||||
-
|
||||
- // let's not flood crates.io with connections
|
||||
- multi.set_max_host_connections(2)?;
|
||||
+ let multi = Multi::new();
|
||||
+ let multiplexing = false;
|
||||
|
||||
Ok(PackageSet {
|
||||
packages: package_ids
|
||||
@@ -592,7 +586,7 @@
|
||||
macro_rules! try_old_curl {
|
||||
($e:expr, $msg:expr) => {
|
||||
let result = $e;
|
||||
- if cfg!(target_os = "macos") {
|
||||
+ if cfg!(any(target_os = "linux", target_os = "macos")) {
|
||||
if let Err(e) = result {
|
||||
warn!("ignoring libcurl {} error: {}", $msg, e);
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
86
rustc-1.56.0-disable-http2.patch
Normal file
86
rustc-1.56.0-disable-http2.patch
Normal file
@ -0,0 +1,86 @@
|
||||
From a27b88852f2e2f48d4a0434d2ef546d1ff29329c Mon Sep 17 00:00:00 2001
|
||||
From: sdlzx <hdu_sdlzx@163.com>
|
||||
Date: Fri, 17 Dec 2021 23:27:57 +0800
|
||||
Subject: disable http2
|
||||
|
||||
---
|
||||
Cargo.lock | 11 -----------
|
||||
src/tools/cargo/Cargo.toml | 2 +-
|
||||
src/tools/cargo/src/cargo/core/package.rs | 12 +++---------
|
||||
3 files changed, 4 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 26f68e235..926c2db74 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -877,7 +877,6 @@ checksum = "e0f44960aea24a786a46907b8824ebc0e66ca06bf4e4978408c7499620343483"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
- "libnghttp2-sys",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
@@ -1906,16 +1905,6 @@ version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
|
||||
|
||||
-[[package]]
|
||||
-name = "libnghttp2-sys"
|
||||
-version = "0.1.4+1.41.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "03624ec6df166e79e139a2310ca213283d6b3c30810c54844f307086d4488df1"
|
||||
-dependencies = [
|
||||
- "cc",
|
||||
- "libc",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.3"
|
||||
diff --git a/src/tools/cargo/Cargo.toml b/src/tools/cargo/Cargo.toml
|
||||
index ba5b956dd..eca593482 100644
|
||||
--- a/src/tools/cargo/Cargo.toml
|
||||
+++ b/src/tools/cargo/Cargo.toml
|
||||
@@ -25,7 +25,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" }
|
||||
cargo-util = { path = "crates/cargo-util", version = "0.1.1" }
|
||||
crates-io = { path = "crates/crates-io", version = "0.33.0" }
|
||||
crossbeam-utils = "0.8"
|
||||
-curl = { version = "0.4.39", features = ["http2"] }
|
||||
+curl = { version = "0.4.39", features = [] }
|
||||
curl-sys = "0.4.48"
|
||||
env_logger = "0.9.0"
|
||||
pretty_env_logger = { version = "0.4", optional = true }
|
||||
diff --git a/src/tools/cargo/src/cargo/core/package.rs b/src/tools/cargo/src/cargo/core/package.rs
|
||||
index 6605a348e..92a01a89c 100644
|
||||
--- a/src/tools/cargo/src/cargo/core/package.rs
|
||||
+++ b/src/tools/cargo/src/cargo/core/package.rs
|
||||
@@ -417,14 +417,8 @@ impl<'cfg> PackageSet<'cfg> {
|
||||
// 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.
|
||||
- let mut multi = Multi::new();
|
||||
- let multiplexing = config.http_config()?.multiplexing.unwrap_or(true);
|
||||
- multi
|
||||
- .pipelining(false, multiplexing)
|
||||
- .with_context(|| "failed to enable multiplexing/pipelining in curl")?;
|
||||
-
|
||||
- // let's not flood crates.io with connections
|
||||
- multi.set_max_host_connections(2)?;
|
||||
+ let multi = Multi::new();
|
||||
+ let multiplexing = false;
|
||||
|
||||
Ok(PackageSet {
|
||||
packages: package_ids
|
||||
@@ -653,7 +647,7 @@ impl<'cfg> PackageSet<'cfg> {
|
||||
macro_rules! try_old_curl {
|
||||
($e:expr, $msg:expr) => {
|
||||
let result = $e;
|
||||
- if cfg!(target_os = "macos") {
|
||||
+ if cfg!(any(target_os = "linux", target_os = "macos")) {
|
||||
if let Err(e) = result {
|
||||
warn!("ignoring libcurl {} error: {}", $msg, e);
|
||||
}
|
||||
--
|
||||
2.33.1
|
||||
|
||||
59
rustc-1.56.0-disable-libssh2.patch
Normal file
59
rustc-1.56.0-disable-libssh2.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 2e519b6b69557ce39444b39e34db6e660c710aa2 Mon Sep 17 00:00:00 2001
|
||||
From: sdlzx <hdu_sdlzx@163.com>
|
||||
Date: Fri, 17 Dec 2021 23:26:22 +0800
|
||||
Subject: disable libssh2
|
||||
|
||||
---
|
||||
Cargo.lock | 15 ---------------
|
||||
vendor/git2/Cargo.toml | 2 +-
|
||||
2 files changed, 1 insertion(+), 16 deletions(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 4f1a5ca35..26f68e235 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -1895,7 +1895,6 @@ checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
- "libssh2-sys",
|
||||
"libz-sys",
|
||||
"openssl-sys",
|
||||
"pkg-config",
|
||||
@@ -1917,20 +1916,6 @@ dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "libssh2-sys"
|
||||
-version = "0.2.19"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "ca46220853ba1c512fc82826d0834d87b06bcd3c2a42241b7de72f3d2fe17056"
|
||||
-dependencies = [
|
||||
- "cc",
|
||||
- "libc",
|
||||
- "libz-sys",
|
||||
- "openssl-sys",
|
||||
- "pkg-config",
|
||||
- "vcpkg",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "libz-sys"
|
||||
version = "1.1.3"
|
||||
diff --git a/vendor/git2/Cargo.toml b/vendor/git2/Cargo.toml
|
||||
index 4481d79c6..4e869c55f 100644
|
||||
--- a/vendor/git2/Cargo.toml
|
||||
+++ b/vendor/git2/Cargo.toml
|
||||
@@ -52,7 +52,7 @@ version = "3.3.0"
|
||||
version = "0.1.39"
|
||||
|
||||
[features]
|
||||
-default = ["ssh", "https", "ssh_key_from_memory"]
|
||||
+default = ["https"]
|
||||
https = ["libgit2-sys/https", "openssl-sys", "openssl-probe"]
|
||||
ssh = ["libgit2-sys/ssh"]
|
||||
ssh_key_from_memory = ["libgit2-sys/ssh_key_from_memory"]
|
||||
--
|
||||
2.33.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user