about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-06-27 22:13:01 +0200
committerGitHub <noreply@github.com>2025-06-27 22:13:01 +0200
commit9d15167921ead28946d8d603470dbe9a57e74eff (patch)
treeaadb78d79c5225b18680f3f049da5b8b12456f46
parent36c2b011cb4bb9bd34647486551e85a969773c8d (diff)
parent4b7711520bc1a04b05252e59c4c371aa0bcc6793 (diff)
downloadrust-9d15167921ead28946d8d603470dbe9a57e74eff.tar.gz
rust-9d15167921ead28946d8d603470dbe9a57e74eff.zip
Rollup merge of #140809 - bjorn3:panic_runtime_cleanup, r=petrochenkov
Reduce special casing for the panic runtime

See the individual commits for more info.
-rw-r--r--compiler/rustc_codegen_ssa/src/back/linker.rs16
-rw-r--r--compiler/rustc_codegen_ssa/src/back/symbol_export.rs16
-rw-r--r--compiler/rustc_codegen_ssa/src/base.rs22
-rw-r--r--compiler/rustc_metadata/src/creader.rs92
-rw-r--r--compiler/rustc_metadata/src/dependency_format.rs18
-rw-r--r--compiler/rustc_metadata/src/rmeta/decoder.rs4
-rw-r--r--compiler/rustc_middle/src/middle/exported_symbols.rs6
-rw-r--r--library/std/Cargo.toml2
-rw-r--r--library/sysroot/Cargo.toml2
-rw-r--r--src/tools/miri/cargo-miri/src/setup.rs2
-rw-r--r--src/tools/miri/src/bin/miri.rs1
-rw-r--r--tests/run-make/crate-circular-deps-link/a.rs5
-rw-r--r--tests/ui/panic-runtime/auxiliary/depends.rs8
-rw-r--r--tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs6
-rw-r--r--tests/ui/panic-runtime/runtime-depend-on-needs-runtime.rs9
15 files changed, 64 insertions, 145 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs
index cd08c0fc30f..fba84dec097 100644
--- a/compiler/rustc_codegen_ssa/src/back/linker.rs
+++ b/compiler/rustc_codegen_ssa/src/back/linker.rs
@@ -1876,12 +1876,28 @@ pub(crate) fn linked_symbols(
         }
     }
 
+    match tcx.sess.lto() {
+        Lto::No | Lto::ThinLocal => {}
+        Lto::Thin | Lto::Fat => {
+            // We really only need symbols from upstream rlibs to end up in the linked symbols list.
+            // The rest are in separate object files which the linker will always link in and
+            // doesn't have rules around the order in which they need to appear.
+            // When doing LTO, some of the symbols in the linked symbols list happen to be
+            // internalized by LTO, which then prevents referencing them from symbols.o. When doing
+            // LTO, all object files that get linked in will be local object files rather than
+            // pulled in from rlibs, so an empty linked symbols list works fine to avoid referencing
+            // all those internalized symbols from symbols.o.
+            return Vec::new();
+        }
+    }
+
     let mut symbols = Vec::new();
 
     let export_threshold = symbol_export::crates_export_threshold(&[crate_type]);
     for_each_exported_symbols_include_dep(tcx, crate_type, |symbol, info, cnum| {
         if info.level.is_below_threshold(export_threshold) && !tcx.is_compiler_builtins(cnum)
             || info.used
+            || info.rustc_std_internal_symbol
         {
             symbols.push((
                 symbol_export::linking_symbol_name_for_instance_in_crate(
diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
index 19c005d418e..75f7a463556 100644
--- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
+++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs
@@ -131,6 +131,9 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
                 used: codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_COMPILER)
                     || codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
                     || used,
+                rustc_std_internal_symbol: codegen_attrs
+                    .flags
+                    .contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL),
             };
             (def_id.to_def_id(), info)
         })
@@ -143,6 +146,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, _: LocalCrate) -> DefIdMap<S
                 level: SymbolExportLevel::C,
                 kind: SymbolExportKind::Data,
                 used: false,
