Skip to content

Commit 1d64311

Browse files
committed
---
yaml --- r: 103922 b: refs/heads/try c: 87fe3cc h: refs/heads/master v: v3
1 parent 5d1d8b0 commit 1d64311

File tree

156 files changed

+1600
-2856
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+1600
-2856
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 62f1d68439dcfd509eaca29887afa97f22938373
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6e7f170fedd3c526a643c0b2d13863acd982be02
5-
refs/heads/try: 454882dcb7fdb03867d695a88335e2d2c8f7561a
5+
refs/heads/try: 87fe3ccf09fa16d662427ffdd7a846d72551a27f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/man/rustc.1

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,21 @@ This program is a compiler for the Rust language, available at
1212
.SH OPTIONS
1313

1414
.TP
15-
\fB\-\-bin\fR
16-
Compile an executable crate (default)
17-
.TP
18-
\fB\-c\fR
19-
Compile and assemble, but do not link
15+
\fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
16+
Configure the flavor of rust crate that is generated (default `bin`)
2017
.TP
2118
\fB\-\-cfg\fR SPEC
2219
Configure the compilation environment
2320
.TP
24-
\fB\-\-emit\-llvm\fR
25-
Produce an LLVM bitcode file
21+
\fB\-\-emit=[asm,ir,bc,obj,link]\fR
22+
Configure the output that rustc will produce
2623
.TP
2724
\fB\-h\fR, \fB\-\-help\fR
2825
Display this message
2926
.TP
3027
\fB\-L\fR PATH
3128
Add a directory to the library search path
3229
.TP
33-
\fB\-\-lib\fR
34-
Compile a library crate
35-
.TP
3630
\fB\-\-linker\fR LINKER
3731
Program to use for linking instead of the default
3832
.TP
@@ -49,7 +43,7 @@ Run all passes except translation; no output
4943
Equivalent to \fI\-\-opt\-level=2\fR
5044
.TP
5145
\fB\-o\fR FILENAME
52-
Write output to <filename>
46+
Write output to <filename>. Ignored if more than one --emit is specified.
5347
.TP
5448
\fB\-\-opt\-level\fR LEVEL
5549
Optimize with possible levels 0-3
@@ -60,7 +54,8 @@ the default passes for the optimization level. A value of 'list'
6054
will list the available passes.
6155
.TP
6256
\fB\-\-out\-dir\fR DIR
63-
Write output to compiler-chosen filename in <dir>
57+
Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
58+
(default the current directory)
6459
.TP
6560
\fB\-\-parse\-only\fR
6661
Parse only; do not compile, assemble, or link
@@ -71,9 +66,6 @@ Pretty-print the input instead of compiling; valid types are: normal
7166
expanded, with type annotations), or identified (fully parenthesized,
7267
AST nodes and blocks with IDs)
7368
.TP
74-
\fB\-S\fR
75-
Compile only; do not assemble or link
76-
.TP
7769
\fB\-\-save\-temps\fR
7870
Write intermediate files (.bc, .opt.bc, .o) in addition to normal output
7971
.TP
@@ -120,7 +112,7 @@ To build an executable from a source file with a main function:
120112
$ rustc -o hello hello.rs
121113

122114
To build a library from a source file:
123-
$ rustc --lib hello-lib.rs
115+
$ rustc --crate-type=lib hello-lib.rs
124116

125117
To build either with a crate (.rs) file:
126118
$ rustc hello.rs

branches/try/mk/crates.mk

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,20 @@
4949
# automatically generated for all stage/host/target combinations.
5050
################################################################################
5151

52-
TARGET_CRATES := std extra green rustuv native flate arena glob term semver uuid serialize sync
52+
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53+
uuid serialize sync getopts
5354
HOST_CRATES := syntax rustc rustdoc
5455
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5556
TOOLS := compiletest rustdoc rustc
5657

