Skip to content

Commit f1392a8

Browse files
author
James Miller
committed
---
yaml --- r: 73647 b: refs/heads/dist-snap c: 6e075b6 h: refs/heads/master i: 73645: a52cdcf 73643: ed2dc61 73639: 9e189c6 73631: bba81cc v: v3
1 parent fa46c05 commit f1392a8

23 files changed

+1048
-554
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 42466949c24c07e6d5e13a87054d066a72ea0d99
10+
refs/heads/dist-snap: 6e075b6bb6c15e8fa358e08670687e3c94f4565b
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/back/passes.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ pub fn create_standard_passes(level:OptLevel) -> ~[~str] {
7070

7171
passes.push(~"targetlibinfo");
7272

73-
passes.push(~"tbaa");
73+
passes.push(~"scev-aa");
7474
passes.push(~"basicaa");
7575

76+
passes.push(~"instcombine");
77+
passes.push(~"simplifycfg");
78+
passes.push(~"scalarrepl-ssa");
7679
passes.push(~"early-cse");
7780

7881
passes.push(~"globalopt");
@@ -83,10 +86,6 @@ pub fn create_standard_passes(level:OptLevel) -> ~[~str] {
8386

8487
passes.push(~"prune-eh");
8588

86-
if level == Aggressive {
87-
passes.push(~"mergefunc");
88-
}
89-
9089
passes.push(~"inline");
9190

9291
passes.push(~"functionattrs");
@@ -95,6 +94,7 @@ pub fn create_standard_passes(level:OptLevel) -> ~[~str] {
9594
passes.push(~"argpromotion");
9695
}
9796

97+
passes.push(~"scalarrepl-ssa");
9898
passes.push(~"early-cse");
9999
passes.push(~"simplify-libcalls");
100100
passes.push(~"jump-threading");
@@ -134,11 +134,6 @@ pub fn create_standard_passes(level:OptLevel) -> ~[~str] {
134134
passes.push(~"correlated-propagation");
135135
passes.push(~"dse");
136136

137-
passes.push(~"instcombine");
138-
passes.push(~"early-cse");
139-
140-
passes.push(~"loop-unroll");
141-
142137
passes.push(~"adce");
143138
passes.push(~"simplifycfg");
144139
passes.push(~"instsimplify");

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 30 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -374,90 +374,50 @@ fn encode_path(ecx: @EncodeContext,
374374
fn encode_reexported_static_method(ecx: @EncodeContext,
375375
ebml_w: &mut writer::Encoder,
376376
exp: &middle::resolve::Export2,
377-
method_def_id: def_id,
378-
method_ident: ident) {
379-
debug!("(encode reexported static method) %s::%s",
380-
*exp.name, *ecx.tcx.sess.str_of(method_ident));
377+
m: @ty::Method) {
378+
debug!("(encode static trait method) reexport '%s::%s'",
379+
*exp.name, *ecx.tcx.sess.str_of(m.ident));
381380
ebml_w.start_tag(tag_items_data_item_reexport);
382381
ebml_w.start_tag(tag_items_data_item_reexport_def_id);
383-
ebml_w.wr_str(def_to_str(method_def_id));
382+
ebml_w.wr_str(def_to_str(m.def_id));
384383
ebml_w.end_tag();
385384
ebml_w.start_tag(tag_items_data_item_reexport_name);
386-
ebml_w.wr_str(*exp.name + "::" + *ecx.tcx.sess.str_of(method_ident));
385+
ebml_w.wr_str(*exp.name + "::" + *ecx.tcx.sess.str_of(m.ident));
387386
ebml_w.end_tag();
388387
ebml_w.end_tag();
389388
}
390389

391-
fn encode_reexported_static_base_methods(ecx: @EncodeContext,
392-
ebml_w: &mut writer::Encoder,
393-
exp: &middle::resolve::Export2)
394-
-> bool {
395-
match ecx.tcx.base_impls.find(&exp.def_id) {
396-
Some(implementations) => {
397-
for implementations.each |&base_impl| {
398-
for base_impl.methods.each |&m| {
399-
if m.explicit_self == ast::sty_static {
400-
encode_reexported_static_method(ecx, ebml_w, exp,
401-
m.did, m.ident);
402-
}
403-
}
404-
}
405-
406-
true
407-
}
408-
None => { false }
409-
}
410-
}
411-
412-
fn encode_reexported_static_trait_methods(ecx: @EncodeContext,
413-
ebml_w: &mut writer::Encoder,
414-
exp: &middle::resolve::Export2)
415-
-> bool {
416-
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
417-
Some(methods) => {
418-
for methods.each |&m| {
419-
if m.explicit_self == ast::sty_static {
420-
encode_reexported_static_method(ecx, ebml_w, exp,
421-
m.def_id, m.ident);
422-
}
423-
}
424-
425-
true
426-
}
427-
None => { false }
428-
}
429-
}
430-
431390
fn encode_reexported_static_methods(ecx: @EncodeContext,
432391
ebml_w: &mut writer::Encoder,
433392
mod_path: &[ast_map::path_elt],
434393
exp: &middle::resolve::Export2) {
435-
match ecx.tcx.items.find(&exp.def_id.node) {
436-
Some(&ast_map::node_item(item, path)) => {
437-
let original_name = ecx.tcx.sess.str_of(item.ident);
438-
439-
//
440-
// We don't need to reexport static methods on items
441-
// declared in the same module as our `pub use ...` since
442-
// that's done when we encode the item itself.
443-
//
444-
// The only exception is when the reexport *changes* the
445-
// name e.g. `pub use Foo = self::Bar` -- we have
446-
// encoded metadata for static methods relative to Bar,
447-
// but not yet for Foo.
448-
//
449-
if mod_path != *path || *exp.name != *original_name {
450-
if !encode_reexported_static_base_methods(ecx, ebml_w, exp) {
451-
if encode_reexported_static_trait_methods(ecx, ebml_w, exp) {
452-
debug!(fmt!("(encode reexported static methods) %s \
453-
[trait]",
454-
*original_name));
394+
match ecx.tcx.trait_methods_cache.find(&exp.def_id) {
395+
Some(methods) => {
396+
match ecx.tcx.items.find(&exp.def_id.node) {
397+
Some(&ast_map::node_item(item, path)) => {
398+
let original_name = ecx.tcx.sess.str_of(item.ident);
399+
400+
//
401+
// We don't need to reexport static methods on traits
402+
// declared in the same module as our `pub use ...` since
403+
// that's done when we encode the trait item.
404+
//
405+
// The only exception is when the reexport *changes* the
406+
// name e.g. `pub use Foo = self::Bar` -- we have
407+
// encoded metadata for static methods relative to Bar,
408+
// but not yet for Foo.
409+
//
410+
if mod_path != *path || *exp.name != *original_name {
411+
for methods.each |&m| {
412+
if m.explicit_self == ast::sty_static {
413+
encode_reexported_static_method(ecx,
414+
ebml_w,
415+
exp, m);
416+
}
417+
}
455418
}
456419
}
457-
else {
458-
debug!(fmt!("(encode reexported static methods) %s [base]",
459-
*original_name));
460-
}
420+
_ => {}
461421
}
462422
}
463423
_ => {}

branches/dist-snap/src/librustc/middle/lint.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ pub enum lint {
9696
unnecessary_allocation,
9797

9898
missing_doc,
99-
unreachable_code,
10099
}
101100

102101
pub fn level_to_str(lv: level) -> &'static str {
@@ -274,13 +273,6 @@ static lint_table: &'static [(&'static str, LintSpec)] = &[
274273
desc: "detects missing documentation for public members",
275274
default: allow
276275
}),
277-
278-
("unreachable_code",
279-
LintSpec {
280-
lint: unreachable_code,
281-
desc: "detects unreachable code",
282-
default: warn
283-
}),
284276
];
285277

286278
/*

branches/dist-snap/src/librustc/middle/ty.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,6 @@ struct ctxt_ {
306306
// Maps a trait onto a mapping from self-ty to impl
307307
trait_impls: @mut HashMap<ast::def_id, @mut HashMap<t, @Impl>>,
308308

309-
// Maps a base type to its impl
310-
base_impls: @mut HashMap<ast::def_id, @mut ~[@Impl]>,
311-
312309
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
313310
// present in this set can be warned about.
314311
used_unsafe: @mut HashSet<ast::node_id>,
@@ -974,7 +971,6 @@ pub fn mk_ctxt(s: session::Session,
974971
destructor_for_type: @mut HashMap::new(),
975972
destructors: @mut HashSet::new(),
976973
trait_impls: @mut HashMap::new(),
977-
base_impls: @mut HashMap::new(),
978974
used_unsafe: @mut HashSet::new(),
979975
used_mut_nodes: @mut HashSet::new(),
980976
}
@@ -3703,21 +3699,6 @@ pub fn trait_method(cx: ctxt, trait_did: ast::def_id, idx: uint) -> @Method {
37033699
ty::method(cx, method_def_id)
37043700
}
37053701

3706-
3707-
pub fn add_base_impl(cx: ctxt, base_def_id: def_id, implementation: @Impl) {
3708-
let implementations;
3709-
match cx.base_impls.find(&base_def_id) {
3710-
None => {
3711-
implementations = @mut ~[];
3712-
cx.base_impls.insert(base_def_id, implementations);
3713-
}
3714-
Some(&existing) => {
3715-
implementations = existing;
3716-
}
3717-
}
3718-
implementations.push(implementation);
3719-
}
3720-
37213702
pub fn trait_methods(cx: ctxt, trait_did: ast::def_id) -> @~[@Method] {
37223703
match cx.trait_methods_cache.find(&trait_did) {
37233704
Some(&methods) => methods,

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ use core::prelude::*;
8181
use middle::const_eval;
8282
use middle::pat_util::pat_id_map;
8383
use middle::pat_util;
84-
use middle::lint::unreachable_code;
8584
use middle::ty::{FnSig, VariantInfo_};
8685
use middle::ty::{ty_param_bounds_and_ty, ty_param_substs_and_ty};
8786
use middle::ty::{substs, param_ty};
@@ -2938,8 +2937,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
29382937
let mut any_err = false;
29392938
for blk.node.stmts.each |s| {
29402939
check_stmt(fcx, *s);
2941-
let s_id = ast_util::stmt_id(*s);
2942-
let s_ty = fcx.node_ty(s_id);
2940+
let s_ty = fcx.node_ty(ast_util::stmt_id(*s));
29432941
if last_was_bot && !warned && match s.node {
29442942
ast::stmt_decl(@codemap::spanned { node: ast::decl_local(_),
29452943
_}, _) |
@@ -2948,8 +2946,7 @@ pub fn check_block_with_expected(fcx: @mut FnCtxt,
29482946
}
29492947
_ => false
29502948
} {
2951-
fcx.ccx.tcx.sess.add_lint(unreachable_code, s_id, s.span,
2952-
~"unreachable statement");
2949+
fcx.ccx.tcx.sess.span_warn(s.span, "unreachable statement");
29532950
warned = true;
29542951
}
29552952
if ty::type_is_bot(s_ty) {

branches/dist-snap/src/librustc/middle/typeck/coherence.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ pub fn get_base_type_def_id(inference_context: @mut InferCtxt,
146146
}
147147
_ => {
148148
fail!("get_base_type() returned a type that wasn't an \
149-
enum, struct, or trait");
149+
enum, class, or trait");
150150
}
151151
}
152152
}
@@ -312,7 +312,6 @@ pub impl CoherenceChecker {
312312
implementation = existing_implementation;
313313
}
314314
}
315-
316315
self.add_inherent_method(base_type_def_id,
317316
implementation);
318317
}
@@ -433,8 +432,6 @@ pub impl CoherenceChecker {
433432
}
434433

435434
implementation_list.push(implementation);
436-
437-
ty::add_base_impl(self.crate_context.tcx, base_def_id, implementation);
438435
}
439436

440437
fn add_trait_method(&self, trait_id: def_id, implementation: @Impl) {

branches/dist-snap/src/libstd/hashmap.rs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,11 @@ pub fn linear_map_with_capacity<K:Eq + Hash,V>(
7272
fn linear_map_with_capacity_and_keys<K:Eq + Hash,V>(
7373
k0: u64, k1: u64,
7474
initial_capacity: uint) -> HashMap<K, V> {
75-
let cap = uint::max(INITIAL_CAPACITY, initial_capacity);
7675
HashMap {
7776
k0: k0, k1: k1,
78-
resize_at: resize_at(cap),
77+
resize_at: resize_at(initial_capacity),
7978
size: 0,
80-
buckets: vec::from_fn(cap, |_| None)
79+
buckets: vec::from_fn(initial_capacity, |_| None)
8180
}
8281
}
8382

@@ -481,8 +480,7 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
481480
}
482481

483482
fn consume(&mut self, f: &fn(K, V)) {
484-
let buckets = replace(&mut self.buckets,
485-
vec::from_fn(INITIAL_CAPACITY, |_| None));
483+
let buckets = replace(&mut self.buckets, ~[]);
486484
self.size = 0;
487485

488486
do vec::consume(buckets) |_, bucket| {
@@ -666,12 +664,6 @@ mod test_map {
666664
use super::*;
667665
use uint;
668666

669-
#[test]
670-
fn test_create_capacity_zero() {
671-
let mut m = HashMap::with_capacity(0);
672-
assert!(m.insert(1, 1));
673-
}
674-
675667
#[test]
676668
fn test_insert() {
677669
let mut m = HashMap::new();
@@ -779,14 +771,6 @@ mod test_map {
779771
assert_eq!(m2.get(&2), &3);
780772
}
781773

782-
#[test]
783-
fn test_consume_still_usable() {
784-
let mut m = HashMap::new();
785-
assert!(m.insert(1, 2));
786-
do m.consume |_, _| {}
787-
assert!(m.insert(1, 2));
788-
}
789-
790774
#[test]
791775
fn test_iterate() {
792776
let mut m = linear_map_with_capacity(4);

branches/dist-snap/src/libstd/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub use path::PosixPath;
4545
pub use path::WindowsPath;
4646
pub use ptr::Ptr;
4747
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr};
48-
pub use str::{StrSlice, OwnedStr, StrUtil};
48+
pub use str::{StrSlice, OwnedStr};
4949
pub use from_str::{FromStr};
5050
pub use to_bytes::IterBytes;
5151
pub use to_str::{ToStr, ToStrConsume};

0 commit comments

Comments
 (0)