about summary refs log tree commit diff
path: root/tests/codegen-units/partitioning/vtable-through-const.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-06-27 12:57:05 +0000
committerbors <bors@rust-lang.org>2025-06-27 12:57:05 +0000
commit13c46fd0b089360922a557d8e18a63a2c41dfbeb (patch)
tree6ea31ef31e2a5ae71bdd9857df781619d9fdc78a /tests/codegen-units/partitioning/vtable-through-const.rs
parentd51b6f97122671c5de27cfc08cded235357e0d97 (diff)
parent928564c7bfb395e1e5bd34d8913b7627ee4d1130 (diff)
downloadrust-13c46fd0b089360922a557d8e18a63a2c41dfbeb.tar.gz
rust-13c46fd0b089360922a557d8e18a63a2c41dfbeb.zip
Auto merge of #142893 - Mark-Simulacrum:no-const-collect, r=oli-obk
Stop collecting unmentioned constants

This avoids generating useless dead LLVM IR. This appears to have regressed and/or been introduced in rust-lang/rust#53821 (unfortunately a very large PR - I don't see any direct discussion there of this particular change), but as far as I can tell is at least no longer necessary -- or we lack test coverage -- because none of our UI tests indicate diagnostics regressions. The adjusted codegen-units test has comments explicitly noting that these items should *not* be collected ("These are not referenced, so they do not produce mono-items").

I noticed this while looking at libcore LLVM IR we generate, which contained dead code references to the NOOP Waker item, which is never used inside libcore. Producing LLVM IR for it during libcore's compilation, only for that IR to get deleted by LLVM as unused, isn't useful. Note that the IR is generally all marked internal, too.
Diffstat (limited to 'tests/codegen-units/partitioning/vtable-through-const.rs')
-rw-r--r--tests/codegen-units/partitioning/vtable-through-const.rs5
1 files changed, 0 insertions, 5 deletions
diff --git a/tests/codegen-units/partitioning/vtable-through-const.rs b/tests/codegen-units/partitioning/vtable-through-const.rs
index aad9ccb634b..7a070728843 100644
--- a/tests/codegen-units/partitioning/vtable-through-const.rs
+++ b/tests/codegen-units/partitioning/vtable-through-const.rs
@@ -35,7 +35,6 @@ mod mod1 {
         }
     }
 
-    //~ MONO_ITEM fn mod1::id::<i64> @@ vtable_through_const-mod1.volatile[Internal]
     fn id<T>(x: T) -> T {
         x
     }
@@ -50,8 +49,6 @@ mod mod1 {
         fn do_something_else(&self) {}
     }
 
-    //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2>::do_something @@ vtable_through_const-mod1.volatile[External]
-    //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2>::do_something_else @@ vtable_through_const-mod1.volatile[External]
     impl Trait2 for NeedsDrop {}
 
     pub trait Trait2Gen<T> {
@@ -93,8 +90,6 @@ pub fn main() {
     // Same as above
     //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait1Gen<u8>>::do_something @@ vtable_through_const-mod1.volatile[External]
     //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait1Gen<u8>>::do_something_else @@ vtable_through_const-mod1.volatile[External]
-    //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2Gen<u8>>::do_something @@ vtable_through_const-mod1.volatile[External]
-    //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2Gen<u8>>::do_something_else @@ vtable_through_const-mod1.volatile[External]
     mod1::TRAIT1_GEN_REF.do_something(0u8);
 
     //~ MONO_ITEM fn mod1::id::<char> @@ vtable_through_const-mod1.volatile[External]