File tree 2 files changed +22
-9
lines changed
2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -202,8 +202,8 @@ impl fold::Folder for EntryPointCleaner {
202
202
let folded = fold:: noop_fold_item ( i, self ) . expect_one ( "noop did something" ) ;
203
203
self . depth -= 1 ;
204
204
205
- // Remove any #[main] from the AST so it doesn't clash with
206
- // the one we're going to add, but mark it as
205
+ // Remove any #[main] or #[start] from the AST so it doesn't
206
+ // clash with the one we're going to add, but mark it as
207
207
// #[allow(dead_code)] to avoid printing warnings.
208
208
let folded = match entry:: entry_point_type ( & * folded, self . depth ) {
209
209
EntryPointType :: MainNamed |
@@ -221,13 +221,10 @@ impl fold::Folder for EntryPointCleaner {
221
221
ast:: Item {
222
222
id : id,
223
223
ident : ident,
224
- attrs : attrs. into_iter ( ) . filter_map ( |attr| {
225
- if !attr. check_name ( "main" ) {
226
- Some ( attr)
227
- } else {
228
- None
229
- }
230
- } )
224
+ attrs : attrs. into_iter ( )
225
+ . filter ( |attr| {
226
+ !attr. check_name ( "main" ) && !attr. check_name ( "start" )
227
+ } )
231
228
. chain ( iter:: once ( allow_dead_code) )
232
229
. collect ( ) ,
233
230
node : node,
Original file line number Diff line number Diff line change
1
+ // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2
+ // file at the top-level directory of this distribution and at
3
+ // http://rust-lang.org/COPYRIGHT.
4
+ //
5
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6
+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7
+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8
+ // option. This file may not be copied, modified, or distributed
9
+ // except according to those terms.
10
+
11
+ // compile-flags: --test
12
+
13
+ #![ feature( start) ]
14
+
15
+ #[ start]
16
+ fn start ( _: isize , _: * const * const u8 ) -> isize { panic ! ( ) ; }
You can’t perform that action at this time.
0 commit comments