Skip to content

Commit bac606e

Browse files
committed
---
yaml --- r: 194035 b: refs/heads/beta c: 5b9e87b h: refs/heads/master i: 194033: 611f340 194031: 118b44a v: v3
1 parent dc000ed commit bac606e

File tree

95 files changed

+757
-505
lines changed

Some content is hidden

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

95 files changed

+757
-505
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: 84b14c5dc9bceeadb24beaa5ae1b126701b7d932
34+
refs/heads/beta: 5b9e87b5711361cb01bf3e066bc53c765f6dc5b9
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: de8a23bbc3a7b9cbd7574b5b91a34af59bf030e6

branches/beta/man/rustc.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ full debug info with variable and type information.
242242
\fBopt\-level\fR=\fIVAL\fR
243243
Optimize with possible levels 0\[en]3
244244

245-
.SH ENVIRONMENT VARIABLES
245+
.SH ENVIRONMENT
246246

247247
Some of these affect the output of the compiler, while others affect programs
248248
which link to the standard library.

branches/beta/src/compiletest/procsrv.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@
1010

1111
#![allow(deprecated)] // for old path, for dynamic_lib
1212

13-
use std::process::{ExitStatus, Command, Child, Output, Stdio};
14-
use std::io::prelude::*;
1513
use std::dynamic_lib::DynamicLibrary;
14+
use std::io::prelude::*;
15+
use std::old_path::Path;
16+
use std::process::{ExitStatus, Command, Child, Output, Stdio};
1617

1718
fn add_target_env(cmd: &mut Command, lib_path: &str, aux_path: Option<&str>) {
1819
// Need to be sure to put both the lib_path and the aux path in the dylib

branches/beta/src/doc/trpl/SUMMARY.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Summary
22

3-
* [I: The Basics](basic.md)
3+
* [The Basics](basic.md)
44
* [Installing Rust](installing-rust.md)
55
* [Hello, world!](hello-world.md)
66
* [Hello, Cargo!](hello-cargo.md)
@@ -14,7 +14,7 @@
1414
* [Strings](strings.md)
1515
* [Arrays, Vectors, and Slices](arrays-vectors-and-slices.md)
1616
* [Standard Input](standard-input.md)
17-
* [II: Intermediate Rust](intermediate.md)
17+
* [Intermediate Rust](intermediate.md)
1818
* [Crates and Modules](crates-and-modules.md)
1919
* [Testing](testing.md)
2020
* [Pointers](pointers.md)
@@ -31,7 +31,7 @@
3131
* [Concurrency](concurrency.md)
3232
* [Error Handling](error-handling.md)
3333
* [Documentation](documentation.md)
34-
* [III: Advanced Topics](advanced.md)
34+
* [Advanced Topics](advanced.md)
3535
* [FFI](ffi.md)
3636
* [Unsafe Code](unsafe.md)
3737
* [Advanced Macros](advanced-macros.md)

branches/beta/src/libcollections/btree/map.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use core::default::Default;
2424
use core::fmt::Debug;
2525
use core::hash::{Hash, Hasher};
2626
use core::iter::{Map, FromIterator, IntoIterator};
27-
use core::ops::{Index, IndexMut};
27+
use core::ops::{Index};
2828
use core::{iter, fmt, mem, usize};
2929
use Bound::{self, Included, Excluded, Unbounded};
3030

@@ -925,15 +925,6 @@ impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
925925
}
926926
}
927927

928-
#[stable(feature = "rust1", since = "1.0.0")]
929-
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
930-
where K: Borrow<Q>, Q: Ord
931-
{
932-
fn index_mut(&mut self, key: &Q) -> &mut V {
933-
self.get_mut(key).expect("no entry found for key")
934-
}
935-
}
936-
937928
/// Genericises over how to get the correct type of iterator from the correct type
938929
/// of Node ownership.
939930
trait Traverse<N> {

branches/beta/src/libcollections/fmt.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@
262262
//!
263263
//! ```
264264
//! # #![allow(unused_must_use)]
265+
//! use std::io::Write;
265266
//! let mut w = Vec::new();
266267
//! write!(&mut w, "Hello {}!", "world");
267268
//! ```
@@ -288,15 +289,15 @@
288289
//!
289290
//! ```
290291
//! use std::fmt;
291-
//! use std::old_io;
292+
//! use std::io::{self, Write};
292293
//!
293294
//! fmt::format(format_args!("this returns {}", "String"));
294295
//!
295-
//! let mut some_writer = old_io::stdout();
296+
//! let mut some_writer = io::stdout();
296297
//! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro"));
297298
//!
298299
//! fn my_fmt_fn(args: fmt::Arguments) {
299-
//! write!(&mut old_io::stdout(), "{}", args);
300+
//! write!(&mut io::stdout(), "{}", args);
300301
//! }
301302
//! my_fmt_fn(format_args!("or a {} too", "function"));
302303
//! ```

branches/beta/src/libcore/macros.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ macro_rules! try {
176176
///
177177
/// ```
178178
/// # #![allow(unused_must_use)]
179+
/// use std::io::Write;
179180
///
180181
/// let mut w = Vec::new();
181182
/// write!(&mut w, "test");

branches/beta/src/libcore/prelude.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ pub use marker::{Copy, Send, Sized, Sync};
2929
pub use ops::{Drop, Fn, FnMut, FnOnce};
3030

3131
// Reexported functions
32-
#[allow(deprecated)]
33-
pub use iter::range;
3432
pub use mem::drop;
3533

3634
// Reexported types and traits

branches/beta/src/libcore/result.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@
110110
//! something like this:
111111
//!
112112
//! ```{.ignore}
113-
//! use std::old_io::{File, Open, Write};
113+
//! use std::old_io::*;
114+
//! use std::old_path::Path;
114115
//!
115116
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
116117
//! // If `write_line` errors, then we'll never know, because the return
@@ -128,7 +129,8 @@
128129
//! a marginally useful message indicating why:
129130
//!
130131
//! ```{.no_run}
131-
//! use std::old_io::{File, Open, Write};
132+
//! use std::old_io::*;
133+
//! use std::old_path::Path;
132134
//!
133135
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
134136
//! file.write_line("important message").ok().expect("failed to write message");
@@ -138,7 +140,8 @@
138140
//! You might also simply assert success:
139141
//!
140142
//! ```{.no_run}
141-
//! # use std::old_io::{File, Open, Write};
143+
//! # use std::old_io::*;
144+
//! # use std::old_path::Path;
142145
//!
143146
//! # let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
144147
//! assert!(file.write_line("important message").is_ok());
@@ -148,7 +151,8 @@
148151
//! Or propagate the error up the call stack with `try!`:
149152
//!
150153
//! ```
151-
//! # use std::old_io::{File, Open, Write, IoError};
154+
//! # use std::old_io::*;
155+
//! # use std::old_path::Path;
152156
//! fn write_message() -> Result<(), IoError> {
153157
//! let mut file = File::open_mode(&Path::new("valuable_data.txt"), Open, Write);
154158
//! try!(file.write_line("important message"));
@@ -167,7 +171,8 @@
167171
//! It replaces this:
168172
//!
169173
//! ```
170-
//! use std::old_io::{File, Open, Write, IoError};
174+
//! use std::old_io::*;
175+
//! use std::old_path::Path;
171176
//!
172177
//! struct Info {
173178
//! name: String,
@@ -191,7 +196,8 @@
191196
//! With this:
192197
//!
193198
//! ```
194-
//! use std::old_io::{File, Open, Write, IoError};
199+
//! use std::old_io::*;
200+
//! use std::old_path::Path;
195201
//!
196202
//! struct Info {
197203
//! name: String,
@@ -446,7 +452,7 @@ impl<T, E> Result<T, E> {
446452
/// ignoring I/O and parse errors:
447453
///
448454
/// ```
449-
/// use std::old_io::IoResult;
455+
/// use std::old_io::*;
450456
///
451457
/// let mut buffer: &[u8] = b"1\n2\n3\n4\n";
452458
/// let mut buffer = &mut buffer;

branches/beta/src/libcoretest/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn test_bool_from_str() {
3535
fn check_contains_all_substrings(s: &str) {
3636
assert!(s.contains(""));
3737
for i in 0..s.len() {
38-
for j in range(i+1, s.len() + 1) {
38+
for j in i+1..s.len() + 1 {
3939
assert!(s.contains(&s[i..j]));
4040
}
4141
}

branches/beta/src/librustc/README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
An informal guide to reading and working on the rustc compiler.
2+
==================================================================
3+
4+
If you wish to expand on this document, or have a more experienced
5+
Rust contributor add anything else to it, please get in touch:
6+
7+
* http://internals.rust-lang.org/
8+
* https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust
9+
10+
or file a bug:
11+
12+
https://github.com/rust-lang/rust/issues
13+
14+
Your concerns are probably the same as someone else's.
15+
16+
The crates of rustc
17+
===================
18+
19+
Rustc consists of a number of crates, including `libsyntax`,
20+
`librustc`, `librustc_back`, `librustc_trans`, and `librustc_driver`
21+
(the names and divisions are not set in stone and may change;
22+
in general, a finer-grained division of crates is preferable):
23+
24+
- `libsyntax` contains those things concerned purely with syntax –
25+
that is, the AST, parser, pretty-printer, lexer, macro expander, and
26+
utilities for traversing ASTs – are in a separate crate called
27+
"syntax", whose files are in `./../libsyntax`, where `.` is the
28+
current directory (that is, the parent directory of front/, middle/,
29+
back/, and so on).
30+
31+
- `librustc` (the current directory) contains the high-level analysis
32+
passes, such as the type checker, borrow checker, and so forth.
33+
It is the heart of the compiler.
34+
35+
- `librustc_back` contains some very low-level details that are
36+
specific to different LLVM targets and so forth.
37+
38+
- `librustc_trans` contains the code to convert from Rust IR into LLVM
39+
IR, and then from LLVM IR into machine code, as well as the main
40+
driver that orchestrates all the other passes and various other bits
41+
of miscellany. In general it contains code that runs towards the
42+
end of the compilation process.
43+
44+
- `librustc_driver` invokes the compiler from `libsyntax`, then the
45+
analysis phases from `librustc`, and finally the lowering and
46+
codegen passes from `librustc_trans`.
47+
48+
Roughly speaking the "order" of the three crates is as follows:
49+
50+
libsyntax -> librustc -> librustc_trans
51+
| |
52+
+-----------------+-------------------+
53+
|
54+
librustc_driver
55+
56+
57+
Modules in the rustc crate
58+
==========================
59+
60+
The rustc crate itself consists of the following submodules
61+
(mostly, but not entirely, in their own directories):
62+
63+
- session: options and data that pertain to the compilation session as
64+
a whole
65+
- middle: middle-end: name resolution, typechecking, LLVM code
66+
generation
67+
- metadata: encoder and decoder for data required by separate
68+
compilation
69+
- plugin: infrastructure for compiler plugins
70+
- lint: infrastructure for compiler warnings
71+
- util: ubiquitous types and helper functions
72+
- lib: bindings to LLVM
73+
74+
The entry-point for the compiler is main() in the librustc_trans
75+
crate.
76+
77+
The 3 central data structures:
78+
------------------------------
79+
80+
1. `./../libsyntax/ast.rs` defines the AST. The AST is treated as
81+
immutable after parsing, but it depends on mutable context data
82+
structures (mainly hash maps) to give it meaning.
83+
84+
- Many – though not all – nodes within this data structure are
85+
wrapped in the type `spanned<T>`, meaning that the front-end has
86+
marked the input coordinates of that node. The member `node` is
87+
the data itself, the member `span` is the input location (file,
88+
line, column; both low and high).
89+
90+
- Many other nodes within this data structure carry a
91+
`def_id`. These nodes represent the 'target' of some name
92+
reference elsewhere in the tree. When the AST is resolved, by
93+
`middle/resolve.rs`, all names wind up acquiring a def that they
94+
point to. So anything that can be pointed-to by a name winds
95+
up with a `def_id`.
96+
97+
2. `middle/ty.rs` defines the datatype `sty`. This is the type that
98+
represents types after they have been resolved and normalized by
99+
the middle-end. The typeck phase converts every ast type to a
100+
`ty::sty`, and the latter is used to drive later phases of
101+
compilation. Most variants in the `ast::ty` tag have a
102+
corresponding variant in the `ty::sty` tag.
103+
104+
3. `./../librustc_llvm/lib.rs` defines the exported types
105+
`ValueRef`, `TypeRef`, `BasicBlockRef`, and several others.
106+
Each of these is an opaque pointer to an LLVM type,
107+
manipulated through the `lib::llvm` interface.
108+
109+
110+
Control and information flow within the compiler:
111+
-------------------------------------------------
112+
113+
- main() in lib.rs assumes control on startup. Options are
114+
parsed, platform is detected, etc.
115+
116+
- `./../libsyntax/parse/parser.rs` parses the input files and produces
117+
an AST that represents the input crate.
118+
119+
- Multiple middle-end passes (`middle/resolve.rs`, `middle/typeck.rs`)
120+
analyze the semantics of the resulting AST. Each pass generates new
121+
information about the AST and stores it in various environment data
122+
structures. The driver passes environments to each compiler pass
123+
that needs to refer to them.
124+
125+
- Finally, the `trans` module in `librustc_trans` translates the Rust
126+
AST to LLVM bitcode in a type-directed way. When it's finished
127+
synthesizing LLVM values, rustc asks LLVM to write them out in some
128+
form (`.bc`, `.o`) and possibly run the system linker.

0 commit comments

Comments
 (0)