diff --git a/.gitignore b/.gitignore index a82d7cc..28ca26f 100644 --- a/.gitignore +++ b/.gitignore @@ -404,3 +404,4 @@ /rustc-1.62.0-src.tar.xz /rustc-1.62.1-src.tar.xz /rustc-1.63.0-src.tar.xz +/rustc-1.64.0-src.tar.xz 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 0000000..372852d --- /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 9f4aa26..a0953ba 100644 --- a/rust.spec +++ b/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.62.0 -%global bootstrap_channel 1.62.0 -%global bootstrap_date 2022-06-30 +%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 @@ -46,7 +46,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.5 +%global bundled_llvm_version 14.0.6 %bcond_with bundled_llvm # Requires stable libgit2 1.4, and not the next minor soname change. @@ -83,7 +83,7 @@ %endif Name: rust -Version: 1.63.0 +Version: 1.64.0 Release: 1%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) @@ -106,6 +106,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,7 +123,7 @@ 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. @@ -486,7 +489,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 @@ -501,8 +504,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 @@ -574,6 +586,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 %patch2 -p1 +%patch3 -p1 %if %with disabled_libssh2 %patch100 -p1 @@ -736,7 +749,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 \ @@ -776,15 +789,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 '{}' '+' @@ -863,6 +876,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 || : @@ -875,6 +890,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} @@ -1009,6 +1025,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 @@ -1032,6 +1054,10 @@ end} %changelog +* Thu Sep 22 2022 Josh Stone - 1.64.0-1 +- Update to 1.64.0. +- Add rust-analyzer. + * Thu Aug 11 2022 Josh Stone - 1.63.0-1 - Update to 1.63.0. diff --git a/rustc-1.58.0-no-default-pie.patch b/rustc-1.64.0-no-default-pie.patch similarity index 90% rename from rustc-1.58.0-no-default-pie.patch rename to rustc-1.64.0-no-default-pie.patch index 67fb0c6..c9dd827 100644 --- a/rustc-1.58.0-no-default-pie.patch +++ b/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/sources b/sources index 88d8af1..ce4b974 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (rustc-1.63.0-src.tar.xz) = 0dd3cd1546bd9c1438afe0c4694e1ed80507f6b437674682c0474e13f83457e9ced4560ddeee58602e01837140f9e34a9e24c6828643dd6f613e07755af6997c +SHA512 (rustc-1.64.0-src.tar.xz) = 919f40acd8c6eaaef399aa3248503bea19feb96697ab221aaede9ee789ce340b47cb899d1e0e41a31e5d7756653968a10d2faaa4aee83294c9f1243949b43516 SHA512 (wasi-libc-9886d3d6200fcc3726329966860fc058707406cd.tar.gz) = 5b6af0f7133d31c2c068606737eff957126a3045e09c1e95bd2650e0c5637d4797d7036b9beb167829d38d58f6d4199852832f61b0c8836f05e945cd0cf68132