Skip to content

Commit b7f0a0a

Browse files
committed
---
yaml --- r: 108388 b: refs/heads/dist-snap c: 37bf97a h: refs/heads/master v: v3
1 parent 920f25c commit b7f0a0a

File tree

21 files changed

+206
-225
lines changed

21 files changed

+206
-225
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 5736deb90e8f4c15a09c8dec5e1f3467b805fe70
9+
refs/heads/dist-snap: 37bf97a0f9cc764a19dfcff21d62384b2445dcbc
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/enum_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl<E:CLike> Iterator<E> for Items<E> {
129129
}
130130

131131
fn size_hint(&self) -> (uint, Option<uint>) {
132-
let exact = self.bits.count_ones();
132+
let exact = self.bits.population_count();
133133
(exact, Some(exact))
134134
}
135135
}

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

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use syntax::ast;
2424
use syntax::abi;
2525
use syntax::attr;
2626
use syntax::attr::AttrMetaMethods;
27-
use syntax::codemap::{Span, DUMMY_SP};
27+
use syntax::codemap::{Span};
2828
use syntax::diagnostic::SpanHandler;
2929
use syntax::ext::base::{CrateLoader, MacroCrate};
3030
use syntax::parse::token::{IdentInterner, InternedString};
@@ -147,6 +147,7 @@ fn visit_view_item(e: &mut Env, i: &ast::ViewItem) {
147147
match extract_crate_info(i) {
148148
Some(info) => {
149149
let cnum = resolve_crate(e,
150+
None,
150151
info.ident.clone(),
151152
info.name.clone(),
152153
info.version.clone(),
@@ -299,6 +300,7 @@ fn existing_match(e: &Env, name: &str, version: &str, hash: &str) -> Option<ast:
299300
}
300301

301302
fn resolve_crate(e: &mut Env,
303+
root_ident: Option<~str>,
302304
ident: ~str,
303305
name: ~str,
304306
version: ~str,
@@ -319,7 +321,7 @@ fn resolve_crate(e: &mut Env,
319321
};
320322
let loader::Library {
321323
dylib, rlib, metadata
322-
} = load_ctxt.load_library_crate();
324+
} = load_ctxt.load_library_crate(root_ident.clone());
323325

324326
let attrs = decoder::get_crate_attributes(metadata.as_slice());
325327
let crateid = attr::find_crateid(attrs).unwrap();
@@ -338,8 +340,17 @@ fn resolve_crate(e: &mut Env,
338340
}
339341
e.next_crate_num += 1;
340342

343+
// Maintain a reference to the top most crate.
344+
let root_crate = match root_ident {
345+
Some(c) => c,
346+
None => load_ctxt.ident.clone()
347+
};
348+
341349
// Now resolve the crates referenced by this crate
342-
let cnum_map = resolve_crate_deps(e, metadata.as_slice());
350+
let cnum_map = resolve_crate_deps(e,
351+
Some(root_crate),
352+
metadata.as_slice(),
353+
span);
343354

344355
let cmeta = @cstore::crate_metadata {
345356
name: load_ctxt.name,
@@ -364,7 +375,10 @@ fn resolve_crate(e: &mut Env,
364375
}
365376

366377
// Go through the crate metadata and load any crates that it references
367-
fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
378+
fn resolve_crate_deps(e: &mut Env,
379+
root_ident: Option<~str>,
380+
cdata: &[u8], span : Span)
381+
-> cstore::cnum_map {
368382
debug!("resolving deps of external crate");
369383
// The map from crate numbers in the crate we're resolving to local crate
370384
// numbers
@@ -387,15 +401,13 @@ fn resolve_crate_deps(e: &mut Env, cdata: &[u8]) -> cstore::cnum_map {
387401
None => {
388402
debug!("need to load it");
389403
// This is a new one so we've got to load it
390-
// FIXME (#2404): Need better error reporting than just a bogus
391-
// span.
392-
let fake_span = DUMMY_SP;
393404
let local_cnum = resolve_crate(e,
405+
root_ident.clone(),
394406
cname_str.get().to_str(),
395407
cname_str.get().to_str(),
396408
dep.vers.clone(),
397409
dep.hash.clone(),
398-
fake_span);
410+
span);
399411
cnum_map.insert(extrn_cnum, local_cnum);
400412
}
401413
}
@@ -427,6 +439,7 @@ impl CrateLoader for Loader {
427439
fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate {
428440
let info = extract_crate_info(krate).unwrap();
429441
let cnum = resolve_crate(&mut self.env,
442+
None,
430443
info.ident.clone(),
431444
info.name.clone(),
432445
info.version.clone(),

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@ pub struct ArchiveMetadata {
6565
}
6666

6767
impl Context {
68-
pub fn load_library_crate(&self) -> Library {
68+
pub fn load_library_crate(&self, root_ident: Option<~str>) -> Library {
6969
match self.find_library_crate() {
7070
Some(t) => t,
7171
None => {
72-
self.sess.span_fatal(self.span,
73-
format!("can't find crate for `{}`",
74-
self.ident));
72+
let message = match root_ident {
73+
None => format!("can't find crate for `{}`", self.ident),
74+
Some(c) => format!("can't find crate for `{}` which `{}` depends on",
75+
self.ident,
76+
c)
77+
};
78+
self.sess.span_fatal(self.span, message);
7579
}
7680
}
7781
}

branches/dist-snap/src/librustc/middle/trans/adt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ fn generic_type_of(cx: &CrateContext, r: &Repr, name: Option<&str>, sizing: bool
432432
4 => Type::array(&Type::i32(), align_units),
433433
8 if machine::llalign_of_min(cx, Type::i64()) == 8 =>
434434
Type::array(&Type::i64(), align_units),
435-
a if a.count_ones() == 1 => Type::array(&Type::vector(&Type::i32(), a / 4),
435+
a if a.population_count() == 1 => Type::array(&Type::vector(&Type::i32(), a / 4),
436436
align_units),
437437
_ => fail!("unsupported enum alignment: {:?}", align)
438438
};

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

Lines changed: 94 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -552,126 +552,110 @@ pub fn ensure_no_ty_param_bounds(ccx: &CrateCtxt,
552552
}
553553
}
554554

555-
fn ensure_generics_abi(ccx: &CrateCtxt,
556-
span: Span,
557-
abis: AbiSet,
558-
generics: &ast::Generics) {
559-
if generics.ty_params.len() > 0 &&
560-
!(abis.is_rust() || abis.is_intrinsic()) {
561-
ccx.tcx.sess.span_err(span,
562-
"foreign functions may not use type parameters");
563-
}
564-
}
565-
566555
pub fn convert(ccx: &CrateCtxt, it: &ast::Item) {
567556
let tcx = ccx.tcx;
568557
debug!("convert: item {} with id {}", token::get_ident(it.ident), it.id);
569558
match it.node {
570-
// These don't define types.
571-
ast::ItemForeignMod(_) | ast::ItemMod(_) | ast::ItemMac(_) => {}
572-
ast::ItemEnum(ref enum_definition, ref generics) => {
573-
ensure_no_ty_param_bounds(ccx, it.span, generics, "enumeration");
574-
let tpt = ty_of_item(ccx, it);
575-
write_ty_to_tcx(tcx, it.id, tpt.ty);
576-
get_enum_variant_types(ccx,
577-
tpt.ty,
578-
enum_definition.variants,
579-
generics);
580-
},
581-
ast::ItemImpl(ref generics, ref opt_trait_ref, selfty, ref ms) => {
582-
let i_ty_generics = ty_generics(ccx, generics, 0);
583-
let selfty = ccx.to_ty(&ExplicitRscope, selfty);
584-
write_ty_to_tcx(tcx, it.id, selfty);
559+
// These don't define types.
560+
ast::ItemForeignMod(_) | ast::ItemMod(_) | ast::ItemMac(_) => {}
561+
ast::ItemEnum(ref enum_definition, ref generics) => {
562+
ensure_no_ty_param_bounds(ccx, it.span, generics, "enumeration");
563+
let tpt = ty_of_item(ccx, it);
564+
write_ty_to_tcx(tcx, it.id, tpt.ty);
565+
get_enum_variant_types(ccx,
566+
tpt.ty,
567+
enum_definition.variants,
568+
generics);
569+
}
570+
ast::ItemImpl(ref generics, ref opt_trait_ref, selfty, ref ms) => {
571+
let i_ty_generics = ty_generics(ccx, generics, 0);
572+
let selfty = ccx.to_ty(&ExplicitRscope, selfty);
573+
write_ty_to_tcx(tcx, it.id, selfty);
585574

586-
{
587-
let mut tcache = tcx.tcache.borrow_mut();
588-
tcache.get().insert(local_def(it.id),
589-
ty_param_bounds_and_ty {
590-
generics: i_ty_generics.clone(),
591-
ty: selfty});
592-
}
575+
{
576+
let mut tcache = tcx.tcache.borrow_mut();
577+
tcache.get().insert(local_def(it.id),
578+
ty_param_bounds_and_ty {
579+
generics: i_ty_generics.clone(),
580+
ty: selfty});
581+
}
593582

594-
// If there is a trait reference, treat the methods as always public.
595-
// This is to work around some incorrect behavior in privacy checking:
596-
// when the method belongs to a trait, it should acquire the privacy
597-
// from the trait, not the impl. Forcing the visibility to be public
598-
// makes things sorta work.
599-
let parent_visibility = if opt_trait_ref.is_some() {
600-
ast::Public
601-
} else {
602-
it.vis
603-
};
583+
// If there is a trait reference, treat the methods as always public.
584+
// This is to work around some incorrect behavior in privacy checking:
585+
// when the method belongs to a trait, it should acquire the privacy
586+
// from the trait, not the impl. Forcing the visibility to be public
587+
// makes things sorta work.
588+
let parent_visibility = if opt_trait_ref.is_some() {
589+
ast::Public
590+
} else {
591+
it.vis
592+
};
604593

605-
convert_methods(ccx,
606-
ImplContainer(local_def(it.id)),
607-
*ms,
608-
selfty,
609-
&i_ty_generics,
610-
generics,
611-
parent_visibility);
612-
613-
for trait_ref in opt_trait_ref.iter() {
614-
let trait_ref = instantiate_trait_ref(ccx, trait_ref, selfty);
615-
616-
// Prevent the builtin kind traits from being manually implemented.
617-
if tcx.lang_items.to_builtin_kind(trait_ref.def_id).is_some() {
618-
tcx.sess.span_err(it.span,
619-
"cannot provide an explicit implementation \
620-
for a builtin kind");
621-
}
594+
convert_methods(ccx,
595+
ImplContainer(local_def(it.id)),
596+
*ms,
597+
selfty,
598+
&i_ty_generics,
599+
generics,
600+
parent_visibility);
601+
602+
for trait_ref in opt_trait_ref.iter() {
603+
let trait_ref = instantiate_trait_ref(ccx, trait_ref, selfty);
604+
605+
// Prevent the builtin kind traits from being manually implemented.
606+
if tcx.lang_items.to_builtin_kind(trait_ref.def_id).is_some() {
607+
tcx.sess.span_err(it.span,
608+
"cannot provide an explicit implementation \
609+
for a builtin kind");
622610
}
623-
},
624-
ast::ItemTrait(ref generics, _, ref trait_methods) => {
625-
let trait_def = trait_def_of_item(ccx, it);
626-
627-
// Run convert_methods on the provided methods.
628-
let (_, provided_methods) =
629-
split_trait_methods(*trait_methods);
630-
let untransformed_rcvr_ty = ty::mk_self(tcx, local_def(it.id));
631-
convert_methods(ccx,
632-
TraitContainer(local_def(it.id)),
633-
provided_methods,
634-
untransformed_rcvr_ty,
635-
&trait_def.generics,
636-
generics,
637-
it.vis);
638-
639-
// We need to do this *after* converting methods, since
640-
// convert_methods produces a tcache entry that is wrong for
641-
// static trait methods. This is somewhat unfortunate.
642-
ensure_trait_methods(ccx, it.id);
643-
},
644-
ast::ItemStruct(struct_def, ref generics) => {
645-
ensure_no_ty_param_bounds(ccx, it.span, generics, "structure");
646-
647-
// Write the class type
648-
let tpt = ty_of_item(ccx, it);
649-
write_ty_to_tcx(tcx, it.id, tpt.ty);
611+
}
612+
}
613+
ast::ItemTrait(ref generics, _, ref trait_methods) => {
614+
let trait_def = trait_def_of_item(ccx, it);
615+
616+
// Run convert_methods on the provided methods.
617+
let (_, provided_methods) =
618+
split_trait_methods(*trait_methods);
619+
let untransformed_rcvr_ty = ty::mk_self(tcx, local_def(it.id));
620+
convert_methods(ccx,
621+
TraitContainer(local_def(it.id)),
622+
provided_methods,
623+
untransformed_rcvr_ty,
624+
&trait_def.generics,
625+
generics,
626+
it.vis);
627+
628+
// We need to do this *after* converting methods, since
629+
// convert_methods produces a tcache entry that is wrong for
630+
// static trait methods. This is somewhat unfortunate.
631+
ensure_trait_methods(ccx, it.id);
632+
}
633+
ast::ItemStruct(struct_def, ref generics) => {
634+
ensure_no_ty_param_bounds(ccx, it.span, generics, "structure");
635+
636+
// Write the class type
637+
let tpt = ty_of_item(ccx, it);
638+
write_ty_to_tcx(tcx, it.id, tpt.ty);
650639

651-
{
652-
let mut tcache = tcx.tcache.borrow_mut();
653-
tcache.get().insert(local_def(it.id), tpt.clone());
654-
}
640+
{
641+
let mut tcache = tcx.tcache.borrow_mut();
642+
tcache.get().insert(local_def(it.id), tpt.clone());
643+
}
655644

656-
convert_struct(ccx, struct_def, tpt, it.id);
657-
},
658-
ast::ItemTy(_, ref generics) => {
659-
ensure_no_ty_param_bounds(ccx, it.span, generics, "type");
660-
let tpt = ty_of_item(ccx, it);
661-
write_ty_to_tcx(tcx, it.id, tpt.ty);
662-
},
663-
ast::ItemFn(_, _, abi, ref generics, _) => {
664-
ensure_generics_abi(ccx, it.span, abi, generics);
665-
let tpt = ty_of_item(ccx, it);
666-
write_ty_to_tcx(tcx, it.id, tpt.ty);
667-
},
668-
_ => {
669-
// This call populates the type cache with the converted type
670-
// of the item in passing. All we have to do here is to write
671-
// it into the node type table.
672-
let tpt = ty_of_item(ccx, it);
673-
write_ty_to_tcx(tcx, it.id, tpt.ty);
674-
},
645+
convert_struct(ccx, struct_def, tpt, it.id);
646+
}
647+
ast::ItemTy(_, ref generics) => {
648+
ensure_no_ty_param_bounds(ccx, it.span, generics, "type");
649+
let tpt = ty_of_item(ccx, it);
650+
write_ty_to_tcx(tcx, it.id, tpt.ty);
651+
}
652+
_ => {
653+
// This call populates the type cache with the converted type
654+
// of the item in passing. All we have to do here is to write
655+
// it into the node type table.
656+
let tpt = ty_of_item(ccx, it);
657+
write_ty_to_tcx(tcx, it.id, tpt.ty);
658+
}
675659
}
676660
}
677661

branches/dist-snap/src/libstd/comm/shared.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ impl<T: Send> Packet<T> {
305305
// See the discussion in the stream implementation for why we we
306306
// might decrement steals.
307307
Some(data) => {
308+
self.steals += 1;
308309
if self.steals > MAX_STEALS {
309310
match self.cnt.swap(0, atomics::SeqCst) {
310311
DISCONNECTED => {
@@ -313,12 +314,11 @@ impl<T: Send> Packet<T> {
313314
n => {
314315
let m = cmp::min(n, self.steals);
315316
self.steals -= m;
316-
self.bump(n - m);
317+
self.cnt.fetch_add(n - m, atomics::SeqCst);
317318
}
318319
}
319320
assert!(self.steals >= 0);
320321
}
321-
self.steals += 1;
322322
Ok(data)
323323
}
324324

0 commit comments

Comments
 (0)