From b022e16e2a7c3a3098d890b045a1a63077107b71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Wed, 11 Feb 2026 21:30:33 +0100 Subject: [PATCH 1/4] Install LLVM DLL in the right place on Windows Unlike other systems, Windows requires runtime libraries to be present in `PATH` or right next to the binary. So, we copy the library next to the binary as the easier solution. --- src/bootstrap/src/core/build_steps/dist.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index eee960027a9f9..75deb695a4823 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -2557,7 +2557,7 @@ pub fn maybe_install_llvm_target(builder: &Builder<'_>, target: TargetSelection, ), )] pub fn maybe_install_llvm_runtime(builder: &Builder<'_>, target: TargetSelection, sysroot: &Path) { - let dst_libdir = sysroot.join(builder.sysroot_libdir_relative(Compiler::new(1, target))); + let dst_libdir = sysroot.join(builder.libdir_relative(Compiler::new(1, target))); // We do not need to copy LLVM files into the sysroot if it is not // dynamically linked; it is already included into librustc_llvm // statically. From c91c21bf3688c797940ee2c185cb8a0978c2d9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Wed, 28 Jan 2026 21:10:05 +0100 Subject: [PATCH 2/4] Build shared LLVM lib for windows-gnullvm --- src/ci/github-actions/jobs.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ci/github-actions/jobs.yml b/src/ci/github-actions/jobs.yml index 6e07ffc43bc21..9fa9577189f11 100644 --- a/src/ci/github-actions/jobs.yml +++ b/src/ci/github-actions/jobs.yml @@ -691,6 +691,7 @@ auto: --target=aarch64-pc-windows-gnullvm,i686-pc-windows-gnullvm --enable-full-tools --enable-profiler + --enable-llvm-link-shared DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift CC_i686_pc_windows_gnullvm: i686-w64-mingw32-clang @@ -703,6 +704,7 @@ auto: --build=x86_64-pc-windows-gnullvm --enable-full-tools --enable-profiler + --enable-llvm-link-shared DIST_REQUIRE_ALL_TOOLS: 1 CODEGEN_BACKENDS: llvm,cranelift <<: *job-windows From d12923346c44ea09fa2ace6467836e22c7534bfd Mon Sep 17 00:00:00 2001 From: Lieselotte <52315535+she3py@users.noreply.github.com> Date: Sun, 15 Feb 2026 15:40:13 +0100 Subject: [PATCH 3/4] feat: show what lint was overruled --- compiler/rustc_lint/src/errors.rs | 7 ++++--- compiler/rustc_lint/src/levels.rs | 4 +++- tests/ui/lint/lint-forbid-attr.rs | 5 +++-- tests/ui/lint/lint-forbid-cmdline-1.rs | 5 +++++ ...id-cmdline.stderr => lint-forbid-cmdline-1.stderr} | 4 ++-- tests/ui/lint/lint-forbid-cmdline-2.rs | 8 ++++++++ tests/ui/lint/lint-forbid-cmdline-2.stderr | 11 +++++++++++ tests/ui/lint/lint-forbid-cmdline.rs | 5 ----- 8 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 tests/ui/lint/lint-forbid-cmdline-1.rs rename tests/ui/lint/{lint-forbid-cmdline.stderr => lint-forbid-cmdline-1.stderr} (70%) create mode 100644 tests/ui/lint/lint-forbid-cmdline-2.rs create mode 100644 tests/ui/lint/lint-forbid-cmdline-2.stderr delete mode 100644 tests/ui/lint/lint-forbid-cmdline.rs diff --git a/compiler/rustc_lint/src/errors.rs b/compiler/rustc_lint/src/errors.rs index 51b97bc67d2c6..8fec30816bd13 100644 --- a/compiler/rustc_lint/src/errors.rs +++ b/compiler/rustc_lint/src/errors.rs @@ -20,7 +20,7 @@ pub(crate) struct OverruledAttribute<'a> { pub(crate) enum OverruledAttributeSub { DefaultSource { id: String }, NodeSource { span: Span, reason: Option }, - CommandLineSource, + CommandLineSource { id: Symbol }, } impl Subdiagnostic for OverruledAttributeSub { @@ -36,8 +36,9 @@ impl Subdiagnostic for OverruledAttributeSub { diag.note(rationale.to_string()); } } - OverruledAttributeSub::CommandLineSource => { - diag.note(msg!("`forbid` lint level was set on command line")); + OverruledAttributeSub::CommandLineSource { id } => { + diag.note(msg!("`forbid` lint level was set on command line (`-F {$id}`)")); + diag.arg("id", id); } } } diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 0481188757129..a3376ad967e06 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -580,7 +580,9 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { LintLevelSource::Node { span, reason, .. } => { OverruledAttributeSub::NodeSource { span, reason } } - LintLevelSource::CommandLine(_, _) => OverruledAttributeSub::CommandLineSource, + LintLevelSource::CommandLine(name, _) => { + OverruledAttributeSub::CommandLineSource { id: name } + } }; if !fcw_warning { self.sess.dcx().emit_err(OverruledAttribute { diff --git a/tests/ui/lint/lint-forbid-attr.rs b/tests/ui/lint/lint-forbid-attr.rs index 270a379c2f848..cbe7a02a0c17f 100644 --- a/tests/ui/lint/lint-forbid-attr.rs +++ b/tests/ui/lint/lint-forbid-attr.rs @@ -1,6 +1,7 @@ -#![forbid(deprecated)] +#![forbid(deprecated)] //~ NOTE `forbid` level set here #[allow(deprecated)] -//~^ ERROR allow(deprecated) incompatible +//~^ ERROR allow(deprecated) incompatible with previous forbid [E0453] +//~^^ NOTE overruled by previous forbid fn main() { } diff --git a/tests/ui/lint/lint-forbid-cmdline-1.rs b/tests/ui/lint/lint-forbid-cmdline-1.rs new file mode 100644 index 0000000000000..19a8f825f57d0 --- /dev/null +++ b/tests/ui/lint/lint-forbid-cmdline-1.rs @@ -0,0 +1,5 @@ +//@ compile-flags: -F deprecated + +#[allow(deprecated)] //~ ERROR allow(deprecated) incompatible with previous forbid [E0453] +fn main() { +} diff --git a/tests/ui/lint/lint-forbid-cmdline.stderr b/tests/ui/lint/lint-forbid-cmdline-1.stderr similarity index 70% rename from tests/ui/lint/lint-forbid-cmdline.stderr rename to tests/ui/lint/lint-forbid-cmdline-1.stderr index 3920a7429763e..7f4893fabd972 100644 --- a/tests/ui/lint/lint-forbid-cmdline.stderr +++ b/tests/ui/lint/lint-forbid-cmdline-1.stderr @@ -1,10 +1,10 @@ error[E0453]: allow(deprecated) incompatible with previous forbid - --> $DIR/lint-forbid-cmdline.rs:3:9 + --> $DIR/lint-forbid-cmdline-1.rs:3:9 | LL | #[allow(deprecated)] | ^^^^^^^^^^ overruled by previous forbid | - = note: `forbid` lint level was set on command line + = note: `forbid` lint level was set on command line (`-F deprecated`) error: aborting due to 1 previous error diff --git a/tests/ui/lint/lint-forbid-cmdline-2.rs b/tests/ui/lint/lint-forbid-cmdline-2.rs new file mode 100644 index 0000000000000..3505c11f42011 --- /dev/null +++ b/tests/ui/lint/lint-forbid-cmdline-2.rs @@ -0,0 +1,8 @@ +//@ compile-flags: -F dead_code + +#[allow(unused)] +//~^ ERROR allow(unused) incompatible with previous forbid [E0453] +//~| NOTE overruled by previous forbid +//~| NOTE `forbid` lint level was set on command line (`-F dead_code`) +fn main() { +} diff --git a/tests/ui/lint/lint-forbid-cmdline-2.stderr b/tests/ui/lint/lint-forbid-cmdline-2.stderr new file mode 100644 index 0000000000000..18a60b2f8b7e0 --- /dev/null +++ b/tests/ui/lint/lint-forbid-cmdline-2.stderr @@ -0,0 +1,11 @@ +error[E0453]: allow(unused) incompatible with previous forbid + --> $DIR/lint-forbid-cmdline-2.rs:3:9 + | +LL | #[allow(unused)] + | ^^^^^^ overruled by previous forbid + | + = note: `forbid` lint level was set on command line (`-F dead_code`) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0453`. diff --git a/tests/ui/lint/lint-forbid-cmdline.rs b/tests/ui/lint/lint-forbid-cmdline.rs deleted file mode 100644 index 8a4eb449d3c8a..0000000000000 --- a/tests/ui/lint/lint-forbid-cmdline.rs +++ /dev/null @@ -1,5 +0,0 @@ -//@ compile-flags: -F deprecated - -#[allow(deprecated)] //~ ERROR allow(deprecated) incompatible -fn main() { -} From 585297c7a19b6615db45423cea45447b84a404e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Sun, 15 Feb 2026 17:37:15 +0100 Subject: [PATCH 4/4] wip --- compiler/rustc_metadata/src/native_libs.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index b160b3fe9bb3c..76d0752b986f3 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -71,6 +71,8 @@ pub fn walk_native_lib_search_dirs( || sess.target.os == Os::Fuchsia || sess.target.is_like_aix || sess.target.is_like_darwin && !sess.sanitizers().is_empty() + // FIXME: For the shared LLVM library. + || sess.target.os == Os::Windows && sess.target.env == Env::Gnu && sess.target.abi == Abi::Llvm { f(&sess.target_tlib_path.dir, false)?; }