@@ -60,14 +60,20 @@ struct Command<'self> {
60
60
usage_full : UsageSource < ' self > ,
61
61
}
62
62
63
- static COMMANDS : & ' static [ Command < ' static > ] = & ' static [
64
- Command {
63
+ static NUM_OF_COMMANDS : uint = 7 ;
64
+
65
+ // FIXME(#7617): should just be &'static [Command<'static>]
66
+ // but mac os doesn't seem to like that and tries to loop
67
+ // past the end of COMMANDS in usage thus passing garbage
68
+ // to str::repeat and eventually malloc and crashing.
69
+ static COMMANDS : [ Command < ' static > , .. NUM_OF_COMMANDS ] = [
70
+ Command {
65
71
cmd : "build" ,
66
72
action : CallMain ( "rustc" , rustc:: main_args) ,
67
73
usage_line : "compile rust source files" ,
68
74
usage_full : UsgCall ( rustc_help) ,
69
75
} ,
70
- Command {
76
+ Command {
71
77
cmd : "run" ,
72
78
action : Call ( cmd_run) ,
73
79
usage_line : "build an executable, and run it" ,
@@ -77,7 +83,7 @@ static COMMANDS: &'static [Command<'static>] = &'static [
77
83
\n \n Usage:\t rust run <filename> [<arguments>...]"
78
84
)
79
85
} ,
80
- Command {
86
+ Command {
81
87
cmd : "test" ,
82
88
action : Call ( cmd_test) ,
83
89
usage_line : "build a test executable, and run it" ,
@@ -87,25 +93,25 @@ static COMMANDS: &'static [Command<'static>] = &'static [
87
93
./<filestem>test~\" \n \n Usage:\t rust test <filename>"
88
94
)
89
95
} ,
90
- Command {
96
+ Command {
91
97
cmd : "doc" ,
92
98
action : CallMain ( "rustdoc" , rustdoc:: main_args) ,
93
99
usage_line : "generate documentation from doc comments" ,
94
100
usage_full : UsgCall ( rustdoc:: config:: usage) ,
95
101
} ,
96
- Command {
102
+ Command {
97
103
cmd : "pkg" ,
98
104
action : CallMain ( "rustpkg" , rustpkg:: main_args) ,
99
105
usage_line : "download, build, install rust packages" ,
100
106
usage_full : UsgCall ( rustpkg:: usage:: general) ,
101
107
} ,
102
- Command {
108
+ Command {
103
109
cmd : "sketch" ,
104
110
action : CallMain ( "rusti" , rusti:: main_args) ,
105
111
usage_line : "run a rust interpreter" ,
106
112
usage_full : UsgStr ( "\n Usage:\t rusti" ) ,
107
113
} ,
108
- Command {
114
+ Command {
109
115
cmd : "help" ,
110
116
action : Call ( cmd_help) ,
111
117
usage_line : "show detailed usage of a command" ,
0 commit comments