+                rustc_std_internal_symbol: false,
             },
         );
     }
@@ -191,6 +195,7 @@ fn exported_symbols_provider_local<'tcx>(
                         level: info.level,
                         kind: SymbolExportKind::Text,
                         used: info.used,
+                        rustc_std_internal_symbol: info.rustc_std_internal_symbol,
                     },
                 )
             })
@@ -207,6 +212,7 @@ fn exported_symbols_provider_local<'tcx>(
                 level: SymbolExportLevel::C,
                 kind: SymbolExportKind::Text,
                 used: false,
+                rustc_std_internal_symbol: false,
             },
         ));
     }
@@ -230,6 +236,7 @@ fn exported_symbols_provider_local<'tcx>(
                     level: SymbolExportLevel::Rust,
                     kind: SymbolExportKind::Text,
                     used: false,
+                    rustc_std_internal_symbol: true,
                 },
             ));
         }
@@ -250,6 +257,7 @@ fn exported_symbols_provider_local<'tcx>(
                     level: SymbolExportLevel::C,
                     kind: SymbolExportKind::Data,
                     used: false,
+                    rustc_std_internal_symbol: false,
                 },
             )
         }));
@@ -275,6 +283,7 @@ fn exported_symbols_provider_local<'tcx>(
                     level: SymbolExportLevel::C,
                     kind: SymbolExportKind::Data,
                     used: false,
+                    rustc_std_internal_symbol: false,
                 },
             )
         }));
@@ -292,6 +301,7 @@ fn exported_symbols_provider_local<'tcx>(
                 level: SymbolExportLevel::C,
                 kind: SymbolExportKind::Data,
                 used: true,
+                rustc_std_internal_symbol: false,
             },
         ));
     }
@@ -367,6 +377,8 @@ fn exported_symbols_provider_local<'tcx>(
                 }
             }
 
+            // Note: These all set rustc_std_internal_symbol to false as generic functions must not
+            // be marked with this attribute and we are only handling generic functions here.
             match *mono_item {
                 MonoItem::Fn(Instance { def: InstanceKind::Item(def), args }) => {
                     let has_generics = args.non_erasable_generics().next().is_some();
@@ -382,6 +394,7 @@ fn exported_symbols_provider_local<'tcx>(
                                 level: SymbolExportLevel::Rust,
                                 kind: SymbolExportKind::Text,
                                 used: false,
+                                rustc_std_internal_symbol: false,
                             },
                         ));
                     }
@@ -404,6 +417,7 @@ fn exported_symbols_provider_local<'tcx>(
                                 level: SymbolExportLevel::Rust,
                                 kind: SymbolExportKind::Text,
                                 used: false,
+                                rustc_std_internal_symbol: false,
                             },
                         ));
                     }
@@ -420,6 +434,7 @@ fn exported_symbols_provider_local<'tcx>(
                             level: SymbolExportLevel::Rust,
                             kind: SymbolExportKind::Text,
                             used: false,
+                            rustc_std_internal_symbol: false,
                         },
                     ));
                 }
@@ -430,6 +445,7 @@ fn exported_symbols_provider_local<'tcx>(
                             level: SymbolExportLevel::Rust,
                             kind: SymbolExportKind::Text,
                             used: false,
+                            rustc_std_internal_symbol: false,
                         },
                     ));
                 }
diff --git a/compiler/rustc_codegen_ssa/src/base.rs b/compiler/rustc_codegen_ssa/src/base.rs
index cc90271cd0c..b06cfd1e473 100644
--- a/compiler/rustc_codegen_ssa/src/base.rs
+++ b/compiler/rustc_codegen_ssa/src/base.rs
@@ -6,7 +6,7 @@ use std::time::{Duration, Instant};
 use itertools::Itertools;
 use rustc_abi::FIRST_VARIANT;
 use rustc_ast as ast;
