Skip to content

Commit b3cf888

Browse files
committed
---
yaml --- r: 153338 b: refs/heads/try2 c: 1e40115 h: refs/heads/master v: v3
1 parent ff9799e commit b3cf888

File tree

23 files changed

+470
-312
lines changed

23 files changed

+470
-312
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: 0487e6387b8cd7a0fc4077f7534d0ea410662b8b
8+
refs/heads/try2: 1e401159c17c473132e81c039c995a38b933bbf9
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/install.mk

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,18 @@ else
1414
MAYBE_DISABLE_VERIFY=
1515
endif
1616

17-
install: dist-install-dir-$(CFG_BUILD)-with-target-libs
18-
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
17+
install: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
18+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
1919
# Remove tmp files while we can because they may have been created under sudo
2020
$(Q)rm -R tmp/dist
2121

22-
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs
23-
$(Q)sh tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
22+
uninstall: dist-install-dir-$(CFG_BUILD)-with-target-libs | tmp/empty_dir
23+
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
2424
# Remove tmp files while we can because they may have been created under sudo
2525
$(Q)rm -R tmp/dist
2626

27+
tmp/empty_dir:
28+
mkdir -p $@
2729

2830
######################################################################
2931
# Android remote installation

branches/try2/src/libcollections/hash/sip.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pub fn hash_with_keys<T: Hash<SipState>>(k0: u64, k1: u64, value: &T) -> u64 {
269269
mod tests {
270270
use test::Bencher;
271271
use std::prelude::*;
272-
use std::num::ToStrRadix;
272+
use std::fmt;
273273

274274
use str::Str;
275275
use string::String;
@@ -370,7 +370,7 @@ mod tests {
370370
fn to_hex_str(r: &[u8, ..8]) -> String {
371371
let mut s = String::new();
372372
for b in r.iter() {
373-
s.push_str((*b as uint).to_str_radix(16u).as_slice());
373+
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
374374
}
375375
s
376376
}
@@ -391,7 +391,7 @@ mod tests {
391391
let r = result_bytes(h);
392392
let mut s = String::new();
393393
for b in r.iter() {
394-
s.push_str((*b as uint).to_str_radix(16u).as_slice());
394+
s.push_str(format!("{}", fmt::radix(*b, 16)).as_slice());
395395
}
396396
s
397397
}

branches/try2/src/libcore/atomics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl AtomicBool {
141141
///
142142
/// fn with_lock(spinlock: &Arc<AtomicBool>, f: || -> ()) {
143143
/// // CAS loop until we are able to replace `false` with `true`
144-
/// while spinlock.compare_and_swap(false, true, SeqCst) == false {
144+
/// while spinlock.compare_and_swap(false, true, SeqCst) != false {
145145
/// // Since tasks may not be preemptive (if they are green threads)
146146
/// // yield to the scheduler to let the other task run. Low level
147147
/// // concurrent code needs to take into account Rust's two threading

branches/try2/src/libgreen/lib.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,18 @@
164164
//! possibly pinned to a particular scheduler thread:
165165
//!
166166
//! ```rust
167+
//! extern crate green;
168+
//! extern crate rustuv;
169+
//!
170+
//! # fn main() {
167171
//! use std::task::TaskBuilder;
168172
//! use green::{SchedPool, PoolConfig, GreenTaskBuilder};
169173
//!
170-
//! let config = PoolConfig::new();
174+
//! let mut config = PoolConfig::new();
175+
//!
176+
//! // Optional: Set the event loop to be rustuv's to allow I/O to work
177+
//! config.event_loop_factory = rustuv::event_loop;
178+
//!
171179
//! let mut pool = SchedPool::new(config);
172180
//!
173181
//! // Spawn tasks into the pool of schedulers
@@ -195,6 +203,7 @@
195203
//! // Required to shut down this scheduler pool.
196204
//! // The task will fail if `shutdown` is not called.
197205
//! pool.shutdown();
206+
//! # }
198207
//! ```
199208
200209
#![crate_name = "green"]

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl<'a> PluginMetadataReader<'a> {
446446
should_match_name: true,
447447
};
448448
let library = match load_ctxt.maybe_load_library_crate() {
449-
Some (l) => l,
449+
Some(l) => l,
450450
None if is_cross => {
451451
// try loading from target crates (only valid if there are
452452
// no syntax extensions)
@@ -473,6 +473,14 @@ impl<'a> PluginMetadataReader<'a> {
473473
let registrar = decoder::get_plugin_registrar_fn(library.metadata.as_slice()).map(|id| {
474474
decoder::get_symbol(library.metadata.as_slice(), id)
475475
});
476+
if library.dylib.is_none() && registrar.is_some() {
477+
let message = format!("plugin crate `{}` only found in rlib format, \
478+
but must be available in dylib format",
479+
info.ident);
480+
self.env.sess.span_err(krate.span, message.as_slice());
481+
// No need to abort because the loading code will just ignore this
482+
// empty dylib.
483+
}
476484
let pc = PluginMetadata {
477485
lib: library.dylib.clone(),
478486
macros: macros,

branches/try2/src/libstd/lib.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,3 @@ mod std {
286286
// The test runner requires std::slice::Vector, so re-export std::slice just for it.
287287
#[cfg(test)] pub use slice;
288288
}
289-
290-
#[deprecated]
291-
#[allow(missing_doc)]
292-
#[doc(hiden)]
293-
pub mod unstable {
294-
#[deprecated = "use std::dynamic_lib"]
295-
pub use dynamic_lib;
296-
}

branches/try2/src/libsyntax/ext/deriving/clone.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self,
4141
attributes: attrs,
42-
const_nonmatching: false,
4342
combine_substructure: combine_substructure(|c, s, sub| {
4443
cs_clone("Clone", c, s, sub)
4544
}),
@@ -69,7 +68,7 @@ fn cs_clone(
6968
ctor_ident = variant.node.name;
7069
all_fields = af;
7170
},
72-
EnumNonMatching(..) => {
71+
EnumNonMatchingCollapsed (..) => {
7372
cx.span_bug(trait_span,
7473
format!("non-matching enum variants in \
7574
`deriving({})`",

branches/try2/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
4545
args: vec!(borrowed_self()),
4646
ret_ty: Literal(Path::new(vec!("bool"))),
4747
attributes: attrs,
48-
const_nonmatching: true,
4948
combine_substructure: combine_substructure(|a, b, c| {
5049
$f(a, b, c)
5150
})

branches/try2/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
3535
args: vec!(borrowed_self()),
3636
ret_ty: Literal(Path::new(vec!("bool"))),
3737
attributes: attrs,
38-
const_nonmatching: false,
3938
combine_substructure: combine_substructure(|cx, span, substr| {
4039
cs_op($op, $equal, cx, span, substr)
4140
})
@@ -59,7 +58,6 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
5958
args: vec![borrowed_self()],
6059
ret_ty: ret_ty,
6160
attributes: attrs,
62-
const_nonmatching: false,
6361
combine_substructure: combine_substructure(|cx, span, substr| {
6462
cs_partial_cmp(cx, span, substr)
6563
})
@@ -82,24 +80,33 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
8280
trait_def.expand(cx, mitem, item, push)
8381
}
8482

85-
pub fn some_ordering_const(cx: &mut ExtCtxt, span: Span, cnst: Ordering) -> Gc<ast::Expr> {
86-
let cnst = match cnst {
87-
Less => "Less",
88-
Equal => "Equal",
89-
Greater => "Greater"
83+
pub enum OrderingOp {
84+
PartialCmpOp, LtOp, LeOp, GtOp, GeOp,
85+
}
86+
87+
pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
88+
span: Span,
89+
op: OrderingOp,
90+
self_arg_tags: &[ast::Ident]) -> Gc<ast::Expr> {
91+
let lft = cx.expr_ident(span, self_arg_tags[0]);
92+
let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1]));
93+
let op_str = match op {
94+
PartialCmpOp => "partial_cmp",
95+
LtOp => "lt", LeOp => "le",
96+
GtOp => "gt", GeOp => "ge",
9097
};
91-
let ordering = cx.path_global(span,
92-
vec!(cx.ident_of("std"),
93-
cx.ident_of("cmp"),
94-
cx.ident_of(cnst)));
95-
let ordering = cx.expr_path(ordering);
96-
cx.expr_some(span, ordering)
98+
cx.expr_method_call(span, lft, cx.ident_of(op_str), vec![rgt])
9799
}
98100

99101
pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
100102
substr: &Substructure) -> Gc<Expr> {
101103
let test_id = cx.ident_of("__test");
102-
let equals_expr = some_ordering_const(cx, span, Equal);
104+
let ordering = cx.path_global(span,
105+
vec!(cx.ident_of("std"),
106+
cx.ident_of("cmp"),
107+
cx.ident_of("Equal")));
108+
let ordering = cx.expr_path(ordering);
109+
let equals_expr = cx.expr_some(span, ordering);
103110

104111
/*
105112
Builds:
@@ -141,13 +148,11 @@ pub fn cs_partial_cmp(cx: &mut ExtCtxt, span: Span,
141148
cx.expr_block(cx.block(span, vec!(assign), Some(if_)))
142149
},
143150
equals_expr.clone(),
144-
|cx, span, list, _| {
145-
match list {
146-
// an earlier nonmatching variant is Less than a
147-
// later one.
148-
[(self_var, _, _), (other_var, _, _)] =>
149-
some_ordering_const(cx, span, self_var.cmp(&other_var)),
150-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
151+
|cx, span, (self_args, tag_tuple), _non_self_args| {
152+
if self_args.len() != 2 {
153+
cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
154+
} else {
155+
some_ordering_collapsed(cx, span, PartialCmpOp, tag_tuple)
151156
}
152157
},
153158
cx, span, substr)
@@ -191,19 +196,15 @@ fn cs_op(less: bool, equal: bool, cx: &mut ExtCtxt, span: Span,
191196
cx.expr_binary(span, ast::BiOr, cmp, and)
192197
},
193198
cx.expr_bool(span, equal),
194-
|cx, span, args, _| {
195-
// nonmatching enums, order by the order the variants are
196-
// written
197-
match args {
198-
[(self_var, _, _),
199-
(other_var, _, _)] =>
200-
cx.expr_bool(span,
201-
if less {
202-
self_var < other_var
203-
} else {
204-
self_var > other_var
205-
}),
206-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
199+
|cx, span, (self_args, tag_tuple), _non_self_args| {
200+
if self_args.len() != 2 {
201+
cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
202+
} else {
203+
let op = match (less, equal) {
204+
(true, true) => LeOp, (true, false) => LtOp,
205+
(false, true) => GeOp, (false, false) => GtOp,
206+
};
207+
some_ordering_collapsed(cx, span, op, tag_tuple)
207208
}
208209
},
209210
cx, span, substr)

branches/try2/src/libsyntax/ext/deriving/cmp/totaleq.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub fn expand_deriving_totaleq(cx: &mut ExtCtxt,
5757
args: vec!(),
5858
ret_ty: nil_ty(),
5959
attributes: attrs,
60-
const_nonmatching: true,
6160
combine_substructure: combine_substructure(|a, b, c| {
6261
cs_total_eq_assert(a, b, c)
6362
})

branches/try2/src/libsyntax/ext/deriving/cmp/totalord.rs

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use ext::deriving::generic::*;
1717
use ext::deriving::generic::ty::*;
1818
use parse::token::InternedString;
1919

20-
use std::cmp::{Ordering, Equal, Less, Greater};
2120
use std::gc::Gc;
2221

2322
pub fn expand_deriving_totalord(cx: &mut ExtCtxt,
@@ -41,7 +40,6 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt,
4140
args: vec!(borrowed_self()),
4241
ret_ty: Literal(Path::new(vec!("std", "cmp", "Ordering"))),
4342
attributes: attrs,
44-
const_nonmatching: false,
4543
combine_substructure: combine_substructure(|a, b, c| {
4644
cs_cmp(a, b, c)
4745
}),
@@ -53,22 +51,21 @@ pub fn expand_deriving_totalord(cx: &mut ExtCtxt,
5351
}
5452

5553

56-
pub fn ordering_const(cx: &mut ExtCtxt, span: Span, cnst: Ordering) -> ast::Path {
57-
let cnst = match cnst {
58-
Less => "Less",
59-
Equal => "Equal",
60-
Greater => "Greater"
61-
};
62-
cx.path_global(span,
63-
vec!(cx.ident_of("std"),
64-
cx.ident_of("cmp"),
65-
cx.ident_of(cnst)))
54+
pub fn ordering_collapsed(cx: &mut ExtCtxt,
55+
span: Span,
56+
self_arg_tags: &[ast::Ident]) -> Gc<ast::Expr> {
57+
let lft = cx.expr_ident(span, self_arg_tags[0]);
58+
let rgt = cx.expr_addr_of(span, cx.expr_ident(span, self_arg_tags[1]));
59+
cx.expr_method_call(span, lft, cx.ident_of("cmp"), vec![rgt])
6660
}
6761

6862
pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
6963
substr: &Substructure) -> Gc<Expr> {
7064
let test_id = cx.ident_of("__test");
71-
let equals_path = ordering_const(cx, span, Equal);
65+
let equals_path = cx.path_global(span,
66+
vec!(cx.ident_of("std"),
67+
cx.ident_of("cmp"),
68+
cx.ident_of("Equal")));
7269

7370
/*
7471
Builds:
@@ -110,16 +107,11 @@ pub fn cs_cmp(cx: &mut ExtCtxt, span: Span,
110107
cx.expr_block(cx.block(span, vec!(assign), Some(if_)))
111108
},
112109
cx.expr_path(equals_path.clone()),
113-
|cx, span, list, _| {
114-
match list {
115-
// an earlier nonmatching variant is Less than a
116-
// later one.
117-
[(self_var, _, _),
118-
(other_var, _, _)] => {
119-
let order = ordering_const(cx, span, self_var.cmp(&other_var));
120-
cx.expr_path(order)
121-
}
122-
_ => cx.span_bug(span, "not exactly 2 arguments in `deriving(Ord)`")
110+
|cx, span, (self_args, tag_tuple), _non_self_args| {
111+
if self_args.len() != 2 {
112+
cx.span_bug(span, "not exactly 2 arguments in `deriving(TotalOrd)`")
113+
} else {
114+
ordering_collapsed(cx, span, tag_tuple)
123115
}
124116
},
125117
cx, span, substr)

branches/try2/src/libsyntax/ext/deriving/decodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ pub fn expand_deriving_decodable(cx: &mut ExtCtxt,
5454
vec!(box Self,
5555
box Literal(Path::new_local("__E"))), true)),
5656
attributes: Vec::new(),
57-
const_nonmatching: true,
5857
combine_substructure: combine_substructure(|a, b, c| {
5958
decodable_substructure(a, b, c)
6059
}),

branches/try2/src/libsyntax/ext/deriving/default.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt,
3939
args: Vec::new(),
4040
ret_ty: Self,
4141
attributes: attrs,
42-
const_nonmatching: false,
4342
combine_substructure: combine_substructure(|a, b, c| {
4443
default_substructure(a, b, c)
4544
})

branches/try2/src/libsyntax/ext/deriving/encodable.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ pub fn expand_deriving_encodable(cx: &mut ExtCtxt,
121121
box Literal(Path::new_local("__E"))),
122122
true)),
123123
attributes: Vec::new(),
124-
const_nonmatching: true,
125124
combine_substructure: combine_substructure(|a, b, c| {
126125
encodable_substructure(a, b, c)
127126
}),

0 commit comments

Comments
 (0)