From 1e4eb64a8ce51cb213917de75df3959d19c8377a Mon Sep 17 00:00:00 2001 From: clubby789 Date: Fri, 17 Feb 2023 14:32:08 +0000 Subject: [PATCH 1/6] Don't eagerly convert principal to string --- .../rustc_lint/src/deref_into_dyn_supertrait.rs | 2 +- compiler/rustc_lint/src/lints.rs | 5 ++--- compiler/rustc_middle/src/ty/sty.rs | 6 ++++++ tests/ui/lint/issue-108155.rs | 15 +++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 tests/ui/lint/issue-108155.rs diff --git a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs index dff5a645c175e..a45d8156c244c 100644 --- a/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs +++ b/compiler/rustc_lint/src/deref_into_dyn_supertrait.rs @@ -78,7 +78,7 @@ impl<'tcx> LateLintPass<'tcx> for DerefIntoDynSupertrait { }); cx.emit_spanned_lint(DEREF_INTO_DYN_SUPERTRAIT, cx.tcx.def_span(item.owner_id.def_id), SupertraitAsDerefTarget { t, - target_principal: target_principal.to_string(), + target_principal, label, }); } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index c997d8945d16e..329ece28ef837 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -8,7 +8,7 @@ use rustc_errors::{ }; use rustc_hir::def_id::DefId; use rustc_macros::{LintDiagnostic, Subdiagnostic}; -use rustc_middle::ty::{Predicate, Ty, TyCtxt}; +use rustc_middle::ty::{PolyExistentialTraitRef, Predicate, Ty, TyCtxt}; use rustc_session::parse::ParseSess; use rustc_span::{edition::Edition, sym, symbol::Ident, Span, Symbol}; @@ -556,8 +556,7 @@ pub struct BuiltinUnexpectedCliConfigValue { #[diag(lint_supertrait_as_deref_target)] pub struct SupertraitAsDerefTarget<'a> { pub t: Ty<'a>, - pub target_principal: String, - // pub target_principal: Binder<'a, ExistentialTraitRef<'b>>, + pub target_principal: PolyExistentialTraitRef<'a>, #[subdiagnostic] pub label: Option, } diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 6a7b23e40a779..91a7d5d38a1ef 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -931,6 +931,12 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { } } +impl rustc_errors::IntoDiagnosticArg for PolyExistentialTraitRef<'_> { + fn into_diagnostic_arg(self) -> rustc_errors::DiagnosticArgValue<'static> { + self.to_string().into_diagnostic_arg() + } +} + #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)] #[derive(HashStable)] pub enum BoundVariableKind { diff --git a/tests/ui/lint/issue-108155.rs b/tests/ui/lint/issue-108155.rs new file mode 100644 index 0000000000000..4ae0cbd92ff16 --- /dev/null +++ b/tests/ui/lint/issue-108155.rs @@ -0,0 +1,15 @@ +// check-pass +// check that `deref_into_dyn_supertrait` doesn't cause ICE by eagerly converting +// a cancelled lint + +#![allow(deref_into_dyn_supertrait)] + +trait Trait {} +impl std::ops::Deref for dyn Trait + Send + Sync { + type Target = dyn Trait; + fn deref(&self) -> &Self::Target { + self + } +} + +fn main() {} From 79fa13422ee33145b6f6f6d45bf9aff53cf00c09 Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:18:54 +0100 Subject: [PATCH 2/6] Revert "enable ThinLTO for rustc on x86_64-pc-windows-msvc dist builds" This lead to a miscompilation in at least `char::is_whitespace` and probably in more unknown places..... This reverts commit 684663ed380d0e6a6e135aed9c6055ab4ba94ac8. --- .github/workflows/ci.yml | 2 +- src/ci/github-actions/ci.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2071c46340cad..349332f8cf5a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -438,7 +438,7 @@ jobs: os: windows-latest-xl - name: dist-x86_64-msvc env: - RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=x86_64-pc-windows-msvc --target=x86_64-pc-windows-msvc --enable-full-tools --enable-profiler --set rust.lto=thin" + RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --host=x86_64-pc-windows-msvc --target=x86_64-pc-windows-msvc --enable-full-tools --enable-profiler" SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist bootstrap --include-default-paths DIST_REQUIRE_ALL_TOOLS: 1 os: windows-latest-xl diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index df07d4fae7117..743b57ed46e4f 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -675,7 +675,6 @@ jobs: --target=x86_64-pc-windows-msvc --enable-full-tools --enable-profiler - --set rust.lto=thin SCRIPT: PGO_HOST=x86_64-pc-windows-msvc src/ci/pgo.sh python x.py dist bootstrap --include-default-paths DIST_REQUIRE_ALL_TOOLS: 1 <<: *job-windows-xl From 775805adea3c2d46a7ff8eb09d1861fb287898b1 Mon Sep 17 00:00:00 2001 From: Mu001999 Date: Tue, 14 Mar 2023 11:22:45 +0800 Subject: [PATCH 3/6] Create dir for build_triple --- src/bootstrap/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index d44b96cfb991e..0474ab344fe2d 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -593,6 +593,7 @@ impl Build { // Make a symbolic link so we can use a consistent directory in the documentation. let build_triple = build.out.join(&build.build.triple); + t!(fs::create_dir_all(&build_triple)); let host = build.out.join("host"); if let Err(e) = symlink_dir(&build.config, &build_triple, &host) { if e.kind() != ErrorKind::AlreadyExists { From 7bce15d3813e71287bdfad2f55acc05fe712decc Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Wed, 15 Mar 2023 13:30:45 +0900 Subject: [PATCH 4/6] Fix linker detection for clang with prefix --- compiler/rustc_codegen_ssa/src/back/link.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index b148e4185a68a..34e042376c122 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -1237,7 +1237,7 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { .and_then(|(lhs, rhs)| rhs.chars().all(char::is_numeric).then_some(lhs)) .unwrap_or(stem); - // GCC can have an optional target prefix. + // GCC/Clang can have an optional target prefix. let flavor = if stem == "emcc" { LinkerFlavor::EmCc } else if stem == "gcc" @@ -1245,7 +1245,9 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) { || stem == "g++" || stem.ends_with("-g++") || stem == "clang" + || stem.ends_with("-clang") || stem == "clang++" + || stem.ends_with("-clang++") { LinkerFlavor::from_cli(LinkerFlavorCli::Gcc, &sess.target) } else if stem == "wasm-ld" || stem.ends_with("-wasm-ld") { From 8182801995f6d36476270b345604956cbc7236a6 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 18 Mar 2023 20:58:54 -0400 Subject: [PATCH 5/6] 1.68.1 release --- RELEASES.md | 12 ++++++++++++ src/version | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASES.md b/RELEASES.md index f418ab23d10af..bc776ce2ac8e6 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,15 @@ +Version 1.68.1 (2023-03-23) +=========================== + +- [Fix miscompilation in produced Windows MSVC artifacts](https://github.com/rust-lang/rust/pull/109094) + This was introduced by enabling ThinLTO for the distributed rustc which led + to miscompilations in the resulting binary. Currently this is believed to be + limited to the -Zdylib-lto flag used for rustc compilation, rather than a + general bug in ThinLTO, so only rustc artifacts should be affected. +- [Fix --enable-local-rust builds](https://github.com/rust-lang/rust/pull/109111/) +- [Treat `$prefix-clang` as `clang` in linker detection code](https://github.com/rust-lang/rust/pull/109156) +- [Fix panic in compiler code](https://github.com/rust-lang/rust/pull/108162) + Version 1.68.0 (2023-03-09) ========================== diff --git a/src/version b/src/version index ee2f4ca913048..0944cc489c25b 100644 --- a/src/version +++ b/src/version @@ -1 +1 @@ -1.68.0 +1.68.1 From 51bdb0f085d02aeab0adbf4b497afc22d6b26f3f Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 9 Mar 2023 12:23:18 -0800 Subject: [PATCH 6/6] ci: use `apt install --download-only` for solaris debs --- .../dist-various-2/build-solaris-toolchain.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh index cf784a66ae4f9..3939b4b7c41c1 100755 --- a/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh +++ b/src/ci/docker/host-x86_64/dist-various-2/build-solaris-toolchain.sh @@ -32,24 +32,22 @@ cd solaris dpkg --add-architecture $APT_ARCH apt-get update -apt-get download $(apt-cache depends --recurse --no-replaces \ +apt-get install -y --download-only \ libc:$APT_ARCH \ - liblgrp-dev:$APT_ARCH \ liblgrp:$APT_ARCH \ libm-dev:$APT_ARCH \ libpthread:$APT_ARCH \ libresolv:$APT_ARCH \ librt:$APT_ARCH \ - libsendfile-dev:$APT_ARCH \ libsendfile:$APT_ARCH \ libsocket:$APT_ARCH \ system-crt:$APT_ARCH \ - system-header:$APT_ARCH \ - | grep "^\w") + system-header:$APT_ARCH -for deb in *$APT_ARCH.deb; do +for deb in /var/cache/apt/archives/*$APT_ARCH.deb; do dpkg -x $deb . done +apt-get clean # The -dev packages are not available from the apt repository we're using. # However, those packages are just symlinks from *.so to *.so..