Skip to content

Commit 2417050

Browse files
committed
---
yaml --- r: 147324 b: refs/heads/try2 c: 6876916 h: refs/heads/master v: v3
1 parent f1bee89 commit 2417050

Some content is hidden

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

54 files changed

+822
-495
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 5cea7db2a5f009ac9e192b0c6195b02496bee140
8+
refs/heads/try2: 6876916a45f14973897dd05fe4dfdd2b47ac9607
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ extern mod extra; // equivalent to: extern mod extra = "extra";
790790
791791
extern mod rustextra = "extra"; // linking to 'extra' under another name
792792
793-
extern mod foo = "some/where/rust-foo#foo:1.0"; // a full package ID for rustpkg
793+
extern mod foo = "some/where/foo#1.0"; // a full package ID for rustpkg
794794
~~~~
795795

796796
##### Use declarations

branches/try2/src/etc/vim/syntax/rust.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ syn keyword rustEnumVariant Ok Err
6666

6767
" Types and traits {{{3
6868
syn keyword rustTrait Any AnyOwnExt AnyRefExt AnyMutRefExt
69-
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
69+
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr ToBytesConsume
7070
syn keyword rustTrait Bool
7171
syn keyword rustTrait ToCStr
7272
syn keyword rustTrait Char
@@ -94,7 +94,7 @@ syn keyword rustTrait Buffer Writer Reader Seek
9494
syn keyword rustTrait SendStr SendStrOwned SendStrStatic IntoSendStr
9595
syn keyword rustTrait Str StrVector StrSlice OwnedStr
9696
syn keyword rustTrait IterBytes
97-
syn keyword rustTrait ToStr IntoStr
97+
syn keyword rustTrait ToStr ToStrConsume
9898
syn keyword rustTrait CopyableTuple ImmutableTuple
9999
syn keyword rustTrait Tuple1 Tuple2 Tuple3 Tuple4
100100
syn keyword rustTrait Tuple5 Tuple6 Tuple7 Tuple8

