Skip to content

Commit 83c42cf

Browse files
committed
---
yaml --- r: 97824 b: refs/heads/snap-stage3 c: 68517a2 h: refs/heads/master v: v3
1 parent 5d657ea commit 83c42cf

File tree

31 files changed

+214
-283
lines changed

31 files changed

+214
-283
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6d55211700545d253dec4ebbe386832e00d2a247
4+
refs/heads/snap-stage3: 68517a2cca613d2018819d0eb38f6c0a864d1836
55
refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/doc/tutorial.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,15 +1020,10 @@ being destroyed along with the owner. Since the `list` variable above is
10201020
immutable, the whole list is immutable. The memory allocation itself is the
10211021
box, while the owner holds onto a pointer to it:
10221022

1023-
List box List box List box List box
1024-
+--------------+ +--------------+ +--------------+ +--------------+
1025-
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
1026-
+--------------+ +--------------+ +--------------+ +--------------+
1027-
1028-
> Note: the above diagram shows the logical contents of the enum. The actual
1029-
> memory layout of the enum may vary. For example, for the `List` enum shown
1030-
> above, Rust guarantees that there will be no enum tag field in the actual
1031-
> structure. See the language reference for more details.
1023+
Cons cell Cons cell Cons cell
1024+
+-----------+ +-----+-----+ +-----+-----+
1025+
| 1 | ~ | -> | 2 | ~ | -> | 3 | ~ | -> Nil
1026+
+-----------+ +-----+-----+ +-----+-----+
10321027

10331028
An owned box is a common example of a type with a destructor. The allocated
10341029
memory is cleaned up when the box is destroyed.

branches/snap-stage3/src/etc/vim/syntax/rust.vim

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
" Maintainer: Patrick Walton <[email protected]>
44
" Maintainer: Ben Blum <[email protected]>
55
" Maintainer: Chris Morgan <[email protected]>
6-
" Last Change: 2014 Jan 4
6+
" Last Change: 2013 Dec 10
77

