From 95b530860f3e489938dd2fcf2b1b008494de2184 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 15 Nov 2022 18:22:42 +0000 Subject: [PATCH] import rust-1.64.0-1.module+el8.8.0+17119+c0a26b8e --- .gitignore | 2 +- .rust.metadata | 2 +- ...ansmute-fix-big-endian-discriminants.patch | 53 ++++++++++++++ ...patch => rustc-1.63.0-disable-http2.patch} | 30 ++++---- ...atch => rustc-1.64.0-no-default-pie.patch} | 9 +-- SPECS/rust.spec | 71 +++++++++++++------ 6 files changed, 125 insertions(+), 42 deletions(-) create mode 100644 SOURCES/0001-rustc_transmute-fix-big-endian-discriminants.patch rename SOURCES/{rustc-1.62.0-disable-http2.patch => rustc-1.63.0-disable-http2.patch} (72%) rename SOURCES/{rustc-1.58.0-no-default-pie.patch => rustc-1.64.0-no-default-pie.patch} (90%) diff --git a/.gitignore b/.gitignore index 91dc566..79513a6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -SOURCES/rustc-1.62.1-src.tar.xz +SOURCES/rustc-1.64.0-src.tar.xz SOURCES/wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz diff --git a/.rust.metadata b/.rust.metadata index 59abd03..d1d92bc 100644 --- a/.rust.metadata +++ b/.rust.metadata @@ -1,2 +1,2 @@ -a7e0c2aa676d343f5980d37fd50ffaed9a35d458 SOURCES/rustc-1.62.1-src.tar.xz +83391c9ba7e69158036afb15fcfd8d24198e98ce SOURCES/rustc-1.64.0-src.tar.xz 22625595caa645e86282b79b5564abb40250d244 SOURCES/wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz diff --git a/SOURCES/0001-rustc_transmute-fix-big-endian-discriminants.patch b/SOURCES/0001-rustc_transmute-fix-big-endian-discriminants.patch new file mode 100644 index 0000000..372852d --- /dev/null +++ b/SOURCES/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/SOURCES/rustc-1.62.0-disable-http2.patch b/SOURCES/rustc-1.63.0-disable-http2.patch similarity index 72% rename from SOURCES/rustc-1.62.0-disable-http2.patch rename to SOURCES/rustc-1.63.0-disable-http2.patch index 71b019e..2e0c8f2 100644 --- a/SOURCES/rustc-1.62.0-disable-http2.patch +++ b/SOURCES/rustc-1.63.0-disable-http2.patch @@ -1,6 +1,6 @@ ---- rustc-beta-src/Cargo.lock.orig 2022-06-22 14:03:26.309745526 -0700 -+++ rustc-beta-src/Cargo.lock 2022-06-22 14:03:26.310745506 -0700 -@@ -990,7 +990,6 @@ +--- 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", @@ -8,7 +8,7 @@ "libz-sys", "openssl-sys", "pkg-config", -@@ -2101,16 +2100,6 @@ +@@ -2160,16 +2159,6 @@ checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" [[package]] @@ -25,20 +25,20 @@ name = "libz-sys" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" ---- rustc-beta-src/src/tools/cargo/Cargo.toml.orig 2022-06-22 14:03:26.310745506 -0700 -+++ rustc-beta-src/src/tools/cargo/Cargo.toml 2022-06-22 14:04:22.058596881 -0700 +--- 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.1.3" } + 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 } ---- rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs.orig 2022-06-13 07:34:54.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/sources/registry/http_remote.rs 2022-06-22 14:03:26.311745485 -0700 -@@ -183,16 +183,8 @@ +--- 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; @@ -57,8 +57,8 @@ self.config .shell() ---- rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs.orig 2022-06-13 07:34:54.000000000 -0700 -+++ rustc-beta-src/src/tools/cargo/src/cargo/core/package.rs 2022-06-22 14:03:26.311745485 -0700 +--- 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, diff --git a/SOURCES/rustc-1.58.0-no-default-pie.patch b/SOURCES/rustc-1.64.0-no-default-pie.patch similarity index 90% rename from SOURCES/rustc-1.58.0-no-default-pie.patch rename to SOURCES/rustc-1.64.0-no-default-pie.patch index 67fb0c6..c9dd827 100644 --- a/SOURCES/rustc-1.58.0-no-default-pie.patch +++ b/SOURCES/rustc-1.64.0-no-default-pie.patch @@ -1,8 +1,8 @@ diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs -index 638b2a7b5a9f..79d4ecf4cb91 100644 +index 63207803e327..f5757760c409 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs -@@ -763,7 +763,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( +@@ -741,7 +741,7 @@ fn link_natively<'a>( && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie") { info!("linker output: {:?}", out); @@ -11,7 +11,7 @@ index 638b2a7b5a9f..79d4ecf4cb91 100644 for arg in cmd.take_args() { if arg.to_string_lossy() != "-no-pie" { cmd.arg(arg); -@@ -782,7 +782,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( +@@ -760,7 +760,7 @@ fn link_natively<'a>( && cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie") { info!("linker output: {:?}", out); @@ -20,12 +20,13 @@ index 638b2a7b5a9f..79d4ecf4cb91 100644 "Linker does not support -static-pie command line option. Retrying with -static instead." ); // Mirror `add_(pre,post)_link_objects` to replace CRT objects. -@@ -1507,15 +1507,14 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { +@@ -1507,15 +1507,15 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } fn link_output_kind(sess: &Session, crate_type: CrateType) -> LinkOutputKind { - let kind = match (crate_type, sess.crt_static(Some(crate_type)), sess.relocation_model()) { + // Only use PIE if explicitly specified. ++ #[cfg_attr(not(bootstrap), allow(rustc::bad_opt_access))] + let explicit_pic = + matches!(sess.opts.cg.relocation_model, Some(RelocModel::Pic | RelocModel::Pie)); + let kind = match (crate_type, sess.crt_static(Some(crate_type)), explicit_pic) { diff --git a/SPECS/rust.spec b/SPECS/rust.spec index 8ab0681..5240075 100644 --- a/SPECS/rust.spec +++ b/SPECS/rust.spec @@ -8,9 +8,9 @@ # To bootstrap from scratch, set the channel and date from src/stage0.json # e.g. 1.59.0 wants rustc: 1.58.0-2022-01-13 # or nightly wants some beta-YYYY-MM-DD -%global bootstrap_version 1.61.0 -%global bootstrap_channel 1.61.0 -%global bootstrap_date 2022-05-19 +%global bootstrap_version 1.63.0 +%global bootstrap_channel 1.63.0 +%global bootstrap_date 2022-08-11 # Only the specified arches will use bootstrap binaries. # NOTE: Those binaries used to be uploaded with every new release, but that was @@ -50,7 +50,7 @@ # We can also choose to just use Rust's bundled LLVM, in case the system LLVM # is insufficient. Rust currently requires LLVM 12.0+. %global min_llvm_version 12.0.0 -%global bundled_llvm_version 14.0.4 +%global bundled_llvm_version 14.0.6 %bcond_with bundled_llvm # Requires stable libgit2 1.4, and not the next minor soname change. @@ -87,7 +87,7 @@ %endif Name: rust -Version: 1.62.1 +Version: 1.64.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -110,6 +110,9 @@ Patch1: 0001-Use-lld-provided-by-system-for-wasm.patch # Set a substitute-path in rust-gdb for standard library sources. Patch2: rustc-1.61.0-rust-gdb-substitute-path.patch +# https://github.com/rust-lang/rust/pull/102076 +Patch3: 0001-rustc_transmute-fix-big-endian-discriminants.patch + ### RHEL-specific patches below ### # Simple rpm macros for rust-toolset (as opposed to full rust-packaging) @@ -120,11 +123,11 @@ Patch100: rustc-1.59.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.62.0-disable-http2.patch +Patch101: rustc-1.63.0-disable-http2.patch # kernel rh1410097 causes too-small stacks for PIE. # (affects RHEL6 kernels when building for RHEL7) -Patch102: rustc-1.58.0-no-default-pie.patch +Patch102: rustc-1.64.0-no-default-pie.patch # Get the Rust triple for any arch. @@ -491,7 +494,7 @@ 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) = %{bundled_libgit2_version} %endif @@ -506,8 +509,17 @@ Provides: rls-preview = %{version}-%{release} %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 @@ -579,6 +591,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 +%patch3 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -635,7 +648,7 @@ ln -s /usr/bin/cmake3 cmake-bin/cmake # Static linking to distro LLVM needs to add -lffi # https://github.com/rust-lang/rust/issues/34486 sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \ - src/librustc_llvm/lib.rs + compiler/rustc_llvm/src/lib.rs %endif # The configure macro will modify some autoconf-related files, which upsets @@ -741,7 +754,7 @@ end} %{enable_debuginfo} \ --set rust.codegen-units-std=1 \ --enable-extended \ - --tools=analysis,cargo,clippy,rls,rustfmt,src \ + --tools=analysis,cargo,clippy,rls,rust-analyzer,rustfmt,src \ --enable-vendor \ --enable-verbose-tests \ --dist-compression-formats=gz \ @@ -781,15 +794,15 @@ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ # The libdir libraries are identical to those under rustlib/. It's easier on # library loading if we keep them in libdir, but we do need them in rustlib/ # to support dynamic linking for compiler plugins, so we'll symlink. -(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && - find ../../../../%{_lib} -maxdepth 1 -name '*.so' | - while read lib; do - if [ -f "${lib##*/}" ]; then - # make sure they're actually identical! - cmp "$lib" "${lib##*/}" - ln -v -f -s -t . "$lib" - fi - done) +find %{buildroot}%{rustlibdir}/%{rust_triple}/lib/ -maxdepth 1 -type f -name '*.so' | +while read lib; do + lib2="%{buildroot}%{_libdir}/${lib##*/}" + if [ -f "$lib2" ]; then + # make sure they're actually identical! + cmp "$lib" "$lib2" + ln -v -f -r -s -T "$lib2" "$lib" + fi +done # Remove installer artifacts (manifests, uninstall scripts, etc.) find %{buildroot}%{rustlibdir} -maxdepth 1 -type f -exec rm -v '{}' '+' @@ -868,6 +881,8 @@ rm -rf "./build/%{rust_triple}/stage2-tools/%{rust_triple}/cit/" env RLS_TEST_WAIT_FOR_AGES=1 \ %{__python3} ./x.py test --no-fail-fast --stage 2 rls || : +%{__python3} ./x.py test --no-fail-fast --stage 2 rust-analyzer || : + %{__python3} ./x.py test --no-fail-fast --stage 2 rustfmt || : @@ -880,6 +895,7 @@ env RLS_TEST_WAIT_FOR_AGES=1 \ %{_bindir}/rustc %{_bindir}/rustdoc %{_libdir}/*.so +%{_libexecdir}/rust-analyzer-proc-macro-srv %{_mandir}/man1/rustc.1* %{_mandir}/man1/rustdoc.1* %dir %{rustlibdir} @@ -1014,6 +1030,12 @@ end} %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 @@ -1037,6 +1059,13 @@ end} %changelog +* Thu Sep 22 2022 Josh Stone - 1.64.0-1 +- Update to 1.64.0. +- Add rust-analyzer. + +* Wed Sep 07 2022 Josh Stone - 1.63.0-1 +- Update to 1.63.0. + * Tue Jul 19 2022 Josh Stone - 1.62.1-1 - Update to 1.62.1.