Skip to content

Commit

Permalink
auto merge of rust-lang#20145 : alexcrichton/rust/rollup, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Dec 23, 2014
2 parents 2f3cff6 + 3583d61 commit 62fb41c
Show file tree
Hide file tree
Showing 286 changed files with 6,311 additions and 5,525 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ Robert Irelan <rirelan@gmail.com>
Robert Knight <robertknight@gmail.com>
Robert Millar <robert.millar@cantab.net>
Roland Tanglao <roland@rolandtanglao.com>
Rolf Timmermans <r.w.timmermans@gmail.com>
Ron Dahlgren <ronald.dahlgren@gmail.com>
Roy Frostig <rfrostig@mozilla.com>
Russell <rpjohnst@gmail.com>
Expand Down
131 changes: 79 additions & 52 deletions man/rustc.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,75 +12,54 @@ This program is a compiler for the Rust language, available at
.SH OPTIONS

.TP
\fB\-\-crate-name NAME\fR
Specify the name of the crate being built
.TP
\fB\-\-crate-type=[bin|lib|dylib|rlib|staticlib]\fR
Configure the flavor of rust crate that is generated (default `bin`)
\fB\-h\fR, \fB\-\-help\fR
Display the help message
.TP
\fB\-\-cfg\fR SPEC
Configure the compilation environment
.TP
\fB\-\-emit=[asm,ir,bc,obj,link]\fR
Configure the output that rustc will produce
.TP
\fB\-h\fR, \fB\-\-help\fR
Display this message
.TP
\fB\-L\fR PATH
Add a directory to the library search path
.TP
\fB\-\-no\-trans\fR
Run all passes except translation; no output
\fB\-l\fR NAME[:KIND]
Link the generated crate(s) to the specified native library NAME. The optional
KIND can be one of, static, dylib, or framework. If omitted, dylib is assumed.
.TP
\fB\-\-no\-analysis\fR
Parse and expand the source, but run no analysis and produce no output
\fB\-\-crate-type\fR [bin|lib|rlib|dylib|staticlib]
Comma separated list of types of crates for the compiler to emit
.TP
\fB\-g\fR
Emit DWARF debug information into object files generated.
\fB\-\-crate-name NAME\fR
Specify the name of the crate being built
.TP
\fB\-\-debuginfo\fR LEVEL
Emit DWARF debug info to the objects created: 0 = no debug info, 1 =
line-tables only (for stacktraces and breakpoints), 2 = full debug
info with variable and type information (same as -g).
\fB\-\-emit\fR [asm|llvm-bc|llvm-ir|obj|link|dep-info]
Configure the output that rustc will produce
.TP
\fB\-\-print\fR [crate-name|output-file-names|sysroot]
Comma separated list of compiler information to print on stdout
.TP
\fB\-g\fR
Equivalent to \fI\-C\fR debuginfo=2
.TP
\fB\-O\fR
Equivalent to \fI\-\-opt\-level=2\fR
Equivalent to \fI\-C\fR opt-level=2
.TP
\fB\-o\fR FILENAME
Write output to <filename>. Ignored if more than one --emit is specified.
.TP
\fB\-\-opt\-level\fR LEVEL
Optimize with possible levels 0-3
Write output to <filename>. Ignored if multiple \fI\-\-emit\fR outputs are
specified.
.TP
\fB\-\-out\-dir\fR DIR
Write output to compiler-chosen filename in <dir>. Ignored if -o is specified.
(default the current directory)
.TP
\fB\-\-parse\-only\fR
Parse only; do not compile, assemble, or link
Write output to compiler-chosen filename in <dir>. Ignored if \fI\-o\fR is
specified. Defaults to the current directory.
.TP
\fB\-\-pretty\fR [TYPE]
Pretty-print the input instead of compiling; valid types are: normal
(un-annotated source), expanded (crates expanded), typed (crates
expanded, with type annotations), identified (fully parenthesized,
AST nodes and blocks with IDs), or flowgraph=<nodeid> (graphviz
formatted flowgraph for node)
.TP
\fB\-\-dep-info\fR [FILENAME]
Output dependency info to <filename> after compiling, in a format suitable
for use by Makefiles.
.TP
\fB\-\-sysroot\fR PATH
Override the system root
\fB\-\-explain\fR OPT
Provide a detailed explanation of an error message
.TP
\fB\-\-test\fR
Build a test harness
.TP
\fB\-\-target\fR TRIPLE
Target triple cpu-manufacturer-kernel[-os] to compile for (see
http://sources.redhat.com/autobook/autobook/autobook_17.html
for details)
Target triple cpu-manufacturer-kernel[-os] to compile for (see chapter 3.4 of
http://www.sourceware.org/autobook/ for details)
.TP
\fB\-W\fR help
Print 'lint' options and default settings
Expand All @@ -97,15 +76,30 @@ Set lint denied
\fB\-F\fR OPT, \fB\-\-forbid\fR OPT
Set lint forbidden
.TP
\fB\-Z\fR FLAG
Set internal debugging options. Use "-Z help" to print available options.
.TP
\fB\-C\fR FLAG[=VAL], \fB\-\-codegen\fR FLAG[=VAL]
Set a codegen-related flag to the value specified. Use "-C help" to print
available flags. See CODEGEN OPTIONS below
.TP
\fB\-v\fR, \fB\-\-version\fR
\fB\-V\fR, \fB\-\-version\fR
Print version info and exit
.TP
\fB\-v\fR, \fB\-\-verbose\fR
Use verbose output
.TP
\fB\-\-extern\fR NAME=PATH
Specify where an external rust library is located
.TP
\fB\-\-sysroot\fR PATH
Override the system root
.TP
\fB\-Z\fR FLAG
Set internal debugging options. Use "-Z help" to print available options.
.TP
\fB\-\-color\fR auto|always|never
Configure coloring of output:
auto = colorize, if output goes to a tty (default);
always = always colorize output;
never = never colorize output

.SH CODEGEN OPTIONS

Expand All @@ -121,6 +115,9 @@ objects.
A space-separated list of extra arguments to pass to the linker when the linker
is invoked.
.TP
\fBlto\fR
Perform LLVM link-time optimizations.
.TP
\fBtarget-cpu\fR=help
Selects a target processor. If the value is 'help', then a list of available
CPUs is printed.
Expand Down Expand Up @@ -167,8 +164,38 @@ Prefers dynamic linking to static linking.
\fBno-integrated-as\fR
Force usage of an external assembler rather than LLVM's integrated one.
.TP
\fBno-redzone\fR
Disable the use of the redzone.
.TP
\fBrelocation-model\fR=[pic,static,dynamic-no-pic]
The relocation model to use. (default: pic)
The relocation model to use. (Default: pic)
.TP
\fBcode-model\fR=[small,kernel,medium,large]
Choose the code model to use.
.TP
\fBmetadata\fR=val
Metadata to mangle symbol names with.
.TP
\fBextra-filename\fR=val
Extra data to put in each output filename.
.TP
\fBcodegen-units\fR=val
Divide crate into N units to optimize in parallel.
.TP
\fBremark\fR=val
Print remarks for these optimization passes (space separated, or "all").
.TP
\fBno-stack-check\fR
Disable checks for stack exhaustion (a memory-safety hazard!).
.TP
\fBdebuginfo\fR=val
Debug info emission level:
0 = no debug info;
1 = line-tables only (for stacktraces and breakpoints);
2 = full debug info with variable and type information.
.TP
\fBopt-level\fR=val
Optimize with possible levels 0-3

.SH "EXAMPLES"
To build an executable from a source file with a main function:
Expand Down
5 changes: 2 additions & 3 deletions mk/rt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
# that's per-target so you're allowed to conditionally add files based on the
# target.
################################################################################
NATIVE_LIBS := rust_builtin hoedown morestack miniz context_switch \
NATIVE_LIBS := rust_builtin hoedown morestack miniz \
rustrt_native rust_test_helpers

# $(1) is the target triple
Expand All @@ -58,8 +58,7 @@ NATIVE_DEPS_rustrt_native_$(1) := \
arch/$$(HOST_$(1))/record_sp.S
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
NATIVE_DEPS_morestack_$(1) := arch/$$(HOST_$(1))/morestack.S
NATIVE_DEPS_context_switch_$(1) := \
arch/$$(HOST_$(1))/_context.S


################################################################################
# You shouldn't find it that necessary to edit anything below this line.
Expand Down
6 changes: 2 additions & 4 deletions src/compiletest/compiletest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
matches.opt_str("ratchet-metrics").map(|s| Path::new(s)),
ratchet_noise_percent:
matches.opt_str("ratchet-noise-percent")
.and_then(|s| from_str::<f64>(s.as_slice())),
.and_then(|s| s.as_slice().parse::<f64>()),
runtool: matches.opt_str("runtool"),
host_rustcflags: matches.opt_str("host-rustcflags"),
target_rustcflags: matches.opt_str("target-rustcflags"),
Expand Down Expand Up @@ -190,9 +190,7 @@ pub fn log_config(config: &Config) {
logv(c, format!("filter: {}",
opt_str(&config.filter
.as_ref()
.map(|re| {
re.to_string().into_string()
}))));
.map(|re| re.to_string()))));
logv(c, format!("runtool: {}", opt_str(&config.runtool)));
logv(c, format!("host-rustcflags: {}",
opt_str(&config.host_rustcflags)));
Expand Down
6 changes: 3 additions & 3 deletions src/compiletest/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ pub fn gdb_version_to_int(version_string: &str) -> int {
panic!("{}", error_string);
}

