Skip to content

Commit a8a9a05

Browse files
committed
Convert codegen-unit tests to use start instead of main
The new Termination traits brings in the unwinding machinery and that blows up the required `TRANS_ITEM`s.
1 parent c7a57d2 commit a8a9a05

24 files changed

+148
-454
lines changed

src/test/codegen-units/item-collection/cross-crate-closures.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@
1717
// compile-flags:-Zprint-trans-items=eager
1818

1919
#![deny(dead_code)]
20+
#![feature(start)]
2021

2122
// aux-build:cgu_extern_closures.rs
2223
extern crate cgu_extern_closures;
2324

24-
//~ TRANS_ITEM fn cross_crate_closures::main[0]
25-
fn main() {
25+
//~ TRANS_ITEM fn cross_crate_closures::start[0]
26+
#[start]
27+
fn start(_: isize, _: *const *const u8) -> isize {
2628

2729
//~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0]
2830
//~ TRANS_ITEM fn cgu_extern_closures::inlined_fn[0]::{{closure}}[0]
@@ -35,6 +37,8 @@ fn main() {
3537
// Nothing should be generated for this call, we just link to the instance
3638
// in the extern crate.
3739
let _ = cgu_extern_closures::non_inlined_fn(6, 7);
40+
41+
0
3842
}
3943

4044
//~ TRANS_ITEM drop-glue i8

src/test/codegen-units/item-collection/cross-crate-generic-functions.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,14 @@
1212
// compile-flags:-Zprint-trans-items=eager
1313

1414
#![deny(dead_code)]
15+
#![feature(start)]
1516

1617
// aux-build:cgu_generic_function.rs
1718
extern crate cgu_generic_function;
1819

19-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ cross_crate_generic_functions0[Internal]
20-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ cross_crate_generic_functions0[Internal]
21-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ cross_crate_generic_functions0[Internal]
22-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ cross_crate_generic_functions0[Internal]
23-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ cross_crate_generic_functions0[Internal]
24-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_generic_functions0[Internal]
25-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ cross_crate_generic_functions0[Internal]
26-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ cross_crate_generic_functions0[Internal]
27-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ cross_crate_generic_functions0[Internal]
28-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_generic_functions0[Internal]
29-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ cross_crate_generic_functions0[Internal]
30-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ cross_crate_generic_functions0[Internal]
31-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ cross_crate_generic_functions0[Internal]
32-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ cross_crate_generic_functions0[Internal]
33-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_generic_functions0[Internal]
34-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ cross_crate_generic_functions0[Internal]
35-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ cross_crate_generic_functions0[Internal]
36-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ cross_crate_generic_functions0[External]
37-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ cross_crate_generic_functions0[Internal]
38-
//~ TRANS_ITEM fn cross_crate_generic_functions::main[0]
39-
fn main()
40-
{
20+
//~ TRANS_ITEM fn cross_crate_generic_functions::start[0]
21+
#[start]
22+
fn start(_: isize, _: *const *const u8) -> isize {
4123
//~ TRANS_ITEM fn cgu_generic_function::bar[0]<u32>
4224
//~ TRANS_ITEM fn cgu_generic_function::foo[0]<u32>
4325
let _ = cgu_generic_function::foo(1u32);
@@ -48,4 +30,6 @@ fn main()
4830

4931
// This should not introduce a codegen item
5032
let _ = cgu_generic_function::exported_but_not_generic(3);
33+
34+
0
5135
}

src/test/codegen-units/item-collection/cross-crate-trait-method.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,16 @@
1212
// compile-flags:-Zprint-trans-items=eager
1313

1414
#![deny(dead_code)]
15+
#![feature(start)]
1516

1617
// aux-build:cgu_export_trait_method.rs
1718
extern crate cgu_export_trait_method;
1819

1920
use cgu_export_trait_method::Trait;
2021

21-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ cross_crate_trait_method0[Internal]
22-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ cross_crate_trait_method0[Internal]
23-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ cross_crate_trait_method0[Internal]
24-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ cross_crate_trait_method0[Internal]
25-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ cross_crate_trait_method0[Internal]
26-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_trait_method0[Internal]
27-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ cross_crate_trait_method0[Internal]
28-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ cross_crate_trait_method0[Internal]
29-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ cross_crate_trait_method0[Internal]
30-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_trait_method0[Internal]
31-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ cross_crate_trait_method0[Internal]
32-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ cross_crate_trait_method0[Internal]
33-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ cross_crate_trait_method0[Internal]
34-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ cross_crate_trait_method0[Internal]
35-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ cross_crate_trait_method0[Internal]
36-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ cross_crate_trait_method0[Internal]
37-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ cross_crate_trait_method0[Internal]
38-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ cross_crate_trait_method0[External]
39-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ cross_crate_trait_method0[Internal]
40-
//~ TRANS_ITEM fn cross_crate_trait_method::main[0]
41-
fn main()
42-
{
22+
//~ TRANS_ITEM fn cross_crate_trait_method::start[0]
23+
#[start]
24+
fn start(_: isize, _: *const *const u8) -> isize {
4325
// The object code of these methods is contained in the external crate, so
4426
// calling them should *not* introduce codegen items in the current crate.
4527
let _: (u32, u32) = Trait::without_default_impl(0);
@@ -74,4 +56,6 @@ fn main()
7456
let _: (char, char) = Trait::without_default_impl_generic('c');
7557
//~ TRANS_ITEM fn cgu_export_trait_method::{{impl}}[0]::without_default_impl_generic[0]<bool>
7658
let _: (char, bool) = Trait::without_default_impl_generic(false);
59+
60+
0
7761
}

src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
// compile-flags:-Zprint-trans-items=eager
1313
// compile-flags:-Zinline-in-all-cgus
1414

15+
#![feature(start)]
16+
1517
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic0[Internal]
1618
struct StructWithDtor(u32);
1719

@@ -20,32 +22,16 @@ impl Drop for StructWithDtor {
2022
fn drop(&mut self) {}
2123
}
2224

23-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ drop_in_place_intrinsic0[Internal]
24-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ drop_in_place_intrinsic0[Internal]
25-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ drop_in_place_intrinsic0[Internal]
26-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ drop_in_place_intrinsic0[Internal]
27-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ drop_in_place_intrinsic0[Internal]
28-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ drop_in_place_intrinsic0[Internal]
29-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ drop_in_place_intrinsic0[Internal]
30-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ drop_in_place_intrinsic0[Internal]
31-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ drop_in_place_intrinsic0[Internal]
32-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ drop_in_place_intrinsic0[Internal]
33-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ drop_in_place_intrinsic0[Internal]
34-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ drop_in_place_intrinsic0[Internal]
35-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ drop_in_place_intrinsic0[Internal]
36-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ drop_in_place_intrinsic0[Internal]
37-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ drop_in_place_intrinsic0[Internal]
38-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ drop_in_place_intrinsic0[Internal]
39-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ drop_in_place_intrinsic0[Internal]
40-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ drop_in_place_intrinsic0[External]
41-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ drop_in_place_intrinsic0[Internal]
42-
//~ TRANS_ITEM fn drop_in_place_intrinsic::main[0]
43-
fn main() {
25+
//~ TRANS_ITEM fn drop_in_place_intrinsic::start[0]
26+
#[start]
27+
fn start(_: isize, _: *const *const u8) -> isize {
4428

4529
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal]
4630
let x = [StructWithDtor(0), StructWithDtor(1)];
4731

4832
drop_slice_in_place(&x);
33+
34+
0
4935
}
5036

5137
//~ TRANS_ITEM fn drop_in_place_intrinsic::drop_slice_in_place[0]

src/test/codegen-units/item-collection/function-as-argument.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// compile-flags:-Zprint-trans-items=eager
1313

1414
#![deny(dead_code)]
15+
#![feature(start)]
1516

1617
fn take_fn_once<T1, T2, F: FnOnce(T1, T2)>(f: F, x: T1, y: T2) {
1718
(f)(x, y)
@@ -23,27 +24,9 @@ fn take_fn_pointer<T1, T2>(f: fn(T1, T2), x: T1, y: T2) {
2324
(f)(x, y)
2425
}
2526

26-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ function_as_argument0[Internal]
27-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ function_as_argument0[Internal]
28-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ function_as_argument0[Internal]
29-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ function_as_argument0[Internal]
30-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ function_as_argument0[Internal]
31-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ function_as_argument0[Internal]
32-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ function_as_argument0[Internal]
33-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ function_as_argument0[Internal]
34-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ function_as_argument0[Internal]
35-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ function_as_argument0[Internal]
36-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ function_as_argument0[Internal]
37-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ function_as_argument0[Internal]
38-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ function_as_argument0[Internal]
39-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ function_as_argument0[Internal]
40-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ function_as_argument0[Internal]
41-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ function_as_argument0[Internal]
42-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ function_as_argument0[Internal]
43-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ function_as_argument0[External]
44-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ function_as_argument0[Internal]
45-
//~ TRANS_ITEM fn function_as_argument::main[0]
46-
fn main() {
27+
//~ TRANS_ITEM fn function_as_argument::start[0]
28+
#[start]
29+
fn start(_: isize, _: *const *const u8) -> isize {
4730

4831
//~ TRANS_ITEM fn function_as_argument::take_fn_once[0]<u32, &str, fn(u32, &str)>
4932
//~ TRANS_ITEM fn function_as_argument::function[0]<u32, &str>
@@ -62,4 +45,6 @@ fn main() {
6245
//~ TRANS_ITEM fn function_as_argument::take_fn_pointer[0]<f32, i64>
6346
//~ TRANS_ITEM fn function_as_argument::function[0]<f32, i64>
6447
take_fn_pointer(function, 0f32, 0i64);
48+
49+
0
6550
}

src/test/codegen-units/item-collection/generic-drop-glue.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// compile-flags:-Zinline-in-all-cgus
1414

1515
#![deny(dead_code)]
16+
#![feature(start)]
1617

1718
struct StructWithDrop<T1, T2> {
1819
x: T1,
@@ -53,27 +54,9 @@ impl Drop for NonGenericWithDrop {
5354
fn drop(&mut self) {}
5455
}
5556

56-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ generic_drop_glue0[Internal]
57-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ generic_drop_glue0[Internal]
58-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ generic_drop_glue0[Internal]
59-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ generic_drop_glue0[Internal]
60-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ generic_drop_glue0[Internal]
61-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_drop_glue0[Internal]
62-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ generic_drop_glue0[Internal]
63-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ generic_drop_glue0[Internal]
64-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ generic_drop_glue0[Internal]
65-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_drop_glue0[Internal]
66-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ generic_drop_glue0[Internal]
67-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ generic_drop_glue0[Internal]
68-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ generic_drop_glue0[Internal]
69-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ generic_drop_glue0[Internal]
70-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_drop_glue0[Internal]
71-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ generic_drop_glue0[Internal]
72-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ generic_drop_glue0[Internal]
73-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ generic_drop_glue0[External]
74-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ generic_drop_glue0[Internal]
75-
//~ TRANS_ITEM fn generic_drop_glue::main[0]
76-
fn main() {
57+
//~ TRANS_ITEM fn generic_drop_glue::start[0]
58+
#[start]
59+
fn start(_: isize, _: *const *const u8) -> isize {
7760
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue0[Internal]
7861
//~ TRANS_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
7962
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
@@ -113,4 +96,6 @@ fn main() {
11396
EnumNoDrop::A(x) => x,
11497
EnumNoDrop::B(x) => x as f64
11598
};
99+
100+
0
116101
}

src/test/codegen-units/item-collection/generic-functions.rs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// compile-flags:-Zprint-trans-items=eager
1313

1414
#![deny(dead_code)]
15+
#![feature(start)]
1516

1617
fn foo1<T1>(a: T1) -> (T1, u32) {
1718
(a, 1)
@@ -31,27 +32,9 @@ pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 {
3132
a
3233
}
3334

34-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::align[0] @@ generic_functions0[Internal]
35-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::from_size_align_unchecked[0] @@ generic_functions0[Internal]
36-
//~ TRANS_ITEM fn alloc::allocator[0]::{{impl}}[0]::size[0] @@ generic_functions0[Internal]
37-
//~ TRANS_ITEM fn alloc::heap[0]::box_free[0]<core::any[0]::Any[0]> @@ generic_functions0[Internal]
38-
//~ TRANS_ITEM fn alloc::heap[0]::{{impl}}[0]::dealloc[0] @@ generic_functions0[Internal]
39-
//~ TRANS_ITEM fn core::mem[0]::uninitialized[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_functions0[Internal]
40-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ generic_functions0[Internal]
41-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::any[0]::Any[0]> @@ generic_functions0[Internal]
42-
//~ TRANS_ITEM fn core::ptr[0]::drop_in_place[0]<core::result[0]::Result[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>>> @@ generic_functions0[Internal]
43-
//~ TRANS_ITEM fn core::ptr[0]::read[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_functions0[Internal]
44-
//~ TRANS_ITEM fn core::ptr[0]::write[0]<i32> @@ generic_functions0[Internal]
45-
//~ TRANS_ITEM fn core::result[0]::{{impl}}[0]::unwrap_or[0]<i32, alloc::boxed[0]::Box[0]<core::any[0]::Any[0]>> @@ generic_functions0[Internal]
46-
//~ TRANS_ITEM fn std::panic[0]::catch_unwind[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ generic_functions0[Internal]
47-
//~ TRANS_ITEM fn std::panicking[0]::try[0]::do_call[0]<std::rt[0]::lang_start[0]::{{closure}}[0]<()>, i32> @@ generic_functions0[Internal]
48-
//~ TRANS_ITEM fn std::panicking[0]::try[0]<i32, std::rt[0]::lang_start[0]::{{closure}}[0]<()>> @@ generic_functions0[Internal]
49-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, fn()> @@ generic_functions0[Internal]
50-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]::{{closure}}[0]<(), i32, extern "rust-call" fn(()) -> i32, &fn()> @@ generic_functions0[Internal]
51-
//~ TRANS_ITEM fn std::rt[0]::lang_start[0]<()> @@ generic_functions0[External]
52-
//~ TRANS_ITEM fn std::sys_common[0]::backtrace[0]::__rust_begin_short_backtrace[0]<std::rt[0]::lang_start[0]::{{closure}}[0]::{{closure}}[0]<()>, i32> @@ generic_functions0[Internal]
53-
//~ TRANS_ITEM fn generic_functions::main[0]
54-
fn main() {
35+
//~ TRANS_ITEM fn generic_functions::start[0]
36+
#[start]
37+
fn start(_: isize, _: *const *const u8) -> isize {
5538
//~ TRANS_ITEM fn generic_functions::foo1[0]<i32>
5639
let _ = foo1(2i32);
5740
//~ TRANS_ITEM fn generic_functions::foo1[0]<i64>
@@ -78,4 +61,6 @@ fn main() {
7861
let _ = foo3(0i16, "a", 2usize);
7962
//~ TRANS_ITEM fn generic_functions::foo3[0]<char, (), ()>
8063
let _ = foo3('v', (), ());
64+
65+
0
8166
}

0 commit comments

Comments
 (0)