Skip to content

Commit cbe79bb

Browse files
committed
librust: Remove unnecessary workaround. Closes #7617
1 parent 6216661 commit cbe79bb

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/librust/rust.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,20 +60,14 @@ struct Command<'self> {
6060
usage_full: UsageSource<'self>,
6161
}
6262

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{
63+
static COMMANDS: &'static [Command<'static>] = &'static [
64+
Command {
7165
cmd: "build",
7266
action: CallMain("rustc", rustc::main_args),
7367
usage_line: "compile rust source files",
7468
usage_full: UsgCall(rustc_help),
7569
},
76-
Command{
70+
Command {
7771
cmd: "run",
7872
action: Call(cmd_run),
7973
usage_line: "build an executable, and run it",
@@ -83,7 +77,7 @@ static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
8377
\n\nUsage:\trust run <filename> [<arguments>...]"
8478
)
8579
},
86-
Command{
80+
Command {
8781
cmd: "test",
8882
action: Call(cmd_test),
8983
usage_line: "build a test executable, and run it",
@@ -93,25 +87,25 @@ static COMMANDS: [Command<'static>, .. NUM_OF_COMMANDS] = [
9387
./<filestem>test~\"\n\nUsage:\trust test <filename>"
9488
)
9589
},
96-
Command{
90+
Command {
9791
cmd: "doc",
9892
action: CallMain("rustdoc", rustdoc::main_args),
9993
usage_line: "generate documentation from doc comments",
10094
usage_full: UsgCall(rustdoc::config::usage),
10195
},
102-
Command{
96+
Command {
10397
cmd: "pkg",
10498
action: CallMain("rustpkg", rustpkg::main_args),
10599
usage_line: "download, build, install rust packages",
106100
usage_full: UsgCall(rustpkg::usage::general),
107101
},
108-
Command{
102+
Command {
109103
cmd: "sketch",
110104
action: CallMain("rusti", rusti::main_args),
111105
usage_line: "run a rust interpreter",
112106
usage_full: UsgStr("\nUsage:\trusti"),
113107
},
114-
Command{
108+
Command {
115109
cmd: "help",
116110
action: Call(cmd_help),
117111
usage_line: "show detailed usage of a command",

0 commit comments

Comments
 (0)