Skip to content

Commit 6c836a8

Browse files
committed
---
yaml --- r: 83167 b: refs/heads/auto c: 00adcf0 h: refs/heads/master i: 83165: 5c3485f 83163: 4f1c432 83159: abdf67b 83151: c381083 83135: 2a35d4d v: v3
1 parent b5277c1 commit 6c836a8

File tree

22 files changed

+185
-105
lines changed

22 files changed

+185
-105
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 87a2d032ff6fe74e97348189f95a3a91fd9e228e
16+
refs/heads/auto: 00adcf0bdd9376046859b7bc0d79097b621844c5
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/doc/rust.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,6 +2067,10 @@ The currently implemented features of the compiler are:
20672067
For now this style of variant is hidden behind a feature
20682068
flag.
20692069

2070+
* `once_fns` - Onceness guarantees a closure is only executed once. Defining a
2071+
closure as `once` is unlikely to be supported going forward. So
2072+
they are hidden behind this feature until they are to be removed.
2073+
20702074
If a feature is promoted to a language feature, then all existing programs will
20712075
start to receive compilation warnings about #[feature] directives which enabled
20722076
the new feature (because the directive is no longer necessary). However, if

branches/auto/mk/target.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export CFG_COMPILER_TRIPLE
1515

1616
# The standard libraries should be held up to a higher standard than any old
1717
# code, make sure that these common warnings are denied by default. These can
18-
# be overridden during development temporarily. For stage0, we allow all these
19-
# to suppress warnings which may be bugs in stage0 (should be fixed in stage1+)
20-
WFLAGS_ST0 = -A warnings
18+
# be overridden during development temporarily. For stage0, we allow warnings
19+
# which may be bugs in stage0 (should be fixed in stage1+)
20+
WFLAGS_ST0 = -W warnings
2121
WFLAGS_ST1 = -D warnings
2222
WFLAGS_ST2 = -D warnings
2323

branches/auto/src/libextra/uuid.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ use std::rand::Rng;
6666
use std::cmp::Eq;
6767
use std::cast::{transmute,transmute_copy};
6868

69+
use serialize::{Encoder, Encodable, Decoder, Decodable};
70+
6971
/// A 128-bit (16 byte) buffer containing the ID
7072
pub type UuidBytes = [u8, ..16];
7173

@@ -486,6 +488,21 @@ impl TotalEq for Uuid {
486488
}
487489
}
488490

491+
// FIXME #9845: Test these more thoroughly
492+
impl<T: Encoder> Encodable<T> for Uuid {
493+
/// Encode a UUID as a hypenated string
494+
fn encode(&self, e: &mut T) {
495+
e.emit_str(self.to_hyphenated_str());
496+
}
497+
}
498+
499+
impl<T: Decoder> Decodable<T> for Uuid {
500+
/// Decode a UUID from a string
501+
fn decode(d: &mut T) -> Uuid {
502+
from_str(d.read_str()).unwrap()
503+
}
504+
}
505+
489506
/// Generates a random instance of UUID (V4 conformant)
490507
impl rand::Rand for Uuid {
491508
#[inline]
@@ -770,6 +787,20 @@ mod test {
770787
assert!(ub.len() == 16);
771788
assert!(! ub.iter().all(|&b| b == 0));
772789
}
790+
791+
#[test]
792+
fn test_serialize_round_trip() {
793+
use std;
794+
use ebml;
795+
use serialize::{Encodable, Decodable};
796+
797+
let u = Uuid::new_v4();
798+
let bytes = do std::io::with_bytes_writer |wr| {
799+
u.encode(&mut ebml::writer::Encoder(wr));
800+
};
801+
let u2 = Decodable::decode(&mut ebml::reader::Decoder(ebml::reader::Doc(@bytes)));
802+
assert_eq!(u, u2);
803+
}
773804
}
774805

775806
#[cfg(test)]

branches/auto/src/librustc/back/rpath.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ mod test {
189189
let mut d = Path::new(env!("CFG_PREFIX"));
190190
d.push("lib/rustc/triple/lib");
191191
debug2!("test_prefix_path: {} vs. {}",
192-
res,
192+
res.to_str(),
193193
d.display());
194-
assert!(res.as_bytes().ends_with(d.as_vec()));
194+
assert!(ends_with(res.as_bytes(), d.as_vec()));
195+
fn ends_with(v: &[u8], needle: &[u8]) -> bool {
196+
v.len() >= needle.len() && v.slice_from(v.len()-needle.len()) == needle
197+
}
195198
}
196199
197200
#[test]

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -74,12 +74,11 @@ pub static statik: uint = 1 << 21;
7474
pub static print_link_args: uint = 1 << 22;
7575
pub static no_debug_borrows: uint = 1 << 23;
7676
pub static lint_llvm: uint = 1 << 24;
77-
pub static once_fns: uint = 1 << 25;
78-
pub static print_llvm_passes: uint = 1 << 26;
79-
pub static no_vectorize_loops: uint = 1 << 27;
80-
pub static no_vectorize_slp: uint = 1 << 28;
81-
pub static no_prepopulate_passes: uint = 1 << 29;
82-
pub static use_softfp: uint = 1 << 30;
77+
pub static print_llvm_passes: uint = 1 << 25;
78+
pub static no_vectorize_loops: uint = 1 << 26;
79+
pub static no_vectorize_slp: uint = 1 << 27;
80+
pub static no_prepopulate_passes: uint = 1 << 28;
81+
pub static use_softfp: uint = 1 << 29;
8382