let major: int = from_str(components[0]).expect(error_string);
let minor: int = from_str(components[1]).expect(error_string);
let major: int = components[0].parse().expect(error_string);
let minor: int = components[1].parse().expect(error_string);

return major * 1000 + minor;
}
Expand All @@ -362,6 +362,6 @@ pub fn lldb_version_to_int(version_string: &str) -> int {
"Encountered LLDB version string with unexpected format: {}",
version_string);
let error_string = error_string.as_slice();
let major: int = from_str(version_string).expect(error_string);
let major: int = version_string.parse().expect(error_string);
return major;
}
2 changes: 1 addition & 1 deletion src/compiletest/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1361,7 +1361,7 @@ fn split_maybe_args(argstr: &Option<String>) -> Vec<String> {
s.as_slice()
.split(' ')
.filter_map(|s| {
if s.is_whitespace() {
if s.chars().all(|c| c.is_whitespace()) {
None
} else {
Some(s.to_string())
Expand Down
28 changes: 14 additions & 14 deletions src/doc/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -1010,8 +1010,8 @@ in the original declaration.
Finally, because fields have names, we can access the field through dot
notation: `origin.x`.

The values in structs are immutable, like other bindings in Rust. However, you
can use `mut` to make them mutable:
The values in structs are immutable by default, like other bindings in Rust.
Use `mut` to make them mutable:

```{rust}
struct Point {
Expand Down Expand Up @@ -2257,10 +2257,10 @@ a function for that:
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice());
let input_num: Option<uint> = input.parse();
```
The `from_str` function takes in a `&str` value and converts it into something.
The `parse` function takes in a `&str` value and converts it into something.
We tell it what kind of something with a type hint. Remember our type hint with
`random()`? It looked like this:
Expand All @@ -2279,8 +2279,8 @@ In this case, we say `x` is a `uint` explicitly, so Rust is able to properly
tell `random()` what to generate. In a similar fashion, both of these work:
```{rust,ignore}
let input_num = from_str::<uint>("5"); // input_num: Option<uint>
let input_num: Option<uint> = from_str("5"); // input_num: Option<uint>
let input_num = "5".parse::<uint>(); // input_num: Option<uint>
let input_num: Option<uint> = "5".parse(); // input_num: Option<uint>
```
Anyway, with us now converting our input to a number, our code looks like this:
Expand All @@ -2301,7 +2301,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice());
let input_num: Option<uint> = input.parse();

println!("You guessed: {}", input_num);

Expand Down Expand Up @@ -2350,7 +2350,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice());
let input_num: Option<uint> = input.parse();
let num = match input_num {
Some(num) => num,
Expand Down Expand Up @@ -2395,7 +2395,7 @@ Uh, what? But we did!
... actually, we didn't. See, when you get a line of input from `stdin()`,
you get all the input. Including the `\n` character from you pressing Enter.
Therefore, `from_str()` sees the string `"5\n"` and says "nope, that's not a
Therefore, `parse()` sees the string `"5\n"` and says "nope, that's not a
number; there's non-number stuff in there!" Luckily for us, `&str`s have an easy
method we can use defined on them: `trim()`. One small modification, and our
code looks like this:
Expand All @@ -2416,7 +2416,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice().trim());
let input_num: Option<uint> = input.trim().parse();
let num = match input_num {
Some(num) => num,
Expand Down Expand Up @@ -2491,7 +2491,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice().trim());
let input_num: Option<uint> = input.trim().parse();

let num = match input_num {
Some(num) => num,
Expand Down Expand Up @@ -2566,7 +2566,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice().trim());
let input_num: Option<uint> = input.trim().parse();
let num = match input_num {
Some(num) => num,
Expand Down Expand Up @@ -2621,7 +2621,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice().trim());
let input_num: Option<uint> = input.trim().parse();
let num = match input_num {
Some(num) => num,
Expand Down Expand Up @@ -2697,7 +2697,7 @@ fn main() {
let input = io::stdin().read_line()
.ok()
.expect("Failed to read line");
let input_num: Option<uint> = from_str(input.as_slice().trim());
let input_num: Option<uint> = input.trim().parse();
let num = match input_num {
Some(num) => num,
Expand Down
2 changes: 1 addition & 1 deletion src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3177,7 +3177,7 @@ Some examples of call expressions:
# fn add(x: int, y: int) -> int { 0 }
let x: int = add(1, 2);
let pi: Option<f32> = from_str("3.14");
let pi: Option<f32> = "3.14".parse();
```

### Lambda expressions
Expand Down
Loading

0 comments on commit 62fb41c

Please sign in to comment.