Skip to content

Commit 53d8309

Browse files
committed
---
yaml --- r: 147325 b: refs/heads/try2 c: c335734 h: refs/heads/master i: 147323: f1bee89 v: v3
1 parent 2417050 commit 53d8309

Some content is hidden

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

51 files changed

+474
-781
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: 6876916a45f14973897dd05fe4dfdd2b47ac9607
8+
refs/heads/try2: c33573440b61acf154a1cee55413d02f9835c9aa
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/foo#1.0"; // a full package ID for rustpkg
793+
extern mod foo = "some/where/rust-foo#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 ToBytesConsume
69+
syn keyword rustTrait Ascii AsciiCast OwnedAsciiCast AsciiStr IntoBytes
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 ToStrConsume
97+
syn keyword rustTrait ToStr IntoStr
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,8 @@ impl<'a> Iterator<uint> for BitvSetIterator<'a> {
932932
mod tests {
933933
use extra::test::BenchHarness;
934934

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

938939
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::*;
410+
use super::{BTree, LeafElt};
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-
struct Semaphore { priv sem: Sem<()> }
332+
pub struct Semaphore { priv sem: Sem<()> }
333333

334334

335335
impl Clone for Semaphore {

branches/try2/src/libextra/test.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ 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() {}
674673

675674
let test_a = TestDesc {
676675
name: StaticTestName("a"),
@@ -1296,8 +1295,6 @@ mod tests {
12961295
12971296
#[test]
12981297
pub fn filter_for_ignored_option() {
1299-
fn dummy() {}
1300-
13011298
// When we run ignored tests the test filter should filter out all the
13021299
// unignored tests and flip the ignore flag on the rest to false
13031300
@@ -1441,6 +1438,7 @@ mod tests {
14411438
assert_eq!(diff2.len(), 7);
14421439
}
14431440
1441+
#[test]
14441442
pub fn ratchet_test() {
14451443
14461444
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::*;
887+
use super::{TreeMap, TreeNode};
888888

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

branches/try2/src/libextra/uuid.rs

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

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

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -728,17 +728,10 @@ 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-
739731
let mut out_filenames = ~[];
740-
for output in outputs.move_iter() {
741-
let out_file = link_binary_output(sess, trans, output, obj_filename, out_filename, lm);
732+
for &output in sess.outputs.iter() {
733+
let out_file = link_binary_output(sess, trans, output, obj_filename,
734+
out_filename, lm);
742735
out_filenames.push(out_file);
743736
}
744737

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, &exported_items, crate));
315+
lint::check_crate(ty_cx, method_map, &exported_items, crate));
316316

317317
CrateAnalysis {
318318
exp_map2: exp_map2,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,20 +405,25 @@ 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 }
408409
for output in options.outputs.iter() {
409410
match *output {
410411
OutputExecutable => {}
411412
OutputStaticlib | OutputDylib | OutputRlib => return true
412413
}
413414
}
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+
}
422427
let mut base = options.outputs.clone();
423428
let mut iter = crate.attrs.iter().filter_map(|a| {
424429
if "crate_type" == a.name() {

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,10 @@ 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+
}
815819

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

12071211
match ms[i] {
1208-
required(_) => {
1212+
required(ref tm) => {
1213+
encode_attributes(ebml_w, tm.attrs);
12091214
encode_method_sort(ebml_w, 'r');
12101215
}
12111216

12121217
provided(m) => {
1218+
encode_attributes(ebml_w, m.attrs);
12131219
// If this is a static method, we've already encoded
12141220
// this.
12151221
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!("second borrow of `{}` as mutable occurs here",
241+
format!("previous 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!("second borrow of `{}` occurs here",
256+
format!("previous borrow of `{}` occurs here",
257257
self.bccx.loan_path_to_str(new_loan.loan_path)));
258258
return false;
259259
}

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

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

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, _: ()) {
161+
fn visit_path(&mut self, path: &ast::Path, id: ast::NodeId, _: ()) {
171162
self.lookup_and_handle_definition(&id);
163+
visit::walk_path(self, path, ());
172164
}
173165

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

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

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

1212
use driver::session;
1313
use driver::session::Session;
14-
use syntax::abi;
1514
use syntax::ast::{Crate, NodeId, item, item_fn};
1615
use syntax::ast_map;
1716
use syntax::attr;
@@ -46,10 +45,7 @@ impl Visitor<()> for EntryContext {
4645
}
4746

4847
pub fn find_entry_point(session: Session, crate: &Crate, ast_map: ast_map::map) {
49-
50-
// FIXME #4404 android JNI hacks
51-
if *session.building_library &&
52-
session.targ_cfg.os != abi::OsAndroid {
48+
if *session.building_library {
5349
// No need to find a main function
5450
return;
5551
}
@@ -149,10 +145,6 @@ fn configure_main(this: &mut EntryContext) {
149145
}
150146
}
151147
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);
156148
}
157149
}
158150
}

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

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ 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;
4041
use middle::pat_util;
4142
use metadata::csearch;
4243
use util::ppaux::{ty_to_str};
@@ -359,6 +360,9 @@ struct Context<'a> {
359360
cur: SmallIntMap<(level, LintSource)>,
360361
// context we're checking in (used to access fields like sess)
361362
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,
362366
// Items exported by the crate; used by the missing_doc lint.
363367
exported_items: &'a privacy::ExportedItems,
364368
// The id of the current `ast::struct_def` being walked.
@@ -1176,20 +1180,43 @@ fn check_missing_doc_variant(cx: &Context, v: &ast::variant) {
11761180
/// Checks for use of items with #[deprecated], #[experimental] and
11771181
/// #[unstable] (or none of them) attributes.
11781182
fn check_stability(cx: &Context, e: &ast::Expr) {
1179-
let def = match e.node {
1180-
ast::ExprMethodCall(..) |
1181-
ast::ExprPath(..) |
1182-
ast::ExprStruct(..) => {
1183+
let id = match e.node {
1184+
ast::ExprPath(..) | ast::ExprStruct(..) => {
11831185
match cx.tcx.def_map.find(&e.id) {
1184-
Some(&def) => def,
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+
}
11851214
None => return
11861215
}
11871216
}
11881217
_ => return
11891218
};
11901219

1191-
let id = ast_util::def_id_of_def(def);
1192-
11931220
let stability = if ast_util::is_local(id) {
11941221
// this crate
11951222
match cx.tcx.items.find(&id.node) {
@@ -1208,7 +1235,8 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
12081235
None => return
12091236
}
12101237
}
1211-
_ => cx.tcx.sess.bug(format!("handle_def: {:?} not found", id))
1238+
_ => cx.tcx.sess.span_bug(e.span,
1239+
format!("handle_def: {:?} not found", id))
12121240
}
12131241
} else {
12141242
// cross-crate
@@ -1395,12 +1423,14 @@ impl<'a> IdVisitingOperation for Context<'a> {
13951423
}
13961424

13971425
pub fn check_crate(tcx: ty::ctxt,
1426+
method_map: typeck::method_map,
13981427
exported_items: &privacy::ExportedItems,
13991428
crate: &ast::Crate) {
14001429
let mut cx = Context {
14011430
dict: @get_lint_dict(),
14021431
cur: SmallIntMap::new(),
14031432
tcx: tcx,
1433+
method_map: method_map,
14041434
exported_items: exported_items,
14051435
cur_struct_def_id: -1,
14061436
is_doc_hidden: false,

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,11 +1258,16 @@ 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+
12611266
name_bindings.define_module(parent_link,
12621267
Some(def_id),
12631268
ImplModuleKind,
12641269
false,
1265-
true,
1270+
is_public,
12661271
sp);
12671272

12681273
ModuleReducedGraphParent(

0 commit comments

Comments
 (0)