8483
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
8584
~[("verbose", "in general, enable more debug printouts", verbose),
@@ -118,9 +117,6 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
118117
("lint-llvm",
119118
"Run the LLVM lint pass on the pre-optimization IR",
120119
lint_llvm),
121-
("once-fns",
122-
"Allow 'once fn' closures to deinitialize captured variables",
123-
once_fns),
124120
("print-llvm-passes",
125121
"Prints the llvm optimization passes being run",
126122
print_llvm_passes),
@@ -326,7 +322,6 @@ impl Session_ {
326322
pub fn debug_borrows(&self) -> bool {
327323
self.opts.optimize == No && !self.debugging_opt(no_debug_borrows)
328324
}
329-
pub fn once_fns(&self) -> bool { self.debugging_opt(once_fns) }
330325
pub fn print_llvm_passes(&self) -> bool {
331326
self.debugging_opt(print_llvm_passes)
332327
}

branches/auto/src/librustc/front/feature_gate.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
3333
("globs", Active),
3434
("macro_rules", Active),
3535
("struct_variant", Active),
36+
("once_fns", Active),
3637

3738
// These are used to test this portion of the compiler, they don't actually
3839
// mean anything
@@ -126,6 +127,20 @@ impl Visitor<()> for Context {
126127

127128
visit::walk_item(self, i, ());
128129
}
130+
131+
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {
132+
match t.node {
133+
ast::ty_closure(closure) if closure.onceness == ast::Once => {
134+
self.gate_feature("once_fns", t.span,
135+
"once functions are \
136+
experimental and likely to be removed");
137+
138+
},
139+
_ => {}
140+
}
141+
142+
visit::walk_ty(self, t, ());
143+
}
129144
}
130145

131146
pub fn check_crate(sess: Session, crate: &ast::Crate) {

branches/auto/src/librustc/middle/borrowck/gather_loans/gather_moves.rs

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -102,25 +102,13 @@ fn check_is_legal_to_move_from(bccx: &BorrowckCtxt,
102102
match cmt.cat {
103103
mc::cat_deref(_, _, mc::region_ptr(*)) |
104104
mc::cat_deref(_, _, mc::gc_ptr(*)) |
105-
mc::cat_deref(_, _, mc::unsafe_ptr(*)) => {
106-
bccx.span_err(
107-
cmt0.span,
108-
format!("cannot move out of {}",
109-
bccx.cmt_to_str(cmt)));
110-
false
111-
}
112-
113-
// These are separate from the above cases for a better error message.
105+
mc::cat_deref(_, _, mc::unsafe_ptr(*)) |
114106
mc::cat_stack_upvar(*) |
115107
mc::cat_copied_upvar(mc::CopiedUpvar { onceness: ast::Many, _ }) => {
116-
let once_hint = if bccx.tcx.sess.once_fns() {
117-
" (unless the destination closure type is `once fn')"
118-
} else {
119-
""
120-
};
121108
bccx.span_err(
122109
cmt0.span,
123-
format!("cannot move out of {}{}", bccx.cmt_to_str(cmt), once_hint));
110+
format!("cannot move out of {}",
111+
bccx.cmt_to_str(cmt)));
124112
false
125113
}
126114

branches/auto/src/librustc/middle/mem_categorization.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -508,12 +508,10 @@ impl mem_categorization_ctxt {
508508
let var_is_refd = match (closure_ty.sigil, closure_ty.onceness) {
509509
// Many-shot stack closures can never move out.
510510
(ast::BorrowedSigil, ast::Many) => true,
511-
// 1-shot stack closures can move out with "-Z once-fns".
512-
(ast::BorrowedSigil, ast::Once)
513-
if self.tcx.sess.once_fns() => false,
514-
(ast::BorrowedSigil, ast::Once) => true,
511+
// 1-shot stack closures can move out.
512+
(ast::BorrowedSigil, ast::Once) => false,
515513
// Heap closures always capture by copy/move, and can
516-
// move out iff they are once.
514+
// move out if they are once.
517515
(ast::OwnedSigil, _) |
518516
(ast::ManagedSigil, _) => false,
519517

branches/auto/src/librustc/middle/typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3645,7 +3645,7 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
36453645
let fty = ty::mk_closure(ccx.tcx, ty::ClosureTy {
36463646
purity: ast::impure_fn,
36473647
sigil: ast::BorrowedSigil,
3648-
onceness: ast::Once,
3648+
onceness: ast::Many,
36493649
region: ty::re_bound(ty::br_anon(0)),
36503650
bounds: ty::EmptyBuiltinBounds(),
36513651
sig: ty::FnSig {

branches/auto/src/librustpkg/tests.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@ fn is_read_only(p: &Path) -> bool {
217217
}
218218
}
219219

220+
fn ends_with(v: &[u8], needle: &[u8]) -> bool {
221+
v.len() >= needle.len() && v.slice_from(v.len() - needle.len()) == needle
222+
}
223+
220224
fn test_sysroot() -> Path {
221225
// Totally gross hack but it's just for test cases.
222226
// Infer the sysroot from the exe name and pray that it's right.
@@ -743,7 +747,7 @@ fn test_package_version() {
743747
&ws) {
744748
Some(p) => {
745749
let suffix = format!("0.4{}", os::consts::DLL_SUFFIX);
746-
p.as_vec().ends_with(suffix.as_bytes())
750+
ends_with(p.as_vec(), suffix.as_bytes())
747751
}
748752
None => false
749753
});
@@ -781,7 +785,7 @@ fn test_package_request_version() {
781785
Some(p) => {
782786
debug2!("installed: {}", p.display());
783787
let suffix = format!("0.3{}", os::consts::DLL_SUFFIX);
784-
p.as_vec().ends_with(suffix.as_bytes())
788+
ends_with(p.as_vec(), suffix.as_bytes())
785789
}
786790
None => false
787791
});

0 commit comments

Comments
 (0)