diff options
| author | Ralf Jung <post@ralfj.de> | 2024-12-14 09:13:12 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2025-01-21 06:59:15 -0700 |
| commit | 56c90dc31e86bbaf486826a21a33d7c56e8f742f (patch) | |
| tree | 6b953e5db742226ed1297f87196a69c1d51bd1d7 /tests | |
| parent | 341f60327fa5302732a4be366949c16f91870b6a (diff) | |
| download | rust-56c90dc31e86bbaf486826a21a33d7c56e8f742f.tar.gz rust-56c90dc31e86bbaf486826a21a33d7c56e8f742f.zip | |
remove support for the #[start] attribute
Diffstat (limited to 'tests')
77 files changed, 241 insertions, 488 deletions
diff --git a/tests/codegen-units/item-collection/cross-crate-closures.rs b/tests/codegen-units/item-collection/cross-crate-closures.rs index cb86cf18c0c..75a77cc2671 100644 --- a/tests/codegen-units/item-collection/cross-crate-closures.rs +++ b/tests/codegen-units/item-collection/cross-crate-closures.rs @@ -3,14 +3,14 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![no_main] //@ aux-build:cgu_extern_closures.rs extern crate cgu_extern_closures; -//~ MONO_ITEM fn start @@ cross_crate_closures-cgu.0[Internal] -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +//~ MONO_ITEM fn main @@ cross_crate_closures-cgu.0[External] +#[no_mangle] +extern "C" fn main(_: core::ffi::c_int, _: *const *const u8) -> core::ffi::c_int { //~ MONO_ITEM fn cgu_extern_closures::inlined_fn @@ cross_crate_closures-cgu.0[Internal] //~ MONO_ITEM fn cgu_extern_closures::inlined_fn::{closure#0} @@ cross_crate_closures-cgu.0[Internal] let _ = cgu_extern_closures::inlined_fn(1, 2); diff --git a/tests/codegen-units/item-collection/cross-crate-generic-functions.rs b/tests/codegen-units/item-collection/cross-crate-generic-functions.rs index d36f7067b32..4382bfdf8d8 100644 --- a/tests/codegen-units/item-collection/cross-crate-generic-functions.rs +++ b/tests/codegen-units/item-collection/cross-crate-generic-functions.rs @@ -1,14 +1,14 @@ //@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //@ aux-build:cgu_generic_function.rs extern crate cgu_generic_function; //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn cgu_generic_function::bar::<u32> //~ MONO_ITEM fn cgu_generic_function::foo::<u32> let _ = cgu_generic_function::foo(1u32); diff --git a/tests/codegen-units/item-collection/cross-crate-trait-method.rs b/tests/codegen-units/item-collection/cross-crate-trait-method.rs index 99777760315..917354166f5 100644 --- a/tests/codegen-units/item-collection/cross-crate-trait-method.rs +++ b/tests/codegen-units/item-collection/cross-crate-trait-method.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no -Copt-level=0 #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //@ aux-build:cgu_export_trait_method.rs extern crate cgu_export_trait_method; @@ -9,8 +9,8 @@ extern crate cgu_export_trait_method; use cgu_export_trait_method::Trait; //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { // The object code of these methods is contained in the external crate, so // calling them should *not* introduce codegen items in the current crate. let _: (u32, u32) = Trait::without_default_impl(0); diff --git a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs index d87ad41e70d..e1887b93b93 100644 --- a/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs +++ b/tests/codegen-units/item-collection/drop_in_place_intrinsic.rs @@ -3,7 +3,7 @@ //@ compile-flags:-Zinline-in-all-cgus //@ compile-flags:-Zinline-mir=no -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDtor> - shim(Some(StructWithDtor)) @@ drop_in_place_intrinsic-cgu.0[Internal] struct StructWithDtor(u32); @@ -14,8 +14,8 @@ impl Drop for StructWithDtor { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn std::ptr::drop_in_place::<[StructWithDtor; 2]> - shim(Some([StructWithDtor; 2])) @@ drop_in_place_intrinsic-cgu.0[Internal] let x = [StructWithDtor(0), StructWithDtor(1)]; diff --git a/tests/codegen-units/item-collection/function-as-argument.rs b/tests/codegen-units/item-collection/function-as-argument.rs index 4be713dc367..146a53bb911 100644 --- a/tests/codegen-units/item-collection/function-as-argument.rs +++ b/tests/codegen-units/item-collection/function-as-argument.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] fn take_fn_once<T1, T2, F: FnOnce(T1, T2)>(f: F, x: T1, y: T2) { (f)(x, y) @@ -14,8 +14,8 @@ fn take_fn_pointer<T1, T2>(f: fn(T1, T2), x: T1, y: T2) { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn take_fn_once::<u32, &str, fn(u32, &str) {function::<u32, &str>}> //~ MONO_ITEM fn function::<u32, &str> //~ MONO_ITEM fn <fn(u32, &str) {function::<u32, &str>} as std::ops::FnOnce<(u32, &str)>>::call_once - shim(fn(u32, &str) {function::<u32, &str>}) diff --git a/tests/codegen-units/item-collection/generic-drop-glue.rs b/tests/codegen-units/item-collection/generic-drop-glue.rs index d861d269fae..6ecf98a032f 100644 --- a/tests/codegen-units/item-collection/generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/generic-drop-glue.rs @@ -3,7 +3,7 @@ //@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] struct StructWithDrop<T1, T2> { x: T1, @@ -44,8 +44,8 @@ impl Drop for NonGenericWithDrop { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop<i8, char>> - shim(Some(StructWithDrop<i8, char>)) @@ generic_drop_glue-cgu.0[Internal] //~ MONO_ITEM fn <StructWithDrop<i8, char> as std::ops::Drop>::drop let _ = StructWithDrop { x: 0i8, y: 'a' }.x; diff --git a/tests/codegen-units/item-collection/generic-functions.rs b/tests/codegen-units/item-collection/generic-functions.rs index 2d7c70c9c4c..4a890790702 100644 --- a/tests/codegen-units/item-collection/generic-functions.rs +++ b/tests/codegen-units/item-collection/generic-functions.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] fn foo1<T1>(a: T1) -> (T1, u32) { (a, 1) @@ -22,8 +22,8 @@ pub fn lifetime_only<'a>(a: &'a u32) -> &'a u32 { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn foo1::<i32> let _ = foo1(2i32); //~ MONO_ITEM fn foo1::<i64> diff --git a/tests/codegen-units/item-collection/generic-impl.rs b/tests/codegen-units/item-collection/generic-impl.rs index f6e49f6e6df..5a43bd64b2a 100644 --- a/tests/codegen-units/item-collection/generic-impl.rs +++ b/tests/codegen-units/item-collection/generic-impl.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] struct Struct<T> { x: T, @@ -38,8 +38,8 @@ impl<'a> LifeTimeOnly<'a> { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn Struct::<i32>::new //~ MONO_ITEM fn id::<i32> //~ MONO_ITEM fn Struct::<i32>::get::<i16> diff --git a/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs b/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs index 0b7f30187b5..d916fa6a825 100644 --- a/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs +++ b/tests/codegen-units/item-collection/impl-in-non-instantiated-generic.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] trait SomeTrait { fn foo(&self); @@ -19,8 +19,8 @@ pub fn generic_function<T>(x: T) -> (T, i32) { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { 0i64.foo(); 0 diff --git a/tests/codegen-units/item-collection/instantiation-through-vtable.rs b/tests/codegen-units/item-collection/instantiation-through-vtable.rs index 59dd4311a03..9087fc6410a 100644 --- a/tests/codegen-units/item-collection/instantiation-through-vtable.rs +++ b/tests/codegen-units/item-collection/instantiation-through-vtable.rs @@ -2,7 +2,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-in-all-cgus -Zmir-opt-level=0 #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] trait Trait { fn foo(&self) -> u32; @@ -21,8 +21,8 @@ impl<T> Trait for Struct<T> { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { let s1 = Struct { _a: 0u32 }; //~ MONO_ITEM fn std::ptr::drop_in_place::<Struct<u32>> - shim(None) @@ instantiation_through_vtable-cgu.0[Internal] diff --git a/tests/codegen-units/item-collection/items-within-generic-items.rs b/tests/codegen-units/item-collection/items-within-generic-items.rs index 7798d2b46d2..56d21d5895c 100644 --- a/tests/codegen-units/item-collection/items-within-generic-items.rs +++ b/tests/codegen-units/item-collection/items-within-generic-items.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Copt-level=0 #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] fn generic_fn<T>(a: T) -> (T, i32) { //~ MONO_ITEM fn generic_fn::nested_fn @@ -22,8 +22,8 @@ fn generic_fn<T>(a: T) -> (T, i32) { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn generic_fn::<i64> let _ = generic_fn(0i64); //~ MONO_ITEM fn generic_fn::<u16> diff --git a/tests/codegen-units/item-collection/non-generic-closures.rs b/tests/codegen-units/item-collection/non-generic-closures.rs index 8847a249b1e..4dbc0b62b97 100644 --- a/tests/codegen-units/item-collection/non-generic-closures.rs +++ b/tests/codegen-units/item-collection/non-generic-closures.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn temporary @@ non_generic_closures-cgu.0[Internal] fn temporary() { @@ -40,9 +40,9 @@ fn assigned_to_variable_executed_directly() { f(4); } -//~ MONO_ITEM fn start @@ non_generic_closures-cgu.0[Internal] -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +//~ MONO_ITEM fn start @@ non_generic_closures-cgu.0[External] +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { temporary(); assigned_to_variable_but_not_executed(); assigned_to_variable_executed_directly(); diff --git a/tests/codegen-units/item-collection/non-generic-drop-glue.rs b/tests/codegen-units/item-collection/non-generic-drop-glue.rs index f7bb2f3f2f4..c4d7942ba1e 100644 --- a/tests/codegen-units/item-collection/non-generic-drop-glue.rs +++ b/tests/codegen-units/item-collection/non-generic-drop-glue.rs @@ -3,7 +3,7 @@ //@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn std::ptr::drop_in_place::<StructWithDrop> - shim(Some(StructWithDrop)) @@ non_generic_drop_glue-cgu.0[Internal] struct StructWithDrop { @@ -34,8 +34,8 @@ enum EnumNoDrop { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { let _ = StructWithDrop { x: 0 }.x; let _ = StructNoDrop { x: 0 }.x; let _ = match EnumWithDrop::A(0) { diff --git a/tests/codegen-units/item-collection/non-generic-functions.rs b/tests/codegen-units/item-collection/non-generic-functions.rs index d4d7d221827..4b86b1088f1 100644 --- a/tests/codegen-units/item-collection/non-generic-functions.rs +++ b/tests/codegen-units/item-collection/non-generic-functions.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn foo fn foo() { @@ -62,8 +62,8 @@ impl Struct { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { foo(); bar(); Struct::foo(); diff --git a/tests/codegen-units/item-collection/static-init.rs b/tests/codegen-units/item-collection/static-init.rs index 44b80ef73a4..5e3d06790a2 100644 --- a/tests/codegen-units/item-collection/static-init.rs +++ b/tests/codegen-units/item-collection/static-init.rs @@ -1,16 +1,16 @@ //@ compile-flags:-Zprint-mono-items=eager -#![feature(start)] +#![crate_type = "lib"] -pub static FN: fn() = foo::<i32>; +static FN: fn() = foo::<i32>; -pub fn foo<T>() {} +fn foo<T>() {} //~ MONO_ITEM fn foo::<i32> //~ MONO_ITEM static FN //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { 0 } diff --git a/tests/codegen-units/item-collection/statics-and-consts.rs b/tests/codegen-units/item-collection/statics-and-consts.rs index 1e3782f0c6e..54297a40851 100644 --- a/tests/codegen-units/item-collection/statics-and-consts.rs +++ b/tests/codegen-units/item-collection/statics-and-consts.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] static STATIC1: i64 = { const STATIC1_CONST1: i64 = 2; @@ -38,8 +38,8 @@ fn foo() { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { foo(); let _ = STATIC1; diff --git a/tests/codegen-units/item-collection/trait-implementations.rs b/tests/codegen-units/item-collection/trait-implementations.rs index e4c444499e0..3b67d4f22bd 100644 --- a/tests/codegen-units/item-collection/trait-implementations.rs +++ b/tests/codegen-units/item-collection/trait-implementations.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] pub trait SomeTrait { fn foo(&self); @@ -42,8 +42,8 @@ impl<T> SomeGenericTrait<T> for f32 { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn <i32 as SomeTrait>::bar::<char> 0i32.bar('x'); diff --git a/tests/codegen-units/item-collection/trait-method-as-argument.rs b/tests/codegen-units/item-collection/trait-method-as-argument.rs index 10cf2a0e967..d425ea19988 100644 --- a/tests/codegen-units/item-collection/trait-method-as-argument.rs +++ b/tests/codegen-units/item-collection/trait-method-as-argument.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] trait Trait: Sized { fn foo(self) -> Self { @@ -30,8 +30,8 @@ fn take_foo_mut<T, F: FnMut(T) -> T>(mut f: F, arg: T) -> T { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn take_foo_once::<u32, fn(u32) -> u32 {<u32 as Trait>::foo}> //~ MONO_ITEM fn <u32 as Trait>::foo //~ MONO_ITEM fn <fn(u32) -> u32 {<u32 as Trait>::foo} as std::ops::FnOnce<(u32,)>>::call_once - shim(fn(u32) -> u32 {<u32 as Trait>::foo}) diff --git a/tests/codegen-units/item-collection/trait-method-default-impl.rs b/tests/codegen-units/item-collection/trait-method-default-impl.rs index fd73786a402..cd0a4b89031 100644 --- a/tests/codegen-units/item-collection/trait-method-default-impl.rs +++ b/tests/codegen-units/item-collection/trait-method-default-impl.rs @@ -1,7 +1,7 @@ //@ compile-flags:-Zprint-mono-items=eager -Zinline-mir=no #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] trait SomeTrait { fn foo(&self) {} @@ -39,8 +39,8 @@ impl<T1> SomeGenericTrait<T1> for u32 { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn <i8 as SomeTrait>::bar::<char> let _ = 1i8.bar('c'); diff --git a/tests/codegen-units/item-collection/transitive-drop-glue.rs b/tests/codegen-units/item-collection/transitive-drop-glue.rs index 7c879dee1a1..18954fab86f 100644 --- a/tests/codegen-units/item-collection/transitive-drop-glue.rs +++ b/tests/codegen-units/item-collection/transitive-drop-glue.rs @@ -3,7 +3,7 @@ //@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn std::ptr::drop_in_place::<Root> - shim(Some(Root)) @@ transitive_drop_glue-cgu.0[Internal] struct Root(#[allow(dead_code)] Intermediate); @@ -26,8 +26,8 @@ impl<T> Drop for LeafGen<T> { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { let _ = Root(Intermediate(Leaf)); //~ MONO_ITEM fn std::ptr::drop_in_place::<RootGen<u32>> - shim(Some(RootGen<u32>)) @@ transitive_drop_glue-cgu.0[Internal] diff --git a/tests/codegen-units/item-collection/tuple-drop-glue.rs b/tests/codegen-units/item-collection/tuple-drop-glue.rs index 9d8b0cdd384..2e70d0151eb 100644 --- a/tests/codegen-units/item-collection/tuple-drop-glue.rs +++ b/tests/codegen-units/item-collection/tuple-drop-glue.rs @@ -3,7 +3,7 @@ //@ compile-flags:-Zinline-in-all-cgus #![deny(dead_code)] -#![feature(start)] +#![crate_type = "lib"] //~ MONO_ITEM fn std::ptr::drop_in_place::<Dropped> - shim(Some(Dropped)) @@ tuple_drop_glue-cgu.0[Internal] struct Dropped; @@ -14,8 +14,8 @@ impl Drop for Dropped { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { //~ MONO_ITEM fn std::ptr::drop_in_place::<(u32, Dropped)> - shim(Some((u32, Dropped))) @@ tuple_drop_glue-cgu.0[Internal] let x = (0u32, Dropped); diff --git a/tests/codegen-units/item-collection/unsizing.rs b/tests/codegen-units/item-collection/unsizing.rs index 5ea8b47962a..23e6003dc19 100644 --- a/tests/codegen-units/item-collection/unsizing.rs +++ b/tests/codegen-units/item-collection/unsizing.rs @@ -5,7 +5,7 @@ #![deny(dead_code)] #![feature(coerce_unsized)] #![feature(unsize)] -#![feature(start)] +#![crate_type = "lib"] use std::marker::Unsize; use std::ops::CoerceUnsized; @@ -45,8 +45,8 @@ struct Wrapper<T: ?Sized>(#[allow(dead_code)] *const T); impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Wrapper<U>> for Wrapper<T> {} //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { // simple case let bool_sized = &true; //~ MONO_ITEM fn std::ptr::drop_in_place::<bool> - shim(None) @@ unsizing-cgu.0[Internal] diff --git a/tests/codegen-units/partitioning/methods-are-with-self-type.rs b/tests/codegen-units/partitioning/methods-are-with-self-type.rs index 7c9045e8f1a..94d06829c6c 100644 --- a/tests/codegen-units/partitioning/methods-are-with-self-type.rs +++ b/tests/codegen-units/partitioning/methods-are-with-self-type.rs @@ -46,6 +46,7 @@ mod type2 { } //~ MONO_ITEM fn start @@ methods_are_with_self_type[External] +#[no_mangle] pub fn start() { //~ MONO_ITEM fn mod1::<impl SomeGenericType<u32, u64>>::method @@ methods_are_with_self_type.volatile[External] SomeGenericType(0u32, 0u64).method(); diff --git a/tests/codegen-units/partitioning/vtable-through-const.rs b/tests/codegen-units/partitioning/vtable-through-const.rs index a9186cea9c8..3880bba6f6b 100644 --- a/tests/codegen-units/partitioning/vtable-through-const.rs +++ b/tests/codegen-units/partitioning/vtable-through-const.rs @@ -2,11 +2,13 @@ //@ incremental //@ compile-flags:-Zprint-mono-items=lazy //@ compile-flags:-Zinline-in-all-cgus +// Need to disable optimizations to ensure consistent output across all CI runners. +//@ compile-flags:-Copt-level=0 // This test case makes sure, that references made through constants are // recorded properly in the InliningMap. -#![feature(start)] +#![crate_type = "lib"] mod mod1 { struct NeedsDrop; @@ -51,8 +53,8 @@ mod mod1 { fn do_something_else(&self) {} } - //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2>::do_something @@ vtable_through_const-mod1.volatile[Internal] - //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2>::do_something_else @@ vtable_through_const-mod1.volatile[Internal] + //~ 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> { @@ -76,9 +78,9 @@ mod mod1 { } //~ MONO_ITEM fn start -#[start] -fn start(_: isize, _: *const *const u8) -> isize { - //~ MONO_ITEM fn <mod1::NeedsDrop as std::ops::Drop>::drop @@ vtable_through_const-fallback.cgu[Internal] +#[no_mangle] +pub fn start(_: isize, _: *const *const u8) -> isize { + //~ MONO_ITEM fn <mod1::NeedsDrop as std::ops::Drop>::drop @@ vtable_through_const-fallback.cgu[External] //~ MONO_ITEM fn std::ptr::drop_in_place::<mod1::NeedsDrop> - shim(Some(mod1::NeedsDrop)) @@ vtable_through_const-fallback.cgu[External] // Since Trait1::do_something() is instantiated via its default implementation, @@ -95,8 +97,8 @@ fn start(_: isize, _: *const *const u8) -> isize { // 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[Internal] - //~ MONO_ITEM fn <mod1::NeedsDrop as mod1::Trait2Gen<u8>>::do_something_else @@ vtable_through_const-mod1.volatile[Internal] + //~ 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] diff --git a/tests/codegen/gdb_debug_script_load.rs b/tests/codegen/gdb_debug_script_load.rs index 30d518c0bcb..3e92eba10b1 100644 --- a/tests/codegen/gdb_debug_script_load.rs +++ b/tests/codegen/gdb_debug_script_load.rs @@ -4,14 +4,34 @@ //@ ignore-wasm //@ ignore-emscripten -//@ compile-flags: -g -C no-prepopulate-passes +//@ compile-flags: -g -C no-prepopulate-passes -Cpanic=abort -#![feature(start)] +#![feature(lang_items)] +#![no_std] +#[panic_handler] +fn panic_handler(_: &core::panic::PanicInfo) -> ! { + loop {} +} + +#[no_mangle] +extern "C" fn rust_eh_personality() { + loop {} +} + +// Needs rustc to generate `main` as that's where the magic load is inserted. +// IOW, we cannot write this test with `#![no_main]`. // CHECK-LABEL: @main // CHECK: load volatile i8, {{.+}} @__rustc_debug_gdb_scripts_section__ -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[lang = "start"] +fn lang_start<T: 'static>( + _main: fn() -> T, + _argc: isize, + _argv: *const *const u8, + _sigpipe: u8, +) -> isize { return 0; } + +fn main() {} diff --git a/tests/codegen/mainsubprogramstart.rs b/tests/codegen/mainsubprogramstart.rs deleted file mode 100644 index 0bcb311644d..00000000000 --- a/tests/codegen/mainsubprogramstart.rs +++ /dev/null @@ -1,14 +0,0 @@ -//@ ignore-apple -//@ ignore-wasi wasi codegens the main symbol differently - -//@ compile-flags: -g -C no-prepopulate-passes - -#![feature(start)] - -// CHECK-LABEL: @main -// CHECK: {{.*}}DISubprogram{{.*}}name: "start",{{.*}}DI{{(SP)?}}FlagMainSubprogram{{.*}} - -#[start] -fn start(_: isize, _: *const *const u8) -> isize { - return 0; -} diff --git a/tests/run-make/crate-circular-deps-link/c.rs b/tests/run-make/crate-circular-deps-link/c.rs index 9d72657aa59..cfe00a2a347 100644 --- a/tests/run-make/crate-circular-deps-link/c.rs +++ b/tests/run-make/crate-circular-deps-link/c.rs @@ -1,5 +1,5 @@ #![crate_type = "bin"] -#![feature(start)] +#![no_main] #![no_std] extern crate a; @@ -24,8 +24,8 @@ unsafe impl GlobalAlloc for Allocator { #[global_allocator] static ALLOCATOR: Allocator = Allocator; -#[start] -fn main(argc: isize, _argv: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { let mut v = Vec::new(); for i in 0..argc { v.push(i); diff --git a/tests/run-make/fmt-write-bloat/main.rs b/tests/run-make/fmt-write-bloat/main.rs index 6f206d6515a..b50461c0a02 100644 --- a/tests/run-make/fmt-write-bloat/main.rs +++ b/tests/run-make/fmt-write-bloat/main.rs @@ -1,5 +1,5 @@ #![feature(lang_items)] -#![feature(start)] +#![no_main] #![no_std] use core::fmt; @@ -17,8 +17,8 @@ impl fmt::Write for Dummy { } } -#[start] -fn main(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { let _ = writeln!(Dummy, "Hello World"); 0 } diff --git a/tests/run-make/no-alloc-shim/foo.rs b/tests/run-make/no-alloc-shim/foo.rs index a3daec3db39..42606961f8b 100644 --- a/tests/run-make/no-alloc-shim/foo.rs +++ b/tests/run-make/no-alloc-shim/foo.rs @@ -35,7 +35,7 @@ unsafe impl GlobalAlloc for Alloc { static __rust_no_alloc_shim_is_unstable: u8 = 0; #[no_mangle] -extern "C" fn main(_argc: usize, _argv: *const *const i8) -> i32 { +extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const i8) -> i32 { unsafe { assert_eq!(alloc::alloc::alloc(Layout::new::<()>()), core::ptr::null_mut()); } diff --git a/tests/run-make/sepcomp-inlining/foo.rs b/tests/run-make/sepcomp-inlining/foo.rs index 2fe5f9cb726..9101ee691a4 100644 --- a/tests/run-make/sepcomp-inlining/foo.rs +++ b/tests/run-make/sepcomp-inlining/foo.rs @@ -1,4 +1,4 @@ -#![feature(start)] +#![crate_type = "lib"] #[inline] fn inlined() -> u32 { @@ -21,8 +21,7 @@ mod b { } } -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +pub fn start(_: isize, _: *const *const u8) -> isize { a::f(); b::f(); diff --git a/tests/ui/array-slice-vec/vec-macro-no-std.rs b/tests/ui/array-slice-vec/vec-macro-no-std.rs index 1b5ab536dcb..ea0df0bea71 100644 --- a/tests/ui/array-slice-vec/vec-macro-no-std.rs +++ b/tests/ui/array-slice-vec/vec-macro-no-std.rs @@ -1,21 +1,21 @@ //@ run-pass - //@ ignore-emscripten no no_std executables +//@ ignore-wasm different `main` convention -#![feature(lang_items, start, rustc_private)] #![no_std] +#![no_main] +// Import global allocator and panic handler. extern crate std as other; -#[macro_use] -extern crate alloc; +#[macro_use] extern crate alloc; use alloc::vec::Vec; // Issue #16806 -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { let x: Vec<u8> = vec![0, 1, 2]; match x.last() { Some(&2) => (), diff --git a/tests/ui/async-await/issue-68523-start.rs b/tests/ui/async-await/issue-68523-start.rs deleted file mode 100644 index ee3baf4990c..00000000000 --- a/tests/ui/async-await/issue-68523-start.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ edition:2018 - -#![feature(start)] - -#[start] -pub async fn start(_: isize, _: *const *const u8) -> isize { -//~^ ERROR `#[start]` function is not allowed to be `async` - 0 -} diff --git a/tests/ui/async-await/issue-68523-start.stderr b/tests/ui/async-await/issue-68523-start.stderr deleted file mode 100644 index 5b76ab56e24..00000000000 --- a/tests/ui/async-await/issue-68523-start.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0752]: `#[start]` function is not allowed to be `async` - --> $DIR/issue-68523-start.rs:6:1 - | -LL | pub async fn start(_: isize, _: *const *const u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `#[start]` is not allowed to be `async` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0752`. diff --git a/tests/ui/attr-start.rs b/tests/ui/attr-start.rs deleted file mode 100644 index 232f50955b2..00000000000 --- a/tests/ui/attr-start.rs +++ /dev/null @@ -1,8 +0,0 @@ -//@ run-pass - -#![feature(start)] - -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - return 0; -} diff --git a/tests/ui/duplicate/dupe-symbols-7.stderr b/tests/ui/duplicate/dupe-symbols-7.stderr index ab9167e005a..aa6213af2e4 100644 --- a/tests/ui/duplicate/dupe-symbols-7.stderr +++ b/tests/ui/duplicate/dupe-symbols-7.stderr @@ -4,7 +4,7 @@ error: entry symbol `main` declared multiple times LL | fn main(){} | ^^^^^^^^^ | - = help: did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead + = help: did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point error: aborting due to 1 previous error diff --git a/tests/ui/duplicate/dupe-symbols-8.stderr b/tests/ui/duplicate/dupe-symbols-8.stderr index d7d419c9aa4..0f47d3683b5 100644 --- a/tests/ui/duplicate/dupe-symbols-8.stderr +++ b/tests/ui/duplicate/dupe-symbols-8.stderr @@ -4,7 +4,7 @@ error: entry symbol `main` declared multiple times LL | fn main() { | ^^^^^^^^^ | - = help: did you use `#[no_mangle]` on `fn main`? Use `#[start]` instead + = help: did you use `#[no_mangle]` on `fn main`? Use `#![no_main]` to suppress the usual Rust-generated entry point error: aborting due to 1 previous error diff --git a/tests/ui/error-codes/E0132.rs b/tests/ui/error-codes/E0132.rs deleted file mode 100644 index fb5e5d7b95a..00000000000 --- a/tests/ui/error-codes/E0132.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(start)] - -#[start] -fn f< T >() {} //~ ERROR E0132 - -fn main() { -} diff --git a/tests/ui/error-codes/E0132.stderr b/tests/ui/error-codes/E0132.stderr deleted file mode 100644 index b1990afa3ae..00000000000 --- a/tests/ui/error-codes/E0132.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0132]: `#[start]` function is not allowed to have type parameters - --> $DIR/E0132.rs:4:5 - | -LL | fn f< T >() {} - | ^^^^^ `#[start]` function cannot have type parameters - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0132`. diff --git a/tests/ui/error-codes/E0138.rs b/tests/ui/error-codes/E0138.rs deleted file mode 100644 index 6f3c36282e8..00000000000 --- a/tests/ui/error-codes/E0138.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(start)] - -#[start] -fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } - -#[start] -fn f(argc: isize, argv: *const *const u8) -> isize { 0 } -//~^ ERROR E0138 diff --git a/tests/ui/error-codes/E0138.stderr b/tests/ui/error-codes/E0138.stderr deleted file mode 100644 index 04877ab4082..00000000000 --- a/tests/ui/error-codes/E0138.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0138]: multiple `start` functions - --> $DIR/E0138.rs:7:1 - | -LL | fn foo(argc: isize, argv: *const *const u8) -> isize { 0 } - | ---------------------------------------------------- previous `#[start]` function here -... -LL | fn f(argc: isize, argv: *const *const u8) -> isize { 0 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `start` functions - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0138`. diff --git a/tests/ui/error-codes/E0647.rs b/tests/ui/error-codes/E0647.rs deleted file mode 100644 index fc085511cbc..00000000000 --- a/tests/ui/error-codes/E0647.rs +++ /dev/null @@ -1,9 +0,0 @@ -#![no_std] -#![feature(start)] - -extern crate std; - -#[start] -fn start(_: isize, _: *const *const u8) -> isize where (): Copy { //~ ERROR [E0647] - 0 -} diff --git a/tests/ui/error-codes/E0647.stderr b/tests/ui/error-codes/E0647.stderr deleted file mode 100644 index 4b444e5a397..00000000000 --- a/tests/ui/error-codes/E0647.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0647]: `#[start]` function is not allowed to have a `where` clause - --> $DIR/E0647.rs:7:50 - | -LL | fn start(_: isize, _: *const *const u8) -> isize where (): Copy { - | ^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0647`. diff --git a/tests/ui/extern/extern-prelude-core.rs b/tests/ui/extern/extern-prelude-core.rs index ced1e5c3915..5108c02517c 100644 --- a/tests/ui/extern/extern-prelude-core.rs +++ b/tests/ui/extern/extern-prelude-core.rs @@ -1,5 +1,5 @@ //@ run-pass -#![feature(lang_items, start)] +#![feature(lang_items)] #![no_std] extern crate std as other; @@ -11,8 +11,6 @@ mod foo { } } -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { +fn main() { foo::test(); - 0 } diff --git a/tests/ui/feature-gates/feature-gate-start.rs b/tests/ui/feature-gates/feature-gate-start.rs deleted file mode 100644 index e617f1c4759..00000000000 --- a/tests/ui/feature-gates/feature-gate-start.rs +++ /dev/null @@ -1,3 +0,0 @@ -#[start] -fn foo(_: isize, _: *const *const u8) -> isize { 0 } -//~^ ERROR `#[start]` functions are experimental diff --git a/tests/ui/feature-gates/feature-gate-start.stderr b/tests/ui/feature-gates/feature-gate-start.stderr deleted file mode 100644 index b1859c43718..00000000000 --- a/tests/ui/feature-gates/feature-gate-start.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0658]: `#[start]` functions are experimental and their signature may change over time - --> $DIR/feature-gate-start.rs:2:1 - | -LL | fn foo(_: isize, _: *const *const u8) -> isize { 0 } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = note: see issue #29633 <https://github.com/rust-lang/rust/issues/29633> for more information - = help: add `#![feature(start)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs index afffb3b1443..02a56c7e6aa 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.rs @@ -14,8 +14,6 @@ #![rustc_main] //~ ERROR: the `#[rustc_main]` attribute is used internally to specify //~^ ERROR: `rustc_main` attribute cannot be used at crate level //~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -#![start] -//~^ ERROR: `start` attribute cannot be used at crate level #![repr()] //~^ ERROR: `repr` attribute cannot be used at crate level #![path = "3800"] @@ -38,7 +36,6 @@ mod inline { //~| NOTE the inner attribute doesn't annotate this module //~| NOTE the inner attribute doesn't annotate this module //~| NOTE the inner attribute doesn't annotate this module - //~| NOTE the inner attribute doesn't annotate this module mod inner { #![inline] } //~^ ERROR attribute should be applied to function or closure @@ -123,24 +120,6 @@ mod export_name { } } -#[start] -//~^ ERROR: `start` attribute can only be used on functions -mod start { - mod inner { #![start] } - //~^ ERROR: `start` attribute can only be used on functions - - // for `fn f()` case, see feature-gate-start.rs - - #[start] struct S; - //~^ ERROR: `start` attribute can only be used on functions - - #[start] type T = S; - //~^ ERROR: `start` attribute can only be used on functions - - #[start] impl S { } - //~^ ERROR: `start` attribute can only be used on functions -} - #[repr(C)] //~^ ERROR: attribute should be applied to a struct, enum, or union mod repr { diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr index db8c5295a2d..648bafe6460 100644 --- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr +++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs-error.stderr @@ -8,7 +8,7 @@ LL | #![rustc_main] = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error: valid forms for the attribute are `#[inline]` and `#[inline(always|never)]` - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:47:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:44:5 | LL | #[inline = "2100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ @@ -17,38 +17,8 @@ LL | #[inline = "2100"] fn f() { } = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571> = note: `#[deny(ill_formed_attribute_input)]` on by default -error: `start` attribute can only be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:126:1 - | -LL | #[start] - | ^^^^^^^^ - -error: `start` attribute can only be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:129:17 - | -LL | mod inner { #![start] } - | ^^^^^^^^^ - -error: `start` attribute can only be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:134:5 - | -LL | #[start] struct S; - | ^^^^^^^^ - -error: `start` attribute can only be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:5 - | -LL | #[start] type T = S; - | ^^^^^^^^ - -error: `start` attribute can only be used on functions - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:140:5 - | -LL | #[start] impl S { } - | ^^^^^^^^ - error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 | LL | #[inline] | ^^^^^^^^^ @@ -59,7 +29,7 @@ LL | | } | |_- not a function or closure error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:66:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:63:1 | LL | #[no_link] | ^^^^^^^^^^ @@ -73,7 +43,7 @@ LL | | } | |_- not an `extern crate` item error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:92:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:89:1 | LL | #[export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -87,7 +57,7 @@ LL | | } | |_- not a free function, impl method or static error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:144:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:123:8 | LL | #[repr(C)] | ^ @@ -100,7 +70,7 @@ LL | | } | |_- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:168:8 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:147:8 | LL | #[repr(Rust)] | ^^^^ @@ -113,19 +83,19 @@ LL | | } | |_- not a struct, enum, or union error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:26:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:24:1 | LL | #![no_link] | ^^^^^^^^^^^ not an `extern crate` item error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:26:1 | LL | #![export_name = "2200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ not a free function, impl method or static error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1 | LL | #![inline] | ^^^^^^^^^^ not a function or closure @@ -160,23 +130,8 @@ LL - #![rustc_main] LL + #[rustc_main] | -error: `start` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 - | -LL | #![start] - | ^^^^^^^^^ -... -LL | mod inline { - | ------ the inner attribute doesn't annotate this module - | -help: perhaps you meant to use an outer attribute - | -LL - #![start] -LL + #[start] - | - error: `repr` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1 | LL | #![repr()] | ^^^^^^^^^^ @@ -191,7 +146,7 @@ LL + #[repr()] | error: `path` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1 | LL | #![path = "3800"] | ^^^^^^^^^^^^^^^^^ @@ -206,7 +161,7 @@ LL + #[path = "3800"] | error: `automatically_derived` attribute cannot be used at crate level - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:23:1 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1 | LL | #![automatically_derived] | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -221,144 +176,144 @@ LL + #[automatically_derived] | error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:43:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:17 | LL | mod inner { #![inline] } | ------------^^^^^^^^^^-- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:53:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:50:5 | LL | #[inline] struct S; | ^^^^^^^^^ --------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:57:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:54:5 | LL | #[inline] type T = S; | ^^^^^^^^^ ----------- not a function or closure error[E0518]: attribute should be applied to function or closure - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:61:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:58:5 | LL | #[inline] impl S { } | ^^^^^^^^^ ---------- not a function or closure error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:71:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:68:17 | LL | mod inner { #![no_link] } | ------------^^^^^^^^^^^-- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:75:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:72:5 | LL | #[no_link] fn f() { } | ^^^^^^^^^^ ---------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:79:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:76:5 | LL | #[no_link] struct S; | ^^^^^^^^^^ --------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:83:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:80:5 | LL | #[no_link]type T = S; | ^^^^^^^^^^----------- not an `extern crate` item error: attribute should be applied to an `extern crate` item - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:87:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:84:5 | LL | #[no_link] impl S { } | ^^^^^^^^^^ ---------- not an `extern crate` item error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:97:17 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:94:17 | LL | mod inner { #![export_name="2200"] } | ------------^^^^^^^^^^^^^^^^^^^^^^-- not a free function, impl method or static error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:103:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:100:5 | LL | #[export_name = "2200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:107:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:104:5 | LL | #[export_name = "2200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:111:5 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:108:5 | LL | #[export_name = "2200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a free function, impl method or static error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:116:9 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:113:9 | LL | #[export_name = "2200"] fn foo(); | ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static error: attribute should be applied to a free function, impl method or static - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:120:9 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:117:9 | LL | #[export_name = "2200"] fn bar() {} | ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:148:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:127:25 | LL | mod inner { #![repr(C)] } | --------------------^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:152:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:131:12 | LL | #[repr(C)] fn f() { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:158:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:137:12 | LL | #[repr(C)] type T = S; | ^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:162:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:141:12 | LL | #[repr(C)] impl S { } | ^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:172:25 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:151:25 | LL | mod inner { #![repr(Rust)] } | --------------------^^^^---- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:176:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:155:12 | LL | #[repr(Rust)] fn f() { } | ^^^^ ---------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:182:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:161:12 | LL | #[repr(Rust)] type T = S; | ^^^^ ----------- not a struct, enum, or union error[E0517]: attribute should be applied to a struct, enum, or union - --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:186:12 + --> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:165:12 | LL | #[repr(Rust)] impl S { } | ^^^^ ---------- not a struct, enum, or union -error: aborting due to 44 previous errors +error: aborting due to 38 previous errors Some errors have detailed explanations: E0517, E0518, E0658. For more information about an error, try `rustc --explain E0517`. diff --git a/tests/ui/for-loop-while/for-loop-no-std.rs b/tests/ui/for-loop-while/for-loop-no-std.rs index 4511146dc75..8255d7b4200 100644 --- a/tests/ui/for-loop-while/for-loop-no-std.rs +++ b/tests/ui/for-loop-while/for-loop-no-std.rs @@ -1,14 +1,19 @@ //@ run-pass +//@ ignore-emscripten no no_std executables +//@ ignore-wasm different `main` convention #![allow(unused_imports)] -#![feature(lang_items, start)] #![no_std] +#![no_main] +// Import global allocator and panic handler. extern crate std as other; #[macro_use] extern crate alloc; -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { +use alloc::string::ToString; + +#[no_mangle] +extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { for _ in [1,2,3].iter() { } 0 } diff --git a/tests/ui/format-no-std.rs b/tests/ui/format-no-std.rs index 27c31f48a00..657b210a9a0 100644 --- a/tests/ui/format-no-std.rs +++ b/tests/ui/format-no-std.rs @@ -1,17 +1,20 @@ //@ run-pass //@ ignore-emscripten no no_std executables +//@ ignore-wasm different `main` convention -#![feature(lang_items, start)] +#![feature(lang_items)] #![no_std] +#![no_main] +// Import global allocator and panic handler. extern crate std as other; #[macro_use] extern crate alloc; use alloc::string::ToString; -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: core::ffi::c_int, _argv: *const *const u8) -> core::ffi::c_int { let s = format!("{}", 1_isize); assert_eq!(s, "1".to_string()); diff --git a/tests/ui/issues/issue-50714-1.rs b/tests/ui/issues/issue-50714-1.rs deleted file mode 100644 index a25940ce1cb..00000000000 --- a/tests/ui/issues/issue-50714-1.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Regression test for issue 50714, make sure that this isn't a linker error. - -#![no_std] -#![feature(start)] - -extern crate std; - -#[start] -fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { //~ ERROR [E0647] - 0 -} diff --git a/tests/ui/issues/issue-50714-1.stderr b/tests/ui/issues/issue-50714-1.stderr deleted file mode 100644 index 7593ac38346..00000000000 --- a/tests/ui/issues/issue-50714-1.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0647]: `#[start]` function is not allowed to have a `where` clause - --> $DIR/issue-50714-1.rs:9:50 - | -LL | fn start(_: isize, _: *const *const u8) -> isize where fn(&()): Eq { - | ^^^^^^^^^^^^^^^^^ `#[start]` function cannot have a `where` clause - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0647`. diff --git a/tests/ui/issues/issue-9575.rs b/tests/ui/issues/issue-9575.rs deleted file mode 100644 index 06b252990b6..00000000000 --- a/tests/ui/issues/issue-9575.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(start)] - -#[start] -fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { - //~^ `#[start]` function has wrong type - 0 -} diff --git a/tests/ui/issues/issue-9575.stderr b/tests/ui/issues/issue-9575.stderr deleted file mode 100644 index 2f6e2687d24..00000000000 --- a/tests/ui/issues/issue-9575.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error[E0308]: `#[start]` function has wrong type - --> $DIR/issue-9575.rs:4:1 - | -LL | fn start(argc: isize, argv: *const *const u8, crate_map: *const u8) -> isize { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters - | - = note: expected signature `fn(isize, *const *const u8) -> _` - found signature `fn(isize, *const *const u8, *const u8) -> _` - -error: aborting due to 1 previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/lang-items/issue-19660.rs b/tests/ui/lang-items/issue-19660.rs deleted file mode 100644 index aff57df7ece..00000000000 --- a/tests/ui/lang-items/issue-19660.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ error-pattern: requires `copy` lang_item - -#![feature(lang_items, start, no_core)] -#![no_core] - -#[lang = "sized"] -trait Sized { } - -struct S; - -#[start] -fn main(_: isize, _: *const *const u8) -> isize { - let _ = S; - 0 -} diff --git a/tests/ui/lang-items/issue-19660.stderr b/tests/ui/lang-items/issue-19660.stderr deleted file mode 100644 index e5a8a143d03..00000000000 --- a/tests/ui/lang-items/issue-19660.stderr +++ /dev/null @@ -1,4 +0,0 @@ -error: requires `copy` lang_item - -error: aborting due to 1 previous error - diff --git a/tests/ui/lang-items/lang-item-missing.rs b/tests/ui/lang-items/lang-item-missing.rs index 8762594202a..5b832a5bb8f 100644 --- a/tests/ui/lang-items/lang-item-missing.rs +++ b/tests/ui/lang-items/lang-item-missing.rs @@ -3,10 +3,11 @@ //@ error-pattern: requires `sized` lang_item -#![feature(start, no_core)] +#![feature(lang_items, no_core)] #![no_core] +#![no_main] -#[start] -fn start(argc: isize, argv: *const *const u8) -> isize { - 0 +#[no_mangle] +extern "C" fn main(_argc: i32, _argv: *const *const u8) -> i32 { + loop {} } diff --git a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs new file mode 100644 index 00000000000..9b634ee8ee3 --- /dev/null +++ b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.rs @@ -0,0 +1,15 @@ +//@ error-pattern: requires `copy` lang_item + +#![feature(lang_items, no_core)] +#![no_core] +#![no_main] + +#[lang = "sized"] +trait Sized { } + +struct S; + +#[no_mangle] +extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 { + argc +} diff --git a/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr new file mode 100644 index 00000000000..3dc7716ecd2 --- /dev/null +++ b/tests/ui/lang-items/missing-copy-lang-item-issue-19660.stderr @@ -0,0 +1,8 @@ +error: requires `copy` lang_item + --> $DIR/missing-copy-lang-item-issue-19660.rs:14:5 + | +LL | argc + | ^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/lint/dead-code/lint-dead-code-2.rs b/tests/ui/lint/dead-code/lint-dead-code-2.rs index 6bfa4d96f71..c82088ec54b 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-2.rs +++ b/tests/ui/lint/dead-code/lint-dead-code-2.rs @@ -1,6 +1,6 @@ #![allow(unused_variables)] #![deny(dead_code)] -#![feature(rustc_attrs, start)] +#![feature(rustc_attrs)] struct Foo; @@ -21,21 +21,16 @@ fn live_fn() {} fn dead_fn() {} //~ ERROR: function `dead_fn` is never used -#[rustc_main] -fn dead_fn2() {} //~ ERROR: function `dead_fn2` is never used - fn used_fn() {} -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +#[rustc_main] +fn actual_main() { used_fn(); let foo = Foo; foo.bar2(); - 0 } // this is not main fn main() { //~ ERROR: function `main` is never used dead_fn(); - dead_fn2(); } diff --git a/tests/ui/lint/dead-code/lint-dead-code-2.stderr b/tests/ui/lint/dead-code/lint-dead-code-2.stderr index 85af553c986..4a5f3b8a687 100644 --- a/tests/ui/lint/dead-code/lint-dead-code-2.stderr +++ b/tests/ui/lint/dead-code/lint-dead-code-2.stderr @@ -10,17 +10,11 @@ note: the lint level is defined here LL | #![deny(dead_code)] | ^^^^^^^^^ -error: function `dead_fn2` is never used - --> $DIR/lint-dead-code-2.rs:25:4 - | -LL | fn dead_fn2() {} - | ^^^^^^^^ - error: function `main` is never used - --> $DIR/lint-dead-code-2.rs:38:4 + --> $DIR/lint-dead-code-2.rs:34:4 | LL | fn main() { | ^^^^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors diff --git a/tests/ui/print_type_sizes/anonymous.rs b/tests/ui/print_type_sizes/anonymous.rs index a3a32228088..7819e5ea767 100644 --- a/tests/ui/print_type_sizes/anonymous.rs +++ b/tests/ui/print_type_sizes/anonymous.rs @@ -1,14 +1,13 @@ -//@ compile-flags: -Z print-type-sizes +//@ compile-flags: -Z print-type-sizes --crate-type=lib //@ build-pass // All of the types that occur in this function are uninteresting, in // that one cannot control the sizes of these types with the same sort // of enum-variant manipulation tricks. -#![feature(start)] +#![no_std] -#[start] -fn start(_: isize, _: *const *const u8) -> isize { +pub fn main() -> isize { let _byte: u8 = 0; let _word: usize = 0; let _tuple: (u8, usize)= (0, 0); diff --git a/tests/ui/privacy/privacy1.rs b/tests/ui/privacy/privacy1.rs index 31f39601003..9436441ecc6 100644 --- a/tests/ui/privacy/privacy1.rs +++ b/tests/ui/privacy/privacy1.rs @@ -1,4 +1,4 @@ -#![feature(lang_items, start, no_core)] +#![feature(lang_items, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) #[lang="sized"] @@ -173,4 +173,4 @@ pub mod mytest { } } -#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 } +fn main() {} diff --git a/tests/ui/privacy/privacy2.rs b/tests/ui/privacy/privacy2.rs index 33292a65c5d..ab6d805544e 100644 --- a/tests/ui/privacy/privacy2.rs +++ b/tests/ui/privacy/privacy2.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Zdeduplicate-diagnostics=yes -#![feature(start, no_core)] +#![feature(no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) // Test to make sure that globs don't leak in regular `use` statements. @@ -26,4 +26,4 @@ fn test2() { //~^ ERROR `foo` is private } -#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 } +fn main() {} diff --git a/tests/ui/privacy/privacy3.rs b/tests/ui/privacy/privacy3.rs index fb1f432410d..6298a6bc8cf 100644 --- a/tests/ui/privacy/privacy3.rs +++ b/tests/ui/privacy/privacy3.rs @@ -1,6 +1,6 @@ //@ compile-flags: -Zdeduplicate-diagnostics=yes -#![feature(start, no_core)] +#![feature( no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) // Test to make sure that private items imported through globs remain private @@ -26,4 +26,4 @@ fn test1() { gpriv(); } -#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 } +fn main() {} diff --git a/tests/ui/privacy/privacy4.rs b/tests/ui/privacy/privacy4.rs index fa257b80039..7341c7752bb 100644 --- a/tests/ui/privacy/privacy4.rs +++ b/tests/ui/privacy/privacy4.rs @@ -1,4 +1,4 @@ -#![feature(lang_items, start, no_core)] +#![feature(lang_items, no_core)] #![no_core] // makes debugging this test *a lot* easier (during resolve) #[lang = "sized"] pub trait Sized {} @@ -22,4 +22,4 @@ fn test2() { gpriv(); } -#[start] fn main(_: isize, _: *const *const u8) -> isize { 3 } +fn main() {} diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs deleted file mode 100644 index f0e111b578f..00000000000 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.rs +++ /dev/null @@ -1,7 +0,0 @@ -#![feature(start)] - -#[start] -#[track_caller] //~ ERROR `#[start]` function is not allowed to be `#[track_caller]` -fn start(_argc: isize, _argv: *const *const u8) -> isize { - panic!("{}: oh no", std::panic::Location::caller()); -} diff --git a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr b/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr deleted file mode 100644 index 2738444f21f..00000000000 --- a/tests/ui/rfcs/rfc-2091-track-caller/error-with-start.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: `#[start]` function is not allowed to be `#[track_caller]` - --> $DIR/error-with-start.rs:4:1 - | -LL | #[track_caller] - | ^^^^^^^^^^^^^^^ -LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { - | -------------------------------------------------------- `#[start]` function is not allowed to be `#[track_caller]` - -error: aborting due to 1 previous error - diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs deleted file mode 100644 index 6aa8f6fd821..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ only-x86_64 - -#![feature(start)] -#![feature(target_feature_11)] - -#[start] -#[target_feature(enable = "avx2")] -//~^ ERROR `#[start]` function is not allowed to have `#[target_feature]` -fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr deleted file mode 100644 index d0a67c4f6a8..00000000000 --- a/tests/ui/rfcs/rfc-2396-target_feature-11/issue-108645-target-feature-on-start.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: `#[start]` function is not allowed to have `#[target_feature]` - --> $DIR/issue-108645-target-feature-on-start.rs:7:1 - | -LL | #[target_feature(enable = "avx2")] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | -LL | fn start(_argc: isize, _argv: *const *const u8) -> isize { 0 } - | -------------------------------------------------------- `#[start]` function is not allowed to have `#[target_feature]` - -error: aborting due to 1 previous error - diff --git a/tests/ui/runtime/native-print-no-runtime.rs b/tests/ui/runtime/native-print-no-runtime.rs deleted file mode 100644 index f0ed7d97b2c..00000000000 --- a/tests/ui/runtime/native-print-no-runtime.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ run-pass - -#![feature(start)] - -#[start] -pub fn main(_: isize, _: *const *const u8) -> isize { - println!("hello"); - 0 -} diff --git a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs index 229408fb724..f3f9ce0bd87 100644 --- a/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs +++ b/tests/ui/runtime/on-broken-pipe/auxiliary/assert-sigpipe-disposition.rs @@ -4,15 +4,16 @@ //@ compile-flags: -Cpanic=abort //@ no-prefer-dynamic so panic=abort works -#![feature(start, rustc_private)] +#![feature(rustc_private)] +#![no_main] extern crate libc; -// Use #[start] so we don't have a runtime that messes with SIGPIPE. -#[start] -fn start(argc: isize, argv: *const *const u8) -> isize { +// Use no_main so we don't have a runtime that messes with SIGPIPE. +#[no_mangle] +extern "C" fn main(argc: core::ffi::c_int, argv: *const *const u8) -> core::ffi::c_int { assert_eq!(argc, 2, "Must pass SIG_IGN or SIG_DFL as first arg"); - let arg1 = unsafe { std::ffi::CStr::from_ptr(*argv.offset(1) as *const libc::c_char) } + let arg1 = unsafe { core::ffi::CStr::from_ptr(*argv.offset(1) as *const libc::c_char) } .to_str() .unwrap(); @@ -23,8 +24,8 @@ fn start(argc: isize, argv: *const *const u8) -> isize { }; let actual = unsafe { - let mut actual: libc::sigaction = std::mem::zeroed(); - libc::sigaction(libc::SIGPIPE, std::ptr::null(), &mut actual); + let mut actual: libc::sigaction = core::mem::zeroed(); + libc::sigaction(libc::SIGPIPE, core::ptr::null(), &mut actual); #[cfg(not(target_os = "aix"))] { actual.sa_sigaction diff --git a/tests/ui/runtime/running-with-no-runtime.rs b/tests/ui/runtime/running-with-no-runtime.rs index 695025b3859..5c219b6feda 100644 --- a/tests/ui/runtime/running-with-no-runtime.rs +++ b/tests/ui/runtime/running-with-no-runtime.rs @@ -2,15 +2,15 @@ //@ ignore-wasm32 spawning processes is not supported //@ ignore-sgx no processes -#![feature(start)] +#![no_main] use std::ffi::CStr; use std::process::{Command, Output}; use std::panic; use std::str; -#[start] -fn start(argc: isize, argv: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(argc: core::ffi::c_int, argv: *const *const u8) -> core::ffi::c_int { if argc > 1 { unsafe { match **argv.offset(1) as char { diff --git a/tests/ui/sanitizer/memory-eager.rs b/tests/ui/sanitizer/memory-eager.rs index 9e7889fa1bc..532d7b308f6 100644 --- a/tests/ui/sanitizer/memory-eager.rs +++ b/tests/ui/sanitizer/memory-eager.rs @@ -15,7 +15,7 @@ // since it will be linked with an uninstrumented version of it. #![feature(core_intrinsics)] -#![feature(start)] +#![no_main] use std::hint::black_box; use std::mem::MaybeUninit; @@ -29,8 +29,8 @@ fn random() -> char { black_box(r) } -#[start] -fn main(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: std::ffi::c_int, _argv: *const *const u8) -> std::ffi::c_int { random(); 0 } diff --git a/tests/ui/sanitizer/memory-passing.rs b/tests/ui/sanitizer/memory-passing.rs index c8ab64bfaf8..96a4cd909c7 100644 --- a/tests/ui/sanitizer/memory-passing.rs +++ b/tests/ui/sanitizer/memory-passing.rs @@ -12,8 +12,8 @@ // since it will be linked with an uninstrumented version of it. #![feature(core_intrinsics)] -#![feature(start)] #![allow(invalid_value)] +#![no_main] use std::hint::black_box; @@ -25,8 +25,8 @@ fn calling_black_box_on_zst_ok() { black_box(zst); } -#[start] -fn main(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: std::ffi::c_int, _argv: *const *const u8) -> std::ffi::c_int { calling_black_box_on_zst_ok(); 0 } diff --git a/tests/ui/sanitizer/memory.rs b/tests/ui/sanitizer/memory.rs index bd2d6771749..a91fefe4d16 100644 --- a/tests/ui/sanitizer/memory.rs +++ b/tests/ui/sanitizer/memory.rs @@ -15,8 +15,8 @@ // since it will be linked with an uninstrumented version of it. #![feature(core_intrinsics)] -#![feature(start)] #![allow(invalid_value)] +#![no_main] use std::hint::black_box; use std::mem::MaybeUninit; @@ -39,8 +39,8 @@ fn xor(a: &[isize]) -> isize { s } -#[start] -fn main(_: isize, _: *const *const u8) -> isize { +#[no_mangle] +extern "C" fn main(_argc: std::ffi::c_int, _argv: *const *const u8) -> std::ffi::c_int { let r = black_box(random as fn() -> [isize; 32])(); - xor(&r) + xor(&r) as std::ffi::c_int } diff --git a/tests/ui/test-attrs/test-runner-hides-start.rs b/tests/ui/test-attrs/test-runner-hides-start.rs deleted file mode 100644 index 444ac237cfa..00000000000 --- a/tests/ui/test-attrs/test-runner-hides-start.rs +++ /dev/null @@ -1,7 +0,0 @@ -//@ run-pass -//@ compile-flags: --test - -#![feature(start)] - -#[start] -fn start(_: isize, _: *const *const u8) -> isize { panic!(); } diff --git a/tests/ui/use/use.rs b/tests/ui/use/use.rs index db031500a4a..25b8e529c43 100644 --- a/tests/ui/use/use.rs +++ b/tests/ui/use/use.rs @@ -3,7 +3,7 @@ #![allow(stable_features)] #![allow(unused_imports)] -#![feature(start, no_core, core)] +#![feature(no_core, core)] #![no_core] extern crate std; @@ -18,5 +18,4 @@ mod baz { pub use std::str as x; } -#[start] -pub fn start(_: isize, _: *const *const u8) -> isize { 0 } +fn main() {} |