branches/try2/src/libextra/bitv.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,7 @@ impl<'a> Iterator<uint> for BitvSetIterator<'a> {
932932
mod tests {
933933
use extra::test::BenchHarness;
934934

935-
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
936-
from_bytes};
935+
use bitv::*;
937936
use bitv;
938937

939938
use std::uint;

branches/try2/src/libextra/btree.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ impl<K: Clone + TotalOrd, V: Clone> Clone for BranchElt<K, V> {
407407
#[cfg(test)]
408408
mod test_btree{
409409

410-
use super::{BTree, LeafElt};
410+
use super::*;
411411

412412
///Tests the functionality of the add methods (which are unfinished).
413413
#[test]

branches/try2/src/libextra/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ impl Sem<~[WaitQueue]> {
329329
****************************************************************************/
330330

331331
/// A counting, blocking, bounded-waiting semaphore.
332-
pub struct Semaphore { priv sem: Sem<()> }
332+
struct Semaphore { priv sem: Sem<()> }
333333

334334

335335
impl Clone for Semaphore {

branches/try2/src/libextra/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ fn should_sort_failures_before_printing_them() {
670670
use std::io::Decorator;
671671
use std::io::mem::MemWriter;
672672
use std::str;
673+
fn dummy() {}
673674

674675
let test_a = TestDesc {
675676
name: StaticTestName("a"),
@@ -1295,6 +1296,8 @@ mod tests {
12951296
12961297
#[test]
12971298
pub fn filter_for_ignored_option() {
1299+
fn dummy() {}
1300+
12981301
// When we run ignored tests the test filter should filter out all the
12991302
// unignored tests and flip the ignore flag on the rest to false
13001303
@@ -1438,7 +1441,6 @@ mod tests {
14381441
assert_eq!(diff2.len(), 7);
14391442
}
14401443
1441-
#[test]
14421444
pub fn ratchet_test() {
14431445
14441446
let dpth = TempDir::new("test-ratchet").expect("missing test for ratchet");

branches/try2/src/libextra/treemap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ impl<T: TotalOrd> Extendable<T> for TreeSet<T> {
884884
#[cfg(test)]
885885
mod test_treemap {
886886

887-
use super::{TreeMap, TreeNode};
887+
use super::*;
888888

889889
use std::rand::Rng;
890890
use std::rand;

branches/try2/src/libextra/uuid.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ impl Uuid {
219219
}
220220

221221
let mut uuid = Uuid{ bytes: [0, .. 16] };
222-
vec::bytes::copy_memory(uuid.bytes, b);
222+
unsafe {
223+
vec::raw::copy_memory(uuid.bytes, b);
224+
}
223225
Some(uuid)
224226
}
225227

branches/try2/src/librustc/back/link.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,10 +728,17 @@ pub fn link_binary(sess: Session,
728728
obj_filename: &Path,
729729
out_filename: &Path,
730730
lm: &LinkMeta) -> ~[Path] {
731+
// If we're generating a test executable, then ignore all other output
732+
// styles at all other locations
733+
let outputs = if sess.opts.test {
734+
~[session::OutputExecutable]
735+
} else {
736+
(*sess.outputs).clone()
737+
};
738+
731739
let mut out_filenames = ~[];
732-
for &output in sess.outputs.iter() {
733-
let out_file = link_binary_output(sess, trans, output, obj_filename,
734-
out_filename, lm);
740+
for output in outputs.move_iter() {
741+
let out_file = link_binary_output(sess, trans, output, obj_filename, out_filename, lm);
735742
out_filenames.push(out_file);
736743
}
737744

branches/try2/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ pub fn phase_3_run_analysis_passes(sess: Session,
312312
&exported_items, reachable_map, crate));
313313

314314
time(time_passes, "lint checking", (), |_|
315-
lint::check_crate(ty_cx, method_map, &exported_items, crate));
315+
lint::check_crate(ty_cx, &exported_items, crate));
316316

317317
CrateAnalysis {
318318
exp_map2: exp_map2,

branches/try2/src/librustc/driver/session.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,25 +405,20 @@ pub fn expect<T:Clone>(sess: Session, opt: Option<T>, msg: || -> ~str) -> T {
405405
}
406406

407407
pub fn building_library(options: &options, crate: &ast::Crate) -> bool {
408-
if options.test { return false }
409408
for output in options.outputs.iter() {
410409
match *output {
411410
OutputExecutable => {}
412411
OutputStaticlib | OutputDylib | OutputRlib => return true
413412
}
414413
}
414+
if options.test { return false }
415415
match syntax::attr::first_attr_value_str_by_name(crate.attrs, "crate_type") {
416416
Some(s) => "lib" == s || "rlib" == s || "dylib" == s || "staticlib" == s,
417417
_ => false
418418
}
419419
}
420420

421421
pub fn collect_outputs(options: &options, crate: &ast::Crate) -> ~[OutputStyle] {
422-
// If we're generating a test executable, then ignore all other output
423-
// styles at all other locations
424-
if options.test {
425-
return ~[OutputExecutable];
426-
}
427422
let mut base = options.outputs.clone();
428423
let mut iter = crate.attrs.iter().filter_map(|a| {
429424
if "crate_type" == a.name() {

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,6 @@ fn encode_info_for_method(ecx: &EncodeContext,
812812
encode_bounds_and_type(ebml_w, ecx, &tpt);
813813

814814
encode_path(ecx, ebml_w, impl_path, ast_map::path_name(m.ident));
815-
match ast_method_opt {
816-
Some(ast_method) => encode_attributes(ebml_w, ast_method.attrs),
817-
None => ()
818-
}
819815

820816
for ast_method in ast_method_opt.iter() {
821817
let num_params = tpt.generics.type_param_defs.len();
@@ -1209,13 +1205,11 @@ fn encode_info_for_item(ecx: &EncodeContext,
12091205
}
12101206

12111207
match ms[i] {
1212-
required(ref tm) => {
1213-
encode_attributes(ebml_w, tm.attrs);
1208+
required(_) => {
12141209
encode_method_sort(ebml_w, 'r');
12151210
}
12161211

12171212
provided(m) => {
1218-
encode_attributes(ebml_w, m.attrs);
12191213
// If this is a static method, we've already encoded
12201214
// this.
12211215
if method_ty.explicit_self != sty_static {

branches/try2/src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ impl<'a> CheckLoanCtxt<'a> {
238238
self.bccx.loan_path_to_str(new_loan.loan_path)));
239239
self.bccx.span_note(
240240
old_loan.span,
241-
format!("previous borrow of `{}` as mutable occurs here",
241+
format!("second borrow of `{}` as mutable occurs here",
242242
self.bccx.loan_path_to_str(new_loan.loan_path)));
243243
return false;
244244
}
@@ -253,7 +253,7 @@ impl<'a> CheckLoanCtxt<'a> {
253253
self.bccx.mut_to_str(old_loan.mutbl)));
254254
self.bccx.span_note(
255255
old_loan.span,
256-
format!("previous borrow of `{}` occurs here",
256+
format!("second borrow of `{}` occurs here",
257257
self.bccx.loan_path_to_str(new_loan.loan_path)));
258258
return false;
259259
}

branches/try2/src/librustc/middle/check_loop.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ impl Visitor<Context> for CheckLoopVisitor {
4747
}
4848
ast::ExprBreak(_) => self.require_loop("break", cx, e.span),
4949
ast::ExprAgain(_) => self.require_loop("continue", cx, e.span),
50-
ast::ExprRet(oe) => {
51-
if cx == Closure {
52-
self.tcx.sess.span_err(e.span, "`return` in a closure");
53-
}
54-
visit::walk_expr_opt(self, oe, cx);
55-
}
5650
_ => visit::walk_expr(self, e, cx)
5751
}
5852
}

branches/try2/src/librustc/middle/dead.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,17 @@ impl Visitor<()> for MarkSymbolVisitor {
158158
visit::walk_expr(self, expr, ())
159159
}
160160

161-
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId, _: ()) {
161+
fn visit_ty(&mut self, typ: &ast::Ty, _: ()) {
162+
match typ.node {
163+
ast::ty_path(_, _, ref id) => {
164+
self.lookup_and_handle_definition(id);
165+
}
166+
_ => visit::walk_ty(self, typ, ()),
167+
}
168+
}
169+
170+
fn visit_path(&mut self, _: &ast::Path, id: ast::NodeId, _: ()) {
162171
self.lookup_and_handle_definition(&id);
163-
visit::walk_path(self, path, ());
164172
}
165173

166174
fn visit_item(&mut self, _item: @ast::item, _: ()) {

branches/try2/src/librustc/middle/entry.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
use driver::session;
1313
use driver::session::Session;
14+
use syntax::abi;
1415
use syntax::ast::{Crate, NodeId, item, item_fn};
1516
use syntax::ast_map;
1617
use syntax::attr;
@@ -45,7 +46,10 @@ impl Visitor<()> for EntryContext {
4546
}
4647

4748
pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) {
48-
if *session.building_library {
49+
50+
// FIXME #4404 android JNI hacks
51+
if *session.building_library &&
52+
session.targ_cfg.os != abi::OsAndroid {
4953
// No need to find a main function
5054
return;
5155
}
@@ -145,6 +149,10 @@ fn configure_main(this: &mut EntryContext) {
145149
}
146150
}
147151
this.session.abort_if_errors();
152+
} else {
153+
// If we *are* building a library, then we're on android where we still might
154+
// optionally want to translate main $4404
155+
assert_eq!(this.session.targ_cfg.os, abi::OsAndroid);
148156
}
149157
}
150158
}

branches/try2/src/librustc/middle/lint.rs

Lines changed: 8 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ use driver::session;
3737
use middle::privacy;
3838
use middle::trans::adt; // for `adt::is_ffi_safe`
3939
use middle::ty;
40-
use middle::typeck;
4140
use middle::pat_util;
4241
use metadata::csearch;
4342
use util::ppaux::{ty_to_str};
@@ -360,9 +359,6 @@ struct Context<'a> {
360359
cur: SmallIntMap<(level, LintSource)>,
361360
// context we're checking in (used to access fields like sess)
362361
tcx: ty::ctxt,
363-
// maps from an expression id that corresponds to a method call to the
364-
// details of the method to be invoked
365-
method_map: typeck::method_map,
366362
// Items exported by the crate; used by the missing_doc lint.
367363
exported_items: &'a privacy::ExportedItems,
368364
// The id of the current `ast::struct_def` being walked.
@@ -1180,43 +1176,20 @@ fn check_missing_doc_variant(cx: &Context, v: &ast::variant) {
11801176
/// Checks for use of items with #[deprecated], #[experimental] and
11811177
/// #[unstable] (or none of them) attributes.
11821178
fn check_stability(cx: &Context, e: &ast::Expr) {
1183-
let id = match e.node {
1184-
ast::ExprPath(..) | ast::ExprStruct(..) => {
1179+
let def = match e.node {
1180+
ast::ExprMethodCall(..) |
1181+
ast::ExprPath(..) |
1182+
ast::ExprStruct(..) => {
11851183
match cx.tcx.def_map.find(&e.id) {
1186-
Some(&def) => ast_util::def_id_of_def(def),
1187-
None => return
1188-
}
1189-
}
1190-
ast::ExprMethodCall(..) => {
1191-
match cx.method_map.find(&e.id) {
1192-
Some(&typeck::method_map_entry { origin, .. }) => {
1193-
match origin {
1194-
typeck::method_static(def_id) => {
1195-
// If this implements a trait method, get def_id
1196-
// of the method inside trait definition.
1197-
// Otherwise, use the current def_id (which refers
1198-
// to the method inside impl).
1199-
ty::trait_method_of_method(
1200-
cx.tcx, def_id).unwrap_or(def_id)
1201-
}
1202-
typeck::method_param(typeck::method_param {
1203-
trait_id: trait_id,
1204-
method_num: index,
1205-
..
1206-
})
1207-
| typeck::method_object(typeck::method_object {
1208-
trait_id: trait_id,
1209-
method_num: index,
1210-
..
1211-
}) => ty::trait_method(cx.tcx, trait_id, index).def_id
1212-
}
1213-
}
1184+
Some(&def) => def,
12141185
None => return
12151186
}
12161187
}
12171188
_ => return
12181189
};
12191190

1191+
let id = ast_util::def_id_of_def(def);
1192+
12201193
let stability = if ast_util::is_local(id) {
12211194
// this crate
12221195
match cx.tcx.items.find(&id.node) {
@@ -1235,8 +1208,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
12351208
None => return
12361209
}
12371210
}
1238-
_ => cx.tcx.sess.span_bug(e.span,
1239-
format!("handle_def: {:?} not found", id))
1211+
_ => cx.tcx.sess.bug(format!("handle_def: {:?} not found", id))
12401212
}
12411213
} else {
12421214
// cross-crate
@@ -1423,14 +1395,12 @@ impl<'a> IdVisitingOperation for Context<'a> {
14231395
}
14241396

14251397
pub fn check_crate(tcx: ty::ctxt,
1426-
method_map: typeck::method_map,
14271398
exported_items: &privacy::ExportedItems,
14281399
crate: &ast::Crate) {
14291400
let mut cx = Context {
14301401
dict: @get_lint_dict(),
14311402
cur: SmallIntMap::new(),
14321403
tcx: tcx,
1433-
method_map: method_map,
14341404
exported_items: exported_items,
14351405
cur_struct_def_id: -1,
14361406
is_doc_hidden: false,

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,16 +1258,11 @@ impl Resolver {
12581258
let parent_link =
12591259
self.get_parent_link(new_parent, ident);
12601260
let def_id = local_def(item.id);
1261-
let ns = TypeNS;
1262-
let is_public =
1263-
!name_bindings.defined_in_namespace(ns) ||
1264-
name_bindings.defined_in_public_namespace(ns);
1265-
12661261
name_bindings.define_module(parent_link,
12671262
Some(def_id),
12681263
ImplModuleKind,
12691264
false,
1270-
is_public,
1265+
true,
12711266
sp);
12721267

12731268
ModuleReducedGraphParent(

0 commit comments

Comments
 (0)