88
if version < 600
99
syntax clear
@@ -147,8 +147,8 @@ syn match rustMacro '#\w\(\w\)*' contains=rustAssert,rustFail
147147
syn match rustSpecialError display contained /\\./
148148
syn match rustSpecial display contained /\\\([nrt0\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
149149
syn match rustStringContinuation display contained /\\\n\s*/
150-
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation,@Spell
151-
syn region rustString start='r\z(#*\)"' end='"\z1' contains=@Spell
150+
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustSpecial,rustSpecialError,rustStringContinuation
151+
syn region rustString start='r\z(#*\)"' end='"\z1'
152152

153153
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
154154
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait
@@ -179,10 +179,10 @@ syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit
179179
syn match rustCharacter /'\([^'\\]\|\\\(.\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'/ contains=rustSpecial,rustSpecialError
180180

181181
syn cluster rustComment contains=rustCommentLine,rustCommentLineDoc,rustCommentBlock,rustCommentBlockDoc
182-
syn region rustCommentLine start="//" end="$" contains=rustTodo,@Spell
183-
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo,@Spell
184-
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
185-
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment,@Spell keepend extend
182+
syn region rustCommentLine start="//" end="$" contains=rustTodo
183+
syn region rustCommentLineDoc start="//\%(//\@!\|!\)" end="$" contains=rustTodo
184+
syn region rustCommentBlock matchgroup=rustCommentBlock start="/\*\%(!\|\*[*/]\@!\)\@!" end="\*/" contains=rustTodo,@rustComment keepend extend
185+
syn region rustCommentBlockDoc matchgroup=rustCommentBlockDoc start="/\*\%(!\|\*[*/]\@!\)" end="\*/" contains=rustTodo,@rustComment keepend extend
186186
" FIXME: this is a really ugly and not fully correct implementation. Most
187187
" importantly, a case like ``/* */*`` should have the final ``*`` not being in
188188
" a comment, but in practice at present it leaves comments open two levels

branches/snap-stage3/src/libextra/bitv.rs

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -269,23 +269,14 @@ impl Bitv {
269269

270270
impl Bitv {
271271
pub fn new(nbits: uint, init: bool) -> Bitv {
272-
let rep = if nbits < uint::bits {
273-
Small(SmallBitv::new(if init {(1<<nbits)-1} else {0}))
274-
} else if nbits == uint::bits {
272+
let rep = if nbits <= uint::bits {
275273
Small(SmallBitv::new(if init {!0} else {0}))
276-
} else {
277-
let exact = nbits % uint::bits == 0;
278-
let nelems = nbits/uint::bits + if exact {0} else {1};
279-
let s =
280-
if init {
281-
if exact {
282-
vec::from_elem(nelems, !0u)
283-
} else {
284-
let mut v = vec::from_elem(nelems-1, !0u);
285-
v.push((1<<nbits % uint::bits)-1);
286-
v
287-
}
288-
} else { vec::from_elem(nelems, 0u)};
274+
}
275+
else {
276+
let nelems = nbits/uint::bits +
277+
if nbits % uint::bits == 0 {0} else {1};
278+
let elem = if init {!0u} else {0u};
279+
let s = vec::from_elem(nelems, elem);
289280
Big(BigBitv::new(s))
290281
};
291282
Bitv {rep: rep, nbits: nbits}
@@ -1338,20 +1329,6 @@ mod tests {
13381329
assert_eq!(idxs, ~[0, 2, 3]);
13391330
}
13401331
1341-
#[test]
1342-
fn test_bitv_set_frombitv_init() {
1343-
let bools = [true, false];
1344-
let lengths = [10, 64, 100];
1345-
for &b in bools.iter() {
1346-
for &l in lengths.iter() {
1347-
let bitset = BitvSet::from_bitv(Bitv::new(l, b));
1348-
assert_eq!(bitset.contains(&1u), b)
1349-
assert_eq!(bitset.contains(&(l-1u)), b)
1350-
assert!(!bitset.contains(&l))
1351-
}
1352-
}
1353-
}
1354-
13551332
#[test]
13561333
fn test_small_difference() {
13571334
let mut b1 = Bitv::new(3, false);

branches/snap-stage3/src/librustc/front/feature_gate.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
4545
("link_args", Active),
4646
("phase", Active),
4747
("macro_registrar", Active),
48-
("log_syntax", Active),
4948

5049
// These are used to test this portion of the compiler, they don't actually
5150
// mean anything
@@ -188,11 +187,6 @@ impl Visitor<()> for Context {
188187
self.gate_feature("asm", path.span, "inline assembly is not \
189188
stable enough for use and is subject to change");
190189
}
191-
192-
else if path.segments.last().identifier == self.sess.ident_of("log_syntax") {
193-
self.gate_feature("log_syntax", path.span, "`log_syntax!` is not \
194-
stable enough for use and is subject to change");
195-
}
196190
}
197191

198192
fn visit_ty(&mut self, t: &ast::Ty, _: ()) {

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

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,8 @@ fn encode_reexported_static_methods(ecx: &EncodeContext,
496496
ebml_w: &mut writer::Encoder,
497497
mod_path: &[ast_map::PathElem],
498498
exp: &middle::resolve::Export2) {
499-
let items = ecx.tcx.items.borrow();
500-
match items.get().find(&exp.def_id.node) {
501-
Some(&ast_map::NodeItem(item, path)) => {
499+
match ecx.tcx.items.find(exp.def_id.node) {
500+
Some(ast_map::NodeItem(item, path)) => {
502501
let original_name = ecx.tcx.sess.str_of(item.ident);
503502

504503
//
@@ -1347,8 +1346,7 @@ fn my_visit_item(i: &Item,
13471346
ebml_w: &mut writer::Encoder,
13481347
ecx_ptr: *int,
13491348
index: @RefCell<~[entry<i64>]>) {
1350-
let items = items.borrow();
1351-
match items.get().get_copy(&i.id) {
1349+
match items.get(i.id) {
13521350
ast_map::NodeItem(_, pt) => {
13531351
let mut ebml_w = unsafe {
13541352
ebml_w.unsafe_clone()
@@ -1366,8 +1364,7 @@ fn my_visit_foreign_item(ni: &ForeignItem,
13661364
ebml_w: &mut writer::Encoder,
13671365
ecx_ptr:*int,
13681366
index: @RefCell<~[entry<i64>]>) {
1369-
let items = items.borrow();
1370-
match items.get().get_copy(&ni.id) {
1367+
match items.get(ni.id) {
13711368
ast_map::NodeForeignItem(_, abi, _, pt) => {
13721369
debug!("writing foreign item {}::{}",
13731370
ast_map::path_to_str(

branches/snap-stage3/src/librustc/middle/borrowck/mod.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -550,9 +550,8 @@ impl BorrowckCtxt {
550550
move_data::Declared => {}
551551

552552
move_data::MoveExpr => {
553-
let items = self.tcx.items.borrow();
554-
let (expr_ty, expr_span) = match items.get().find(&move.id) {
555-
Some(&ast_map::NodeExpr(expr)) => {
553+
let (expr_ty, expr_span) = match self.tcx.items.find(move.id) {
554+
Some(ast_map::NodeExpr(expr)) => {
556555
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
557556
}
558557
r => self.tcx.sess.bug(format!("MoveExpr({:?}) maps to {:?}, not Expr",
@@ -578,9 +577,8 @@ impl BorrowckCtxt {
578577
}
579578

580579
move_data::Captured => {
581-
let items = self.tcx.items.borrow();
582-
let (expr_ty, expr_span) = match items.get().find(&move.id) {
583-
Some(&ast_map::NodeExpr(expr)) => {
580+
let (expr_ty, expr_span) = match self.tcx.items.find(move.id) {
581+
Some(ast_map::NodeExpr(expr)) => {
584582
(ty::expr_ty_adjusted(self.tcx, expr), expr.span)
585583
}
586584
r => self.tcx.sess.bug(format!("Captured({:?}) maps to {:?}, not Expr",
@@ -768,9 +766,8 @@ impl BorrowckCtxt {
768766
out: &mut ~str) {
769767
match *loan_path {
770768
LpVar(id) => {
771-
let items = self.tcx.items.borrow();
772-
match items.get().find(&id) {
773-
Some(&ast_map::NodeLocal(ref ident, _)) => {
769+
match self.tcx.items.find(id) {
770+
Some(ast_map::NodeLocal(ref ident, _)) => {
774771
out.push_str(token::ident_to_str(ident));
775772
}
776773
r => {

branches/snap-stage3/src/librustc/middle/check_const.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,7 @@ impl<'a> Visitor<()> for CheckItemRecursionVisitor<'a> {
250250
match def_map.get().find(&e.id) {
251251
Some(&DefStatic(def_id, _)) if
252252
ast_util::is_local(def_id) => {
253-
let ast_map = self.ast_map.borrow();
254-
match ast_map.get().get_copy(&def_id.node) {
253+
match self.ast_map.get(def_id.node) {
255254
ast_map::NodeItem(it, _) => {
256255
self.visit_item(it, ());
257256
}

branches/snap-stage3/src/librustc/middle/const_eval.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,9 @@ pub fn lookup_variant_by_id(tcx: ty::ctxt,
108108

109109
if ast_util::is_local(enum_def) {
110110
{
111-
let items = tcx.items.borrow();
112-
match items.get().find(&enum_def.node) {
111+
match tcx.items.find(enum_def.node) {
113112
None => None,
114-
Some(&ast_map::NodeItem(it, _)) => match it.node {
113+
Some(ast_map::NodeItem(it, _)) => match it.node {
115114
ItemEnum(ast::EnumDef { variants: ref variants }, _) => {
116115
variant_expr(*variants, variant_def.node)
117116
}
@@ -161,10 +160,9 @@ pub fn lookup_const_by_id(tcx: ty::ctxt, def_id: ast::DefId)
161160
-> Option<@Expr> {
162161
if ast_util::is_local(def_id) {
163162
{
164-
let items = tcx.items.borrow();
165-
match items.get().find(&def_id.node) {
163+
match tcx.items.find(def_id.node) {
166164
None => None,
167-
Some(&ast_map::NodeItem(it, _)) => match it.node {
165+
Some(ast_map::NodeItem(it, _)) => match it.node {
168166
ItemStatic(_, ast::MutImmutable, const_expr) => {
169167
Some(const_expr)
170168
}

branches/snap-stage3/src/librustc/middle/dead.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ fn should_explore(tcx: ty::ctxt, def_id: ast::DefId) -> bool {
3838
return false;
3939
}
4040

41-
let items = tcx.items.borrow();
42-
match items.get().find(&def_id.node) {
43-
Some(&ast_map::NodeItem(..))
44-
| Some(&ast_map::NodeMethod(..))
45-
| Some(&ast_map::NodeForeignItem(..))
46-
| Some(&ast_map::NodeTraitMethod(..)) => true,
41+
match tcx.items.find(def_id.node) {
42+
Some(ast_map::NodeItem(..))
43+
| Some(ast_map::NodeMethod(..))
44+
| Some(ast_map::NodeForeignItem(..))
45+
| Some(ast_map::NodeTraitMethod(..)) => true,
4746
_ => false
4847
}
4948
}
@@ -136,9 +135,8 @@ impl MarkSymbolVisitor {
136135
}
137136
scanned.insert(id);
138137

139-
let items = self.tcx.items.borrow();
140-
match items.get().find(&id) {
141-
Some(node) => {
138+
match self.tcx.items.find(id) {
139+
Some(ref node) => {
142140
self.live_symbols.insert(id);
143141
self.visit_node(node);
144142
}

branches/snap-stage3/src/librustc/middle/entry.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
7575
ItemFn(..) => {
7676
if item.ident.name == special_idents::main.name {
7777
{
78-
let ast_map = ctxt.ast_map.borrow();
79-
match ast_map.get().find(&item.id) {
80-
Some(&ast_map::NodeItem(_, path)) => {
78+
match ctxt.ast_map.find(item.id) {
79+
Some(ast_map::NodeItem(_, path)) => {
8180
if path.len() == 0 {
8281
// This is a top-level function so can be 'main'
8382
if ctxt.main_fn.is_none() {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,7 @@ fn check_stability(cx: &Context, e: &ast::Expr) {
13301330

13311331
let stability = if ast_util::is_local(id) {
13321332
// this crate
1333-
let items = cx.tcx.items.borrow();
1334-
match items.get().find(&id.node) {
1333+
match cx.tcx.items.find(id.node) {
13351334
Some(ast_node) => {
13361335
let s = ast_node.with_attrs(|attrs| {
13371336
attrs.map(|a| {

branches/snap-stage3/src/librustc/middle/privacy.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,7 @@ impl<'a> PrivacyVisitor<'a> {
431431
let mut closest_private_id = did.node;
432432
loop {
433433
debug!("privacy - examining {}", self.nodestr(closest_private_id));
434-
let items = self.tcx.items.borrow();
435-
let vis = match items.get().find(&closest_private_id) {
434+
let vis = match self.tcx.items.find(closest_private_id) {
436435
// If this item is a method, then we know for sure that it's an
437436
// actual method and not a static method. The reason for this is
438437
// that these cases are only hit in the ExprMethodCall
@@ -449,22 +448,22 @@ impl<'a> PrivacyVisitor<'a> {
449448
// invocation.
450449
// FIXME(#10573) is this the right behavior? Why not consider
451450
// where the method was defined?
452-
Some(&ast_map::NodeMethod(ref m, imp, _)) => {
451+
Some(ast_map::NodeMethod(ref m, imp, _)) => {
453452
match ty::impl_trait_ref(self.tcx, imp) {
454453
Some(..) => return Allowable,
455454
_ if m.vis == ast::Public => return Allowable,
456455
_ => m.vis
457456
}
458457
}
459-
Some(&ast_map::NodeTraitMethod(..)) => {
458+
Some(ast_map::NodeTraitMethod(..)) => {
460459
return Allowable;
461460
}
462461

463462
// This is not a method call, extract the visibility as one
464463
// would normally look at it
465-
Some(&ast_map::NodeItem(it, _)) => it.vis,
466-
Some(&ast_map::NodeForeignItem(_, _, v, _)) => v,
467-
Some(&ast_map::NodeVariant(ref v, _, _)) => {
464+
Some(ast_map::NodeItem(it, _)) => it.vis,
465+
Some(ast_map::NodeForeignItem(_, _, v, _)) => v,
466+
Some(ast_map::NodeVariant(ref v, _, _)) => {
468467
// sadly enum variants still inherit visibility, so only
469468
// break out of this is explicitly private
470469
if v.node.vis == ast::Private { break }
@@ -538,9 +537,8 @@ impl<'a> PrivacyVisitor<'a> {
538537
self.tcx.sess.span_err(span, format!("{} is inaccessible",
539538
msg));
540539
}
541-
let items = self.tcx.items.borrow();
542-
match items.get().find(&id) {
543-
Some(&ast_map::NodeItem(item, _)) => {
540+
match self.tcx.items.find(id) {
541+
Some(ast_map::NodeItem(item, _)) => {
544542
let desc = match item.node {
545543
ast::ItemMod(..) => "module",
546544
ast::ItemTrait(..) => "trait",

0 commit comments

Comments
 (0)