Skip to content

Commit 3b129c6

Browse files
committed
---
yaml --- r: 83850 b: refs/heads/try c: b703061 h: refs/heads/master v: v3
1 parent 7bc72f7 commit 3b129c6

Some content is hidden

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

59 files changed

+1506
-2136
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: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 2e1df8e35bb0185dc35f5e7976c0b46608c32404
5+
refs/heads/try: b70306158ff41706e08c691596087502ba40f635
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rustpkg.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ and builds it in any workspace(s) where it finds one.
137137
Supposing such packages are found in workspaces X, Y, and Z,
138138
the command leaves behind files in `X`'s, `Y`'s, and `Z`'s `build` directories,
139139
but not in their `lib` or `bin` directories.
140-
(The exception is when rustpkg fetches a package `foo`'s sources from a remote repository.
141-
In that case, it stores both the sources *and* the build artifacts for `foo`
142-
in the workspace that `foo` will install to (see ##install below)).
143140

144141
## clean
145142

@@ -151,11 +148,7 @@ in the workspace that `foo` will install to (see ##install below)).
151148
If `RUST_PATH` is declared as an environment variable, then rustpkg installs the
152149
libraries and executables into the `lib` and `bin` subdirectories
153150
of the first entry in `RUST_PATH`.
154-
Otherwise, if the current working directory CWD is a workspace,
155-
it installs them into CWD's `lib` and `bin` subdirectories.
156-
Otherwise, if the current working directory is CWD,
157-
it installs them into the .rust/lib and .rust/bin subdirectories of CWD
158-
(creating them if necessary).
151+
Otherwise, it installs them into `foo`'s `lib` and `bin` directories.
159152

160153
## test
161154

branches/try/doc/tutorial-ffi.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ the true length after compression for setting the length.
135135
~~~~ {.xfail-test}
136136
pub fn compress(src: &[u8]) -> ~[u8] {
137137
#[fixed_stack_segment]; #[inline(never)];
138-
138+
139139
unsafe {
140140
let srclen = src.len() as size_t;
141141
let psrc = vec::raw::to_ptr(src);
@@ -157,7 +157,7 @@ format and `snappy_uncompressed_length` will retrieve the exact buffer size requ
157157
~~~~ {.xfail-test}
158158
pub fn uncompress(src: &[u8]) -> Option<~[u8]> {
159159
#[fixed_stack_segment]; #[inline(never)];
160-
160+
161161
unsafe {
162162
let srclen = src.len() as size_t;
163163
let psrc = vec::raw::to_ptr(src);
@@ -236,7 +236,7 @@ use std::libc::size_t;
236236
unsafe fn snappy_max_compressed_length(source_length: size_t) -> size_t {
237237
#[fixed_stack_segment]; #[inline(never)];
238238
return snappy_max_compressed_length(source_length);
239-
239+
240240
#[link_args = "-lsnappy"]
241241
extern {
242242
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
@@ -259,9 +259,9 @@ check that one of the following conditions holds:
259259
2. The call occurs inside of an `extern fn`;
260260
3. The call occurs within a stack closure created by some other
261261
safe fn.
262-
262+
263263
All of these conditions ensure that you are running on a large stack
264-
segment. However, they are sometimes too strict. If your application
264+
segmented. However, they are sometimes too strict. If your application
265265
will be making many calls into C, it is often beneficial to promote
266266
the `#[fixed_stack_segment]` attribute higher up the call chain. For
267267
example, the Rust compiler actually labels main itself as requiring a
@@ -298,7 +298,7 @@ impl<T: Send> Unique<T> {
298298
pub fn new(value: T) -> Unique<T> {
299299
#[fixed_stack_segment];
300300
#[inline(never)];
301-
301+
302302
unsafe {
303303
let ptr = malloc(std::sys::size_of::<T>() as size_t) as *mut T;
304304
assert!(!ptr::is_null(ptr));
@@ -324,7 +324,7 @@ impl<T: Send> Drop for Unique<T> {
324324
fn drop(&mut self) {
325325
#[fixed_stack_segment];
326326
#[inline(never)];
327-
327+
328328
unsafe {
329329
let x = intrinsics::init(); // dummy value to swap in
330330
// moving the object out is needed to call the destructor

branches/try/src/compiletest/errors.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,24 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
use std::io;
12+
1113
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
1214

1315
// Load any test directives embedded in the file
1416
pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
15-
use std::rt::io::Open;
16-
use std::rt::io::file::FileInfo;
17-
use std::rt::io::buffered::BufferedReader;
18-
1917
let mut error_patterns = ~[];
20-
let mut rdr = BufferedReader::new(testfile.open_reader(Open).unwrap());
18+
let rdr = io::file_reader(testfile).unwrap();
2119
let mut line_num = 1u;
22-
loop {
23-
let ln = match rdr.read_line() {
24-
Some(ln) => ln, None => break,
25-
};
20+
while !rdr.eof() {
21+
let ln = rdr.read_line();
2622
error_patterns.push_all_move(parse_expected(line_num, ln));
2723
line_num += 1u;
2824
}
2925
return error_patterns;
3026
}
3127

3228
fn parse_expected(line_num: uint, line: ~str) -> ~[ExpectedError] {
33-
let line = line.trim();
3429
let error_tag = ~"//~";
3530
let mut idx;
3631
match line.find_str(error_tag) {

branches/try/src/compiletest/header.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ use common::config;
1212
use common;
1313
use util;
1414

15+
use std::io;
16+
1517
pub struct TestProps {
1618
// Lines that should be expected, in order, on standard out
1719
error_patterns: ~[~str],
@@ -102,23 +104,17 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
102104
!val
103105
}
104106

105-
fn iter_header(testfile: &Path, it: &fn(&str) -> bool) -> bool {
106-
use std::rt::io::Open;
107-
use std::rt::io::file::FileInfo;
108-
use std::rt::io::buffered::BufferedReader;
109-
110-
let mut rdr = BufferedReader::new(testfile.open_reader(Open).unwrap());
111-
loop {
112-
let ln = match rdr.read_line() {
113-
Some(ln) => ln, None => break
114-
};
107+
fn iter_header(testfile: &Path, it: &fn(~str) -> bool) -> bool {
108+
let rdr = io::file_reader(testfile).unwrap();
109+
while !rdr.eof() {
110+
let ln = rdr.read_line();
115111

116112
// Assume that any directives will be found before the first
117113
// module or function. This doesn't seem to be an optimization
118114
// with a warm page cache. Maybe with a cold one.
119115
if ln.starts_with("fn") || ln.starts_with("mod") {
120116
return true;
121-
} else { if !(it(ln.trim())) { return false; } }
117+
} else { if !(it(ln)) { return false; } }
122118
}
123119
return true;
124120
}

branches/try/src/compiletest/procsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub fn run(lib_path: &str,
5757
});
5858

5959
for input in input.iter() {
60-
proc.input().write(input.as_bytes());
60+
proc.input().write_str(*input);
6161
}
6262
let output = proc.finish_with_output();
6363

branches/try/src/librustc/driver/driver.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,9 @@ pub fn phase_3_run_analysis_passes(sess: Session,
263263
method_map, ty_cx));
264264

265265
let maps = (external_exports, last_private_map);
266-
let exported_items =
267-
time(time_passes, "privacy checking", maps, |(a, b)|
268-
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2,
269-
a, b, crate));
266+
time(time_passes, "privacy checking", maps, |(a, b)|
267+
middle::privacy::check_crate(ty_cx, &method_map, &exp_map2,
268+
a, b, crate));
270269

271270
time(time_passes, "effect checking", (), |_|
272271
middle::effect::check_crate(ty_cx, method_map, crate));
@@ -301,8 +300,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
301300

302301
let reachable_map =
303302
time(time_passes, "reachability checking", (), |_|
304-
reachable::find_reachable(ty_cx, method_map, exp_map2,
305-
&exported_items));
303+
reachable::find_reachable(ty_cx, method_map, crate));
306304

307305
time(time_passes, "lint checking", (), |_|
308306
lint::check_crate(ty_cx, crate));

branches/try/src/librustc/front/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ fn fold_foreign_mod(cx: &Context, nm: &ast::foreign_mod) -> ast::foreign_mod {
102102
}
103103
}.collect();
104104
ast::foreign_mod {
105-
sort: nm.sort,
106105
abis: nm.abis,
107106
view_items: filtered_view_items,
108107
items: filtered_items

branches/try/src/librustc/metadata/creader.rs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -175,40 +175,43 @@ fn visit_item(e: &Env, i: @ast::item) {
175175
}
176176

177177
let cstore = e.cstore;
178-
let mut already_added = false;
179178
let link_args = i.attrs.iter()
180179
.filter_map(|at| if "link_args" == at.name() {Some(at)} else {None})
181180
.collect::<~[&ast::Attribute]>();
182181

183-
match fm.sort {
184-
ast::named => {
185-
let link_name = i.attrs.iter()
186-
.find(|at| "link_name" == at.name())
187-
.and_then(|at| at.value_str());
188-
189-
let foreign_name = match link_name {
190-
Some(nn) => {
191-
if nn.is_empty() {
192-
e.diag.span_fatal(
193-
i.span,
194-
"empty #[link_name] not allowed; use \
195-
#[nolink].");
196-
}
197-
nn
198-
}
199-
None => token::ident_to_str(&i.ident)
200-
};
201-
if !attr::contains_name(i.attrs, "nolink") {
202-
already_added =
203-
!cstore::add_used_library(cstore, foreign_name);
204-
}
205-
if !link_args.is_empty() && already_added {
206-
e.diag.span_fatal(i.span, ~"library '" + foreign_name +
207-
"' already added: can't specify link_args.");
208-
}
209-
}
210-
ast::anonymous => { /* do nothing */ }
211-
}
182+
// XXX: two whom it may concern, this was the old logic applied to the
183+
// ast's extern mod blocks which had names (we used to allow
184+
// "extern mod foo"). This code was never run for anonymous blocks,
185+
// and we now only have anonymous blocks. We're still in the midst
186+
// of figuring out what the exact operations we'd like to support
187+
// when linking external modules, but I wanted to leave this logic
188+
// here for the time beging to refer back to it
189+
190+
//let mut already_added = false;
191+
//let link_name = i.attrs.iter()
192+
// .find(|at| "link_name" == at.name())
193+
// .and_then(|at| at.value_str());
194+
195+
//let foreign_name = match link_name {
196+
// Some(nn) => {
197+
// if nn.is_empty() {
198+
// e.diag.span_fatal(
199+
// i.span,
200+
// "empty #[link_name] not allowed; use \
201+
// #[nolink].");
202+
// }
203+
// nn
204+
// }
205+
// None => token::ident_to_str(&i.ident)
206+
// };
207+
//if !attr::contains_name(i.attrs, "nolink") {
208+
// already_added =
209+
// !cstore::add_used_library(cstore, foreign_name);
210+
//}
211+
//if !link_args.is_empty() && already_added {
212+
// e.diag.span_fatal(i.span, ~"library '" + foreign_name +
213+
// "' already added: can't specify link_args.");
214+
//}
212215

213216
for m in link_args.iter() {
214217
match m.value_str() {

branches/try/src/librustc/middle/privacy.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ use syntax::visit::Visitor;
3131

3232
type Context<'self> = (&'self method_map, &'self resolve::ExportMap2);
3333

34-
// A set of all nodes in the ast which can be considered "publicly exported" in
35-
// the sense that they are accessible from anywhere in any hierarchy.
36-
pub type ExportedItems = HashSet<ast::NodeId>;
37-
3834
// This visitor is used to determine the parent of all nodes in question when it
3935
// comes to privacy. This is used to determine later on if a usage is actually
4036
// valid or not.
@@ -141,7 +137,7 @@ impl<'self> Visitor<()> for ParentVisitor<'self> {
141137
// This visitor is used to determine which items of the ast are embargoed,
142138
// otherwise known as not exported.
143139
struct EmbargoVisitor<'self> {
144-
exported_items: &'self mut ExportedItems,
140+
exported_items: &'self mut HashSet<ast::NodeId>,
145141
exp_map2: &'self resolve::ExportMap2,
146142
path_all_public: bool,
147143
}
@@ -243,7 +239,7 @@ struct PrivacyVisitor<'self> {
243239
curitem: ast::NodeId,
244240

245241
// Results of previous analyses necessary for privacy checking.
246-
exported_items: &'self ExportedItems,
242+
exported_items: &'self HashSet<ast::NodeId>,
247243
method_map: &'self method_map,
248244
parents: &'self HashMap<ast::NodeId, ast::NodeId>,
249245
external_exports: resolve::ExternalExports,
@@ -789,7 +785,7 @@ pub fn check_crate(tcx: ty::ctxt,
789785
exp_map2: &resolve::ExportMap2,
790786
external_exports: resolve::ExternalExports,
791787
last_private_map: resolve::LastPrivateMap,
792-
crate: &ast::Crate) -> ExportedItems {
788+
crate: &ast::Crate) {
793789
let mut parents = HashMap::new();
794790
let mut exported_items = HashSet::new();
795791

@@ -806,7 +802,7 @@ pub fn check_crate(tcx: ty::ctxt,
806802
{
807803
// Initialize the exported items with resolve's id for the "root crate"
808804
// to resolve references to `super` leading to the root and such.
809-
exported_items.insert(ast::CRATE_NODE_ID);
805+
exported_items.insert(0);
810806
let mut visitor = EmbargoVisitor {
811807
exported_items: &mut exported_items,
812808
exp_map2: exp_map2,
@@ -828,5 +824,4 @@ pub fn check_crate(tcx: ty::ctxt,
828824
};
829825
visit::walk_crate(&mut visitor, crate, ());
830826
}
831-
return exported_items;
832827
}

0 commit comments

Comments
 (0)