5758
DEPS_std := native:rustrt
58-
DEPS_extra := std serialize sync term
59+
DEPS_extra := std term sync serialize getopts
5960
DEPS_green := std
6061
DEPS_rustuv := std native:uv native:uv_support
6162
DEPS_native := std
6263
DEPS_syntax := std extra term serialize
63-
DEPS_rustc := syntax native:rustllvm flate arena serialize sync
64-
DEPS_rustdoc := rustc native:sundown serialize sync
64+
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts
65+
DEPS_rustdoc := rustc native:sundown serialize sync getopts
6566
DEPS_flate := std native:miniz
6667
DEPS_arena := std extra
6768
DEPS_glob := std
@@ -70,8 +71,9 @@ DEPS_term := std
7071
DEPS_semver := std
7172
DEPS_uuid := std serialize
7273
DEPS_sync := std
74+
DEPS_getopts := std
7375

74-
TOOL_DEPS_compiletest := extra green rustuv
76+
TOOL_DEPS_compiletest := extra green rustuv getopts
7577
TOOL_DEPS_rustdoc := rustdoc green rustuv
7678
TOOL_DEPS_rustc := rustc green rustuv
7779
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs
@@ -102,7 +104,7 @@ $(foreach crate,$(CRATES),$(eval $(call RUST_CRATE,$(crate))))
102104
#
103105
# $(1) is the crate to generate variables for
104106
define RUST_TOOL
105-
TOOL_INPUTS_$(1) := $$(wildcard $$(addprefix $(S)$$(dir $$(TOOL_SOURCE_$(1))), \
107+
TOOL_INPUTS_$(1) := $$(wildcard $$(addprefix $$(dir $$(TOOL_SOURCE_$(1))), \
106108
*.rs */*.rs */*/*.rs */*/*/*.rs))
107109
endef
108110

branches/try/mk/tests.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ $$(TLIB2_T_$(2)_H_$(3))/$$(FT_LIB): \
835835
tmp/$$(FT).rc \
836836
$$(SREQ2_T_$(2)_H_$(3))
837837
@$$(call E, compile_and_link: $$@)
838-
$$(STAGE2_T_$(2)_H_$(3)) --lib -o $$@ $$< \
838+
$$(STAGE2_T_$(2)_H_$(3)) --crate-type=dylib --out-dir $$(@D) $$< \
839839
-L "$$(RT_OUTPUT_DIR_$(2))"
840840

841841
$(3)/test/$$(FT_DRIVER)-$(2)$$(X_$(2)): \

branches/try/src/compiletest/compiletest.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
#[deny(warnings)];
1515

1616
extern mod extra;
17+
extern mod getopts;
1718

1819
use std::os;
1920
use std::io;
2021
use std::io::fs;
2122

22-
use extra::getopts;
23-
use extra::getopts::groups::{optopt, optflag, reqopt};
23+
use getopts::{optopt, optflag, reqopt};
2424
use extra::test;
2525

2626
use common::config;
@@ -49,7 +49,7 @@ pub fn main() {
4949

5050
pub fn parse_config(args: ~[~str]) -> config {
5151

52-
let groups : ~[getopts::groups::OptGroup] =
52+
let groups : ~[getopts::OptGroup] =
5353
~[reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"),
5454
reqopt("", "run-lib-path", "path to target shared libraries", "PATH"),
5555
reqopt("", "rustc-path", "path to rustc to use for compiling", "PATH"),
@@ -85,20 +85,20 @@ pub fn parse_config(args: ~[~str]) -> config {
8585
let args_ = args.tail();
8686
if args[1] == ~"-h" || args[1] == ~"--help" {
8787
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
88-
println!("{}", getopts::groups::usage(message, groups));
88+
println!("{}", getopts::usage(message, groups));
8989
println!("");
9090
fail!()
9191
}
9292

9393
let matches =
94-
&match getopts::groups::getopts(args_, groups) {
94+
&match getopts::getopts(args_, groups) {
9595
Ok(m) => m,
9696
Err(f) => fail!("{}", f.to_err_msg())
9797
};
9898

9999
if matches.opt_present("h") || matches.opt_present("help") {
100100
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
101-
println!("{}", getopts::groups::usage(message, groups));
101+
println!("{}", getopts::usage(message, groups));
102102
println!("");
103103
fail!()
104104
}

branches/try/src/compiletest/runtest.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ actual:\n\
245245
};
246246
// FIXME (#9639): This needs to handle non-utf8 paths
247247
let mut args = ~[~"-",
248-
~"--no-trans", ~"--lib",
248+
~"--no-trans", ~"--crate-type=lib",
249249
~"--target=" + target,
250250
~"-L", config.build_base.as_str().unwrap().to_owned(),
251251
~"-L",
@@ -659,7 +659,7 @@ fn compile_test_(config: &config, props: &TestProps,
659659
// FIXME (#9639): This needs to handle non-utf8 paths
660660
let link_args = ~[~"-L", aux_dir.as_str().unwrap().to_owned()];
661661
let args = make_compile_args(config, props, link_args + extra_args,
662-
make_exe_name, testfile);
662+
|a, b| ThisFile(make_exe_name(a, b)), testfile);
663663
compose_and_run_compiler(config, props, testfile, args, None)
664664
}
665665

@@ -702,8 +702,12 @@ fn compose_and_run_compiler(
702702
let abs_ab = config.aux_base.join(rel_ab.as_slice());
703703
let aux_props = load_props(&abs_ab);
704704
let aux_args =
705-
make_compile_args(config, &aux_props, ~[~"--dylib"] + extra_link_args,
706-
|a,b| make_lib_name(a, b, testfile), &abs_ab);
705+
make_compile_args(config, &aux_props, ~[~"--crate-type=dylib"]
706+
+ extra_link_args,
707+
|a,b| {
708+
let f = make_lib_name(a, b, testfile);
709+
ThisDirectory(f.dir_path())
710+
}, &abs_ab);
707711
let auxres = compose_and_run(config, &abs_ab, aux_args, ~[],
708712
config.compile_lib_path, None);
709713
if !auxres.status.success() {
@@ -741,10 +745,15 @@ fn compose_and_run(config: &config, testfile: &Path,
741745
prog, args, procenv, input);
742746
}
743747

748+
enum TargetLocation {
749+
ThisFile(Path),
750+
ThisDirectory(Path),
751+
}
752+
744753
fn make_compile_args(config: &config,
745754
props: &TestProps,
746755
extras: ~[~str],
747-
xform: |&config, &Path| -> Path,
756+
xform: |&config, &Path| -> TargetLocation,
748757
testfile: &Path)
749758
-> ProcArgs {
750759
let xform_file = xform(config, testfile);
@@ -755,10 +764,14 @@ fn make_compile_args(config: &config,
755764
};
756765
// FIXME (#9639): This needs to handle non-utf8 paths
757766
let mut args = ~[testfile.as_str().unwrap().to_owned(),
758-
~"-o", xform_file.as_str().unwrap().to_owned(),
759767
~"-L", config.build_base.as_str().unwrap().to_owned(),
760768
~"--target=" + target]
761769
+ extras;
770+
let path = match xform_file {
771+
ThisFile(path) => { args.push(~"-o"); path }
772+
ThisDirectory(path) => { args.push(~"--out-dir"); path }
773+
};
774+
args.push(path.as_str().unwrap().to_owned());
762775
args.push_all_move(split_maybe_args(&config.rustcflags));
763776
args.push_all_move(split_maybe_args(&props.compile_flags));
764777
return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args};
@@ -1043,10 +1056,10 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps,
10431056
let aux_dir = aux_output_dir_name(config, testfile);
10441057
// FIXME (#9639): This needs to handle non-utf8 paths
10451058
let link_args = ~[~"-L", aux_dir.as_str().unwrap().to_owned()];
1046-
let llvm_args = ~[~"-c", ~"--lib", ~"--save-temps"];
1059+
let llvm_args = ~[~"--emit=obj", ~"--crate-type=lib", ~"--save-temps"];
10471060
let args = make_compile_args(config, props,
10481061
link_args + llvm_args,
1049-
make_o_name, testfile);
1062+
|a, b| ThisFile(make_o_name(a, b)), testfile);
10501063
compose_and_run_compiler(config, props, testfile, args, None)
10511064
}
10521065

branches/try/src/doc/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ li {list-style-type: none; }
3939

4040
* [The `arena` allocation library](arena/index.html)
4141
* [The `flate` compression library](flate/index.html)
42+
* [The `getopts` argument parsing library](getopts/index.html)
4243
* [The `glob` file path matching library](glob/index.html)
4344
* [The `semver` version collation library](semver/index.html)
4445
* [The `serialize` value encoding/decoding library](serialize/index.html)

0 commit comments

Comments
 (0)