]> git.lizzy.rs Git - rust.git/blob - src/test/codegen-units/partitioning/shared-generics.rs
Rollup merge of #94145 - ssomers:binary_heap_tests, r=jyn514
[rust.git] / src / test / codegen-units / partitioning / shared-generics.rs
1 //
2 // no-prefer-dynamic
3 // NOTE: We always compile this test with -Copt-level=0 because higher opt-levels
4 //       prevent drop-glue from participating in share-generics.
5 // incremental
6 // compile-flags:-Zprint-mono-items=eager -Zshare-generics=yes -Copt-level=0
7
8 #![crate_type="rlib"]
9
10 // aux-build:shared_generics_aux.rs
11 extern crate shared_generics_aux;
12
13 //~ MONO_ITEM fn foo
14 pub fn foo() {
15
16     //~ MONO_ITEM fn shared_generics_aux::generic_fn::<u16> @@ shared_generics_aux-in-shared_generics.volatile[External]
17     let _ = shared_generics_aux::generic_fn(0u16, 1u16);
18
19     // This should not generate a monomorphization because it's already
20     // available in `shared_generics_aux`.
21     let _ = shared_generics_aux::generic_fn(0.0f32, 3.0f32);
22
23     // The following line will drop an instance of `Foo`, generating a call to
24     // Foo's drop-glue function. However, share-generics should take care of
25     // reusing the drop-glue from the upstream crate, so we do not expect a
26     // mono item for the drop-glue
27     let _ = shared_generics_aux::Foo(1);
28 }