-use rustc_ast::expand::allocator::{ALLOCATOR_METHODS, AllocatorKind, global_fn_name};
+use rustc_ast::expand::allocator::AllocatorKind;
 use rustc_attr_data_structures::OptimizeAttr;
 use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
 use rustc_data_structures::profiling::{get_resident_set_size, print_time_passes_entry};
@@ -1056,26 +1056,6 @@ impl CrateInfo {
                         .collect::<Vec<_>>();
                     symbols.sort_unstable_by(|a, b| a.0.cmp(&b.0));
                     linked_symbols.extend(symbols);
-                    if tcx.allocator_kind(()).is_some() {
-                        // At least one crate needs a global allocator. This crate may be placed
-                        // after the crate that defines it in the linker order, in which case some
-                        // linkers return an error. By adding the global allocator shim methods to
-                        // the linked_symbols list, linking the generated symbols.o will ensure that
-                        // circular dependencies involving the global allocator don't lead to linker
-                        // errors.
-                        linked_symbols.extend(ALLOCATOR_METHODS.iter().map(|method| {
-                            (
-                                add_prefix(
-                                    mangle_internal_symbol(
-                                        tcx,
-                                        global_fn_name(method.name).as_str(),
-                                    ),
-                                    SymbolExportKind::Text,
-                                ),
-                                SymbolExportKind::Text,
-                            )
-                        }));
-                    }
                 });
         }
 
diff --git a/compiler/rustc_metadata/src/creader.rs b/compiler/rustc_metadata/src/creader.rs
index de19c10bc57..2c882b84c58 100644
--- a/compiler/rustc_metadata/src/creader.rs
+++ b/compiler/rustc_metadata/src/creader.rs
@@ -1,7 +1,6 @@
 //! Validates all used crates and extern libraries and loads their metadata
 
 use std::error::Error;
-use std::ops::Fn;
 use std::path::Path;
 use std::str::FromStr;
 use std::time::Duration;
@@ -276,12 +275,6 @@ impl CStore {
             .filter_map(|(cnum, data)| data.as_deref().map(|data| (cnum, data)))
     }
 
-    fn iter_crate_data_mut(&mut self) -> impl Iterator<Item = (CrateNum, &mut CrateMetadata)> {
-        self.metas
-            .iter_enumerated_mut()
-            .filter_map(|(cnum, data)| data.as_deref_mut().map(|data| (cnum, data)))
-    }
-
     fn push_dependencies_in_postorder(&self, deps: &mut IndexSet<CrateNum>, cnum: CrateNum) {
         if !deps.contains(&cnum) {
             let data = self.get_crate_data(cnum);
@@ -307,13 +300,6 @@ impl CStore {
         deps
     }
 
-    fn crate_dependencies_in_reverse_postorder(
-        &self,
-        cnum: CrateNum,
-    ) -> impl Iterator<Item = CrateNum> {
-        self.crate_dependencies_in_postorder(cnum).into_iter().rev()
-    }
-
     pub(crate) fn injected_panic_runtime(&self) -> Option<CrateNum> {
         self.injected_panic_runtime
     }
@@ -966,47 +952,27 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
         // If we need a panic runtime, we try to find an existing one here. At
         // the same time we perform some general validation of the DAG we've got
         // going such as ensuring everything has a compatible panic strategy.
-        //
-        // The logic for finding the panic runtime here is pretty much the same
-        // as the allocator case with the only addition that the panic strategy
-        // compilation mode also comes into play.
-        let desired_strategy = self.sess.panic_strategy();
-        let mut runtime_found = false;
         let mut needs_panic_runtime = attr::contains_name(&krate.attrs, sym::needs_panic_runtime);
-
-        let mut panic_runtimes = Vec::new();
-        for (cnum, data) in self.cstore.iter_crate_data() {
-            needs_panic_runtime = needs_panic_runtime || data.needs_panic_runtime();
-            if data.is_panic_runtime() {
-                // Inject a dependency from all #![needs_panic_runtime] to this
-                // #![panic_runtime] crate.
-                panic_runtimes.push(cnum);
-                runtime_found = runtime_found || data.dep_kind() == CrateDepKind::Explicit;
-            }
-        }
-        for cnum in panic_runtimes {
-            self.inject_dependency_if(cnum, "a panic runtime", &|data| data.needs_panic_runtime());
+        for (_cnum, data) in self.cstore.iter_crate_data() {
+            needs_panic_runtime |= data.needs_panic_runtime();
         }
 
-        // If an explicitly linked and matching panic runtime was found, or if
-        // we just don't need one at all, then we're done here and there's
-        // nothing else to do.
-        if !needs_panic_runtime || runtime_found {
+        // If we just don't need a panic runtime at all, then we're done here
+        // and there's nothing else to do.
+        if !needs_panic_runtime {
             return;
         }
 
-        // By this point we know that we (a) need a panic runtime and (b) no
-        // panic runtime was explicitly linked. Here we just load an appropriate
-        // default runtime for our panic strategy and then inject the
-        // dependencies.
+        // By this point we know that we need a panic runtime. Here we just load
+        // an appropriate default runtime for our panic strategy.
         //
         // We may resolve to an already loaded crate (as the crate may not have
-        // been explicitly linked prior to this) and we may re-inject
-        // dependencies again, but both of those situations are fine.
+        // been explicitly linked prior to this), but this is fine.
         //
         // Also note that we have yet to perform validation of the crate graph
         // in terms of everyone has a compatible panic runtime format, that's
         // performed later as part of the `dependency_format` module.
+        let desired_strategy = self.sess.panic_strategy();
         let name = match desired_strategy {
             PanicStrategy::Unwind => sym::panic_unwind,
             PanicStrategy::Abort => sym::panic_abort,
@@ -1031,7 +997,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
         }
 
         self.cstore.injected_panic_runtime = Some(cnum);
-        self.inject_dependency_if(cnum, "a panic runtime", &|data| data.needs_panic_runtime());
     }
 
     fn inject_profiler_runtime(&mut self) {
@@ -1212,45 +1177,6 @@ impl<'a, 'tcx> CrateLoader<'a, 'tcx> {
         }
     }
 
-    fn inject_dependency_if(
-        &mut self,
-        krate: CrateNum,
-        what: &str,
-        needs_dep: &dyn Fn(&CrateMetadata) -> bool,
-    ) {
-        // Don't perform this validation if the session has errors, as one of
-        // those errors may indicate a circular dependency which could cause
-        // this to stack overflow.
-        if self.dcx().has_errors().is_some() {
-            return;
-        }
-
-        // Before we inject any dependencies, make sure we don't inject a
-        // circular dependency by validating that this crate doesn't
-        // transitively depend on any crates satisfying `needs_dep`.
-        for dep in self.cstore.crate_dependencies_in_reverse_postorder(krate) {
-            let data = self.cstore.get_crate_data(dep);
-            if needs_dep(&data) {
-                self.dcx().emit_err(errors::NoTransitiveNeedsDep {
-                    crate_name: self.cstore.get_crate_data(krate).name(),
-                    needs_crate_name: what,
-                    deps_crate_name: data.name(),
-                });
-            }
-        }
-
-        // All crates satisfying `needs_dep` do not explicitly depend on the
-        // crate provided for this compile, but in order for this compilation to
-        // be successfully linked we need to inject a dependency (to order the
-        // crates on the command line correctly).
-        for (cnum, data) in self.cstore.iter_crate_data_mut() {
-            if needs_dep(data) {
-                info!("injecting a dep from {} to {}", cnum, krate);
-                data.add_dependency(krate);
-            }
-        }
-    }
-
     fn report_unused_deps(&mut self, krate: &ast::Crate) {
         // Make a point span rather than covering the whole file
         let span = krate.spans.inner_span.shrink_to_lo();
diff --git a/compiler/rustc_metadata/src/dependency_format.rs b/compiler/rustc_metadata/src/dependency_format.rs
index 1089c4ac71c..fb9c2e23b71 100644
--- a/compiler/rustc_metadata/src/dependency_format.rs
+++ b/compiler/rustc_metadata/src/dependency_format.rs
@@ -370,15 +370,15 @@ fn attempt_static(tcx: TyCtxt<'_>, unavailable: &mut Vec<CrateNum>) -> Option<De
     Some(ret)
 }
 
-// Given a list of how to link upstream dependencies so far, ensure that an
-// injected dependency is activated. This will not do anything if one was
-// transitively included already (e.g., via a dylib or explicitly so).
-//
-// If an injected dependency was not found then we're guaranteed the
-// metadata::creader module has injected that dependency (not listed as
-// a required dependency) in one of the session's field. If this field is not
-// set then this compilation doesn't actually need the dependency and we can
-// also skip this step entirely.
+/// Given a list of how to link upstream dependencies so far, ensure that an
+/// injected dependency is activated. This will not do anything if one was
+/// transitively included already (e.g., via a dylib or explicitly so).
+///
+/// If an injected dependency was not found then we're guaranteed the
+/// metadata::creader module has injected that dependency (not listed as
+/// a required dependency) in one of the session's field. If this field is not
+/// set then this compilation doesn't actually need the dependency and we can
+/// also skip this step entirely.
 fn activate_injected_dep(
     injected: Option<CrateNum>,
     list: &mut DependencyList,
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs
index d886f25247f..2696c47c62c 100644
--- a/compiler/rustc_metadata/src/rmeta/decoder.rs
+++ b/compiler/rustc_metadata/src/rmeta/decoder.rs
@@ -1912,10 +1912,6 @@ impl CrateMetadata {
         self.dependencies.iter().copied()
     }
 
-    pub(crate) fn add_dependency(&mut self, cnum: CrateNum) {
-        self.dependencies.push(cnum);
-    }
-
     pub(crate) fn target_modifiers(&self) -> TargetModifiers {
         self.root.decode_target_modifiers(&self.blob).collect()
     }
diff --git a/compiler/rustc_middle/src/middle/exported_symbols.rs b/compiler/rustc_middle/src/middle/exported_symbols.rs
index 64a1f2aff15..c70ff398cea 100644
--- a/compiler/rustc_middle/src/middle/exported_symbols.rs
+++ b/compiler/rustc_middle/src/middle/exported_symbols.rs
@@ -31,11 +31,17 @@ pub enum SymbolExportKind {
 
 /// The `SymbolExportInfo` of a symbols specifies symbol-related information
 /// that is relevant to code generation and linking.
+///
+/// The difference between `used` and `rustc_std_internal_symbol` is that the
+/// former is exported by LTO while the latter isn't.
 #[derive(Eq, PartialEq, Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)]
 pub struct SymbolExportInfo {
     pub level: SymbolExportLevel,
     pub kind: SymbolExportKind,
+    /// Was the symbol marked as `#[used(compiler)]` or `#[used(linker)]`?
     pub used: bool,
+    /// Was the symbol marked as `#[rustc_std_internal_symbol]`?
+    pub rustc_std_internal_symbol: bool,
 }
 
 #[derive(Eq, PartialEq, Debug, Copy, Clone, TyEncodable, TyDecodable, HashStable)]
diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml
index ae7107938f3..7c2a43ef207 100644
--- a/library/std/Cargo.toml
+++ b/library/std/Cargo.toml
@@ -93,7 +93,7 @@ backtrace = [
     'miniz_oxide/rustc-dep-of-std',
 ]
 
-panic-unwind = ["panic_unwind"]
+panic-unwind = ["dep:panic_unwind"]
 compiler-builtins-c = ["alloc/compiler-builtins-c"]
 compiler-builtins-mem = ["alloc/compiler-builtins-mem"]
 compiler-builtins-no-asm = ["alloc/compiler-builtins-no-asm"]
diff --git a/library/sysroot/Cargo.toml b/library/sysroot/Cargo.toml
index c149d513c32..3adc0224971 100644
--- a/library/sysroot/Cargo.toml
+++ b/library/sysroot/Cargo.toml
@@ -26,7 +26,7 @@ debug_typeid = ["std/debug_typeid"]
 llvm-libunwind = ["std/llvm-libunwind"]
 system-llvm-libunwind = ["std/system-llvm-libunwind"]
 optimize_for_size = ["std/optimize_for_size"]
-panic-unwind = ["std/panic_unwind"]
+panic-unwind = ["std/panic-unwind"]
 panic_immediate_abort = ["std/panic_immediate_abort"]
 profiler = ["dep:profiler_builtins"]
 std_detect_file_io = ["std/std_detect_file_io"]
diff --git a/src/tools/miri/cargo-miri/src/setup.rs b/src/tools/miri/cargo-miri/src/setup.rs
index b9b58c04f9e..e399f66fbc9 100644
--- a/src/tools/miri/cargo-miri/src/setup.rs
+++ b/src/tools/miri/cargo-miri/src/setup.rs
@@ -83,7 +83,7 @@ pub fn setup(
         SysrootConfig::NoStd
     } else {
         SysrootConfig::WithStd {
-            std_features: ["panic_unwind", "backtrace"].into_iter().map(Into::into).collect(),
+            std_features: ["panic-unwind", "backtrace"].into_iter().map(Into::into).collect(),
         }
     };
     let cargo_cmd = {
diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs
index d4ba7fbd6a4..72057f812f9 100644
--- a/src/tools/miri/src/bin/miri.rs
+++ b/src/tools/miri/src/bin/miri.rs
@@ -295,6 +295,7 @@ impl rustc_driver::Callbacks for MiriBeRustCompilerCalls {
                                         level: SymbolExportLevel::C,
                                         kind: SymbolExportKind::Text,
                                         used: false,
+                                        rustc_std_internal_symbol: false,
                                     },
                                 ))
                             } else {
diff --git a/tests/run-make/crate-circular-deps-link/a.rs b/tests/run-make/crate-circular-deps-link/a.rs
index 99b2b65049d..6deb449d873 100644
--- a/tests/run-make/crate-circular-deps-link/a.rs
+++ b/tests/run-make/crate-circular-deps-link/a.rs
@@ -1,6 +1,7 @@
 #![crate_type = "rlib"]
 #![feature(lang_items)]
 #![feature(panic_unwind)]
+#![feature(rustc_attrs)]
 #![no_std]
 
 extern crate panic_unwind;
@@ -10,12 +11,12 @@ pub fn panic_handler(_: &core::panic::PanicInfo) -> ! {
     loop {}
 }
 
-#[no_mangle]
+#[rustc_std_internal_symbol]
 extern "C" fn __rust_drop_panic() -> ! {
     loop {}
 }
 
-#[no_mangle]
+#[rustc_std_internal_symbol]
 extern "C" fn __rust_foreign_exception() -> ! {
     loop {}
 }
diff --git a/tests/ui/panic-runtime/auxiliary/depends.rs b/tests/ui/panic-runtime/auxiliary/depends.rs
deleted file mode 100644
index 7a35619b681..00000000000
--- a/tests/ui/panic-runtime/auxiliary/depends.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ no-prefer-dynamic
-
-#![feature(panic_runtime)]
-#![crate_type = "rlib"]
-#![panic_runtime]
-#![no_std]
-
-extern crate needs_panic_runtime;
diff --git a/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs b/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs
deleted file mode 100644
index fbafee0c241..00000000000
--- a/tests/ui/panic-runtime/auxiliary/needs-panic-runtime.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ no-prefer-dynamic
-
-#![feature(needs_panic_runtime)]
-#![crate_type = "rlib"]
-#![needs_panic_runtime]
-#![no_std]
diff --git a/tests/ui/panic-runtime/runtime-depend-on-needs-runtime.rs b/tests/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
deleted file mode 100644
index eb00c071702..00000000000
--- a/tests/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ dont-check-compiler-stderr
-//@ aux-build:needs-panic-runtime.rs
-//@ aux-build:depends.rs
-
-extern crate depends;
-
-fn main() {}
-
-//~? ERROR the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`