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 0000000000000000000000000000000000000000..fa75ad3a934e1cb3be012316b3a178f4f8841724 --- /dev/null +++ b/0001-Use-lld-provided-by-system-for-wasm.patch @@ -0,0 +1,26 @@ +From b521511174b1a08dddfac243604d649b71cc7386 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 de7b7374af31..eebbe616e9b6 100644 +--- a/compiler/rustc_target/src/spec/wasm_base.rs ++++ b/compiler/rustc_target/src/spec/wasm_base.rs +@@ -99,8 +99,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".into()), ++ linker: Some("lld".into()), + lld_flavor: LldFlavor::Wasm, + linker_is_gnu: false, + +-- +2.35.1 + diff --git a/0001-rustc_transmute-fix-big-endian-discriminants.patch b/0001-rustc_transmute-fix-big-endian-discriminants.patch new file mode 100644 index 0000000000000000000000000000000000000000..372852d31790550c93f7b8c63f4f26ac90417f1c --- /dev/null +++ b/0001-rustc_transmute-fix-big-endian-discriminants.patch @@ -0,0 +1,53 @@ +From 2946828fcb8e2e68a16839dfcf4319bf119f8acd Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Tue, 20 Sep 2022 13:03:43 -0700 +Subject: [PATCH] rustc_transmute: fix big-endian discriminants + +(cherry picked from commit a72666ed56ec5f1b6d254c7020cf86143edc6dbd) +--- + compiler/rustc_transmute/src/layout/tree.rs | 22 +++++++++++++++------ + 1 file changed, 16 insertions(+), 6 deletions(-) + +diff --git a/compiler/rustc_transmute/src/layout/tree.rs b/compiler/rustc_transmute/src/layout/tree.rs +index 70b3ba02b05b..e4fcde35ed37 100644 +--- a/compiler/rustc_transmute/src/layout/tree.rs ++++ b/compiler/rustc_transmute/src/layout/tree.rs +@@ -402,7 +402,7 @@ fn from_repr_c_variant( + .unwrap(); + tracing::trace!(?discr_layout, "computed discriminant layout"); + variant_layout = variant_layout.extend(discr_layout).unwrap().0; +- tree = tree.then(Self::from_disr(discr, tcx, layout_summary.discriminant_size)); ++ tree = tree.then(Self::from_discr(discr, tcx, layout_summary.discriminant_size)); + } + + // Next come fields. +@@ -442,11 +442,21 @@ fn from_repr_c_variant( + Ok(tree) + } + +- pub fn from_disr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { +- // FIXME(@jswrenn): I'm certain this is missing needed endian nuance. +- let bytes = discr.val.to_ne_bytes(); +- let bytes = &bytes[..size]; +- Self::Seq(bytes.into_iter().copied().map(|b| Self::from_bits(b)).collect()) ++ pub fn from_discr(discr: Discr<'tcx>, tcx: TyCtxt<'tcx>, size: usize) -> Self { ++ use rustc_target::abi::Endian; ++ ++ let bytes: [u8; 16]; ++ let bytes = match tcx.data_layout.endian { ++ Endian::Little => { ++ bytes = discr.val.to_le_bytes(); ++ &bytes[..size] ++ } ++ Endian::Big => { ++ bytes = discr.val.to_be_bytes(); ++ &bytes[bytes.len() - size..] ++ } ++ }; ++ Self::Seq(bytes.iter().map(|&b| Self::from_bits(b)).collect()) + } + } + +-- +2.37.3 + diff --git a/rust.spec b/rust.spec index fb5f6f6d6f96dc9fee2921a73d7b8940464a98c7..f6f1b44743bf9a7721bd603adabe28dab8b58e51 100644 --- a/rust.spec +++ b/rust.spec @@ -1,8 +1,7 @@ -%{!?channel: %global channel stable} -%global bootstrap_rust 1.59.0 -%global bootstrap_cargo 1.59.0 -%global bootstrap_channel 1.59.0 -%global bootstrap_date 2022-04-19 +%global bootstrap_rust 1.63.0 +%global bootstrap_cargo 1.63.0 +%global bootstrap_channel 1.63.0 +%global bootstrap_date 2022-08-11 %bcond_with llvm_static %bcond_with bundled_llvm %bcond_without bundled_libgit2 @@ -10,23 +9,25 @@ %bcond_without curl_http2 %bcond_without lldb Name: rust -Version: 1.60.0 +Version: 1.64.0 Release: 1 Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) URL: https://www.rust-lang.org -%if "%{channel}" == "stable" -%global rustc_package rustc-%{version}-src -%else -%global rustc_package rustc-%{channel}-src -%endif -Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.gz +Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.xz Patch0000: rustc-1.60.0-disable-libssh2.patch -Patch0001: rustc-1.60.0-disable-http2.patch +Patch0001: rustc-1.63.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 +# By default, rust tries to use "rust-lld" as a linker for WebAssembly. +Patch0005: 0001-Use-lld-provided-by-system-for-wasm.patch +# Set a substitute-path in rust-gdb for standard library sources. +Patch0006: rustc-1.61.0-rust-gdb-substitute-path.patch +# https://github.com/rust-lang/rust/pull/102076 +Patch0007: 0001-rustc_transmute-fix-big-endian-discriminants.patch + %{lua: function rust_triple(arch) local abi = "gnu" if arch == "armv7hl" then @@ -100,7 +101,7 @@ BuildRequires: %{llvm}-static libffi-devel %endif %endif BuildRequires: procps-ng -BuildRequires: ninja-build +BuildRequires: ninja-build libstdc++-static Provides: rustc = %{version}-%{release} Provides: rustc%{?_isa} = %{version}-%{release} Requires: %{name}-std-static%{?_isa} = %{version}-%{release} @@ -177,7 +178,7 @@ Conflicts: rustfmt-preview < 1.0.0 A tool for formatting Rust code according to style guidelines. %package -n rls -Summary: Rust Language Server for IDE integration +Summary: Rust Language Server for IDE integration (deprecated) %if %with bundled_libgit2 Provides: bundled(libgit2) = 1.1.0 %endif @@ -189,8 +190,16 @@ Conflicts: rls-preview < 1.31.6 %description -n rls The Rust Language Server provides a server that runs in the background, providing IDEs, editors, and other tools with information about Rust programs. -It supports functionality such as 'goto definition', symbol search, -reformatting, and code completion, and enables renaming and refactorings. +RLS is being deprecated in favor of rust-analyzer, and may be removed in the future. +https://blog.rust-lang.org/2022/07/01/RLS-deprecation.html + +%package analyzer +Summary: Rust implementation of the Language Server Protocol + +%description analyzer +rust-analyzer is an implementation of Language Server Protocol for the Rust +programming language. It provides features like completion and goto definition +for many code editors, including VS Code, Emacs and Vim. %package -n clippy Summary: Lints to catch common mistakes and improve your Rust code @@ -233,7 +242,7 @@ Man pages and other related help documents for rust. test -f '%{local_rust_root}/bin/cargo' test -f '%{local_rust_root}/bin/rustc' %endif -%setup -q -n %{rustc_package} +%setup -q -n rustc-%{version}-src %if %with disabled_libssh2 %patch0000 -p1 %endif @@ -247,6 +256,9 @@ sed -i.try-python -e '/^try python3 /i try "%{python}" "$@"' ./configure %patch0002 -p1 %patch0003 -p1 %patch0004 -p1 +%patch0005 -p1 +%patch0006 -p1 +%patch0007 -p1 rm -rf vendor/curl-sys/curl/ rm -rf vendor/jemalloc-sys/jemalloc/ rm -rf vendor/libssh2-sys/libssh2/ @@ -308,7 +320,7 @@ fi --disable-rpath \ %{enable_debuginfo} \ --enable-extended \ - --tools=analysis,cargo,clippy,rls,rustfmt,src \ + --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ %{?codegen_units_std} \ @@ -362,6 +374,7 @@ export %{rust_env} %{python} ./x.py test --no-fail-fast --stage 2 cargo || : %{python} ./x.py test --no-fail-fast --stage 2 clippy || : %{python} ./x.py test --no-fail-fast --stage 2 rls || : +%{python} ./x.py test --no-fail-fast --stage 2 rust-analyzer || : %{python} ./x.py test --no-fail-fast --stage 2 rustfmt || : %ldconfig_scriptlets @@ -375,6 +388,7 @@ export %{rust_env} %dir %{rustlibdir} %dir %{rustlibdir}/%{rust_triple} %dir %{rustlibdir}/%{rust_triple}/lib +%{_libexecdir}/rust-analyzer-proc-macro-srv %{rustlibdir}/%{rust_triple}/lib/*.so %dir %{rustlibdir}/%{rust_musl_triple} %dir %{rustlibdir}/%{rust_musl_triple}/lib @@ -428,6 +442,11 @@ export %{rust_env} %doc src/tools/rls/{README.md,COPYRIGHT,debugging.md} %license src/tools/rls/LICENSE-{APACHE,MIT} +%files analyzer +%{_bindir}/rust-analyzer +%doc src/tools/rust-analyzer/README.md +%license src/tools/rust-analyzer/LICENSE-{APACHE,MIT} + %files -n clippy %{_bindir}/cargo-clippy %{_bindir}/clippy-driver @@ -454,7 +473,6 @@ export %{rust_env} %{_docdir}/%{name}/html/*.js %{_docdir}/%{name}/html/*.png %{_docdir}/%{name}/html/*.svg -%{_docdir}/%{name}/html/*.woff %{_docdir}/%{name}/html/*.woff2 %license %{_docdir}/%{name}/html/*.md %{_docdir}/cargo/html @@ -463,6 +481,9 @@ export %{rust_env} %{_mandir}/man1/cargo*.1* %changelog +* Thu May 11 2023 wangkai <13474090681@163.com> - 1.64.0-1 +- Update to 1.64.0 + * Tue Nov 01 2022 wangkai - 1.60.0-1 - Update to 1.60.0 diff --git a/rustc-1.61.0-rust-gdb-substitute-path.patch b/rustc-1.61.0-rust-gdb-substitute-path.patch new file mode 100644 index 0000000000000000000000000000000000000000..b94e23ec779439692d48ae499549b46c7b11ab56 --- /dev/null +++ b/rustc-1.61.0-rust-gdb-substitute-path.patch @@ -0,0 +1,18 @@ +--- rustc-1.61.0-src/src/etc/rust-gdb.orig 2022-05-17 18:29:36.000000000 -0700 ++++ rustc-1.61.0-src/src/etc/rust-gdb 2022-05-18 11:18:13.732709661 -0700 +@@ -14,6 +14,9 @@ fi + RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)" + GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc" + ++RUST_STD_BUILD="@BUILDDIR@/library/" ++RUST_STD_SRC="$RUSTC_SYSROOT/lib/rustlib/src/rust/library/" ++ + # Run GDB with the additional arguments that load the pretty printers + # Set the environment variable `RUST_GDB` to overwrite the call to a + # different/specific command (defaults to `gdb`). +@@ -21,4 +24,5 @@ RUST_GDB="${RUST_GDB:-gdb}" + PYTHONPATH="$PYTHONPATH:$GDB_PYTHON_MODULE_DIRECTORY" exec ${RUST_GDB} \ + --directory="$GDB_PYTHON_MODULE_DIRECTORY" \ + -iex "add-auto-load-safe-path $GDB_PYTHON_MODULE_DIRECTORY" \ ++ -iex "set substitute-path $RUST_STD_BUILD $RUST_STD_SRC" \ + "$@" diff --git a/rustc-1.60.0-disable-http2.patch b/rustc-1.63.0-disable-http2.patch similarity index 41% rename from rustc-1.60.0-disable-http2.patch rename to rustc-1.63.0-disable-http2.patch index d8234a0043728d92c9a2435c2703b2a26e1ff219..2e0c8f2926c697a42efb1398b927d6272c81b19c 100644 --- a/rustc-1.60.0-disable-http2.patch +++ b/rustc-1.63.0-disable-http2.patch @@ -1,19 +1,6 @@ -From 9669318f57818f7ae497ef2bdedcd635298e2ce4 Mon Sep 17 00:00:00 2001 -From: Liu Zixian -Date: Tue, 19 Apr 2022 22:28:00 +0800 -Subject: [PATCH] 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 8baf4fbd9..79740b777 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -958,7 +958,6 @@ checksum = "d130987e6a6a34fe0889e1083022fa48cd90e6709a84be3fb8dd95801de5af20" +--- rustc-1.63.0-src/Cargo.lock.orig 2022-08-10 12:25:16.512185135 -0700 ++++ rustc-1.63.0-src/Cargo.lock 2022-08-10 12:25:16.513185114 -0700 +@@ -1054,7 +1054,6 @@ dependencies = [ "cc", "libc", @@ -21,11 +8,10 @@ index 8baf4fbd9..79740b777 100644 "libz-sys", "openssl-sys", "pkg-config", -@@ -2008,16 +2007,6 @@ version = "0.1.4" - source = "registry+https://github.com/rust-lang/crates.io-index" +@@ -2160,16 +2159,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" --[[package]] + [[package]] -name = "libnghttp2-sys" -version = "0.1.4+1.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" @@ -35,30 +21,50 @@ index 8baf4fbd9..79740b777 100644 - "libc", -] - - [[package]] +-[[package]] name = "libz-sys" version = "1.1.3" -diff --git a/src/tools/cargo/Cargo.toml b/src/tools/cargo/Cargo.toml -index fba5257a8..9fe466d6d 100644 ---- a/src/tools/cargo/Cargo.toml -+++ b/src/tools/cargo/Cargo.toml -@@ -22,7 +22,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.2" } - cargo-util = { path = "crates/cargo-util", version = "0.1.2" } + source = "registry+https://github.com/rust-lang/crates.io-index" +--- rustc-1.63.0-src/src/tools/cargo/Cargo.toml.orig 2022-08-10 12:25:16.514185093 -0700 ++++ rustc-1.63.0-src/src/tools/cargo/Cargo.toml 2022-08-10 12:25:51.441455282 -0700 +@@ -22,7 +22,7 @@ + cargo-util = { path = "crates/cargo-util", version = "0.2.1" } crates-io = { path = "crates/crates-io", version = "0.34.0" } crossbeam-utils = "0.8" --curl = { version = "0.4.41", features = ["http2"] } -+curl = { version = "0.4.41", features = [] } - curl-sys = "0.4.50" +-curl = { version = "0.4.43", features = ["http2"] } ++curl = { version = "0.4.43", features = [] } + curl-sys = "0.4.55" 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 0ebe0277e..1b3fc1ee1 100644 ---- a/src/tools/cargo/src/cargo/core/package.rs -+++ b/src/tools/cargo/src/cargo/core/package.rs -@@ -412,14 +412,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. +--- rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-08-08 15:47:35.000000000 -0700 ++++ rustc-1.63.0-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-08-10 12:25:16.514185093 -0700 +@@ -192,16 +192,8 @@ + } + self.fetch_started = true; + +- // We've enabled the `http2` feature of `curl` in Cargo, so treat +- // failures here as fatal as it would indicate a build-time problem. +- self.multiplexing = self.config.http_config()?.multiplexing.unwrap_or(true); +- +- self.multi +- .pipelining(false, self.multiplexing) +- .with_context(|| "failed to enable multiplexing/pipelining in curl")?; +- +- // let's not flood the server with connections +- self.multi.set_max_host_connections(2)?; ++ // Multiplexing is disabled because the system libcurl doesn't support it. ++ self.multiplexing = false; + + self.config + .shell() +--- rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-08-08 15:47:35.000000000 -0700 ++++ rustc-1.63.0-src/src/tools/cargo/src/cargo/core/package.rs 2022-08-10 12:25:16.514185093 -0700 +@@ -403,16 +403,9 @@ + sources: SourceMap<'cfg>, + config: &'cfg Config, + ) -> CargoResult> { +- // We've enabled the `http2` feature of `curl` in Cargo, so treat +- // failures here as fatal as it would indicate a build-time problem. - let mut multi = Multi::new(); - let multiplexing = config.http_config()?.multiplexing.unwrap_or(true); - multi @@ -67,12 +73,13 @@ index 0ebe0277e..1b3fc1ee1 100644 - - // let's not flood crates.io with connections - multi.set_max_host_connections(2)?; ++ // Multiplexing is disabled because the system libcurl doesn't support it. + let multi = Multi::new(); + let multiplexing = false; Ok(PackageSet { packages: package_ids -@@ -648,7 +642,7 @@ impl<'cfg> PackageSet<'cfg> { +@@ -658,7 +651,7 @@ macro_rules! try_old_curl { ($e:expr, $msg:expr) => { let result = $e; @@ -81,6 +88,3 @@ index 0ebe0277e..1b3fc1ee1 100644 if let Err(e) = result { warn!("ignoring libcurl {} error: {}", $msg, e); } --- -2.35.1 - diff --git a/rustc-1.60.0-src.tar.gz b/rustc-1.64.0-src.tar.xz similarity index 67% rename from rustc-1.60.0-src.tar.gz rename to rustc-1.64.0-src.tar.xz index baf5ddc4fef3a7e5e6ef6a702b3310c3a25ed5d4..2f9cf6394ed04f5053696a571248e36437d48e31 100644 Binary files a/rustc-1.60.0-src.tar.gz and b/rustc-1.64.0-src.tar.xz differ