Skip to content

Commit 2dd3dd8

Browse files
committed
---
yaml --- r: 234045 b: refs/heads/beta c: 01b9cc5 h: refs/heads/master i: 234043: 1ef302c v: v3
1 parent 4599d2f commit 2dd3dd8

File tree

7 files changed

+49
-22
lines changed

7 files changed

+49
-22
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: c34f3506645e4ce4ba2b0f34a437793a14018d13
26+
refs/heads/beta: 01b9cc58ba0c91ec265d8c1ad9225b2ca777464e
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/doc/nomicon/vec-drain.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,16 @@ impl<'a, T> Drop for Drain<'a, T> {
129129
130130
impl<T> Vec<T> {
131131
pub fn drain(&mut self) -> Drain<T> {
132-
// this is a mem::forget safety thing. If Drain is forgotten, we just
133-
// leak the whole Vec's contents. Also we need to do this eventually
134-
// anyway, so why not do it now?
135-
self.len = 0;
136-
137132
unsafe {
133+
let iter = RawValIter::new(&self);
134+
135+
// this is a mem::forget safety thing. If Drain is forgotten, we just
136+
// leak the whole Vec's contents. Also we need to do this *eventually*
137+
// anyway, so why not do it now?
138+
self.len = 0;
139+
138140
Drain {
139-
iter: RawValIter::new(&self),
141+
iter: iter,
140142
vec: PhantomData,
141143
}
142144
}

branches/beta/src/doc/nomicon/vec-final.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,16 @@ impl<T> Vec<T> {
155155
}
156156

157157
pub fn drain(&mut self) -> Drain<T> {
158-
// this is a mem::forget safety thing. If this is forgotten, we just
159-
// leak the whole Vec's contents. Also we need to do this *eventually*
160-
// anyway, so why not do it now?
161-
self.len = 0;
162158
unsafe {
159+
let iter = RawValIter::new(&self);
160+
161+
// this is a mem::forget safety thing. If Drain is forgotten, we just
162+
// leak the whole Vec's contents. Also we need to do this *eventually*
163+
// anyway, so why not do it now?
164+
self.len = 0;
165+
163166
Drain {
164-
iter: RawValIter::new(&self),
167+
iter: iter,
165168
vec: PhantomData,
166169
}
167170
}

branches/beta/src/doc/trpl/macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn main() {
313313
}
314314
```
315315

316-
This works because Rust has a [hygienic macro system][]. Each macro expansion
316+
This works because Rust has a [hygienic macro system][https://en.wikipedia.org/wiki/Hygienic_macro]. Each macro expansion
317317
happens in a distinct ‘syntax context’, and each variable is tagged with the
318318
syntax context where it was introduced. It’s as though the variable `state`
319319
inside `main` is painted a different "color" from the variable `state` inside

branches/beta/src/librustc/middle/region.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@ impl RegionMaps {
317317
self.intern_code_extent(e, DUMMY_CODE_EXTENT)
318318
}
319319
pub fn lookup_code_extent(&self, e: CodeExtentData) -> CodeExtent {
320-
self.code_extent_interner.borrow()[&e]
320+
match self.code_extent_interner.borrow().get(&e) {
321+
Some(&d) => d,
322+
None => panic!("unknown code extent {:?}", e)
323+
}
321324
}
322325
pub fn node_extent(&self, n: ast::NodeId) -> CodeExtent {
323326
self.lookup_code_extent(CodeExtentData::Misc(n))
@@ -1069,7 +1072,7 @@ fn resolve_item(visitor: &mut RegionResolutionVisitor, item: &hir::Item) {
10691072
}
10701073

10711074
fn resolve_fn(visitor: &mut RegionResolutionVisitor,
1072-
_: FnKind,
1075+
kind: FnKind,
10731076
decl: &hir::FnDecl,
10741077
body: &hir::Block,
10751078
sp: Span,
@@ -1102,6 +1105,7 @@ fn resolve_fn(visitor: &mut RegionResolutionVisitor,
11021105
};
11031106

11041107
visit::walk_fn_decl(visitor, decl);
1108+
visit::walk_fn_kind(visitor, kind);
11051109

11061110
// The body of the every fn is a root scope.
11071111
visitor.cx = Context {

branches/beta/src/librustc_front/visit.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -580,13 +580,8 @@ pub fn walk_fn_decl<'v, V: Visitor<'v>>(visitor: &mut V, function_declaration: &
580580
walk_fn_ret_ty(visitor, &function_declaration.output)
581581
}
582582

583-
pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
584-
function_kind: FnKind<'v>,
585-
function_declaration: &'v FnDecl,
586-
function_body: &'v Block,
587-
_span: Span) {
588-
walk_fn_decl(visitor, function_declaration);
589-
583+
pub fn walk_fn_kind<'v, V: Visitor<'v>>(visitor: &mut V,
584+
function_kind: FnKind<'v>) {
590585
match function_kind {
591586
FnKind::ItemFn(_, generics, _, _, _, _) => {
592587
visitor.visit_generics(generics);
@@ -597,7 +592,15 @@ pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
597592
}
598593
FnKind::Closure(..) => {}
599594
}
595+
}
600596

597+
pub fn walk_fn<'v, V: Visitor<'v>>(visitor: &mut V,
598+
function_kind: FnKind<'v>,
599+
function_declaration: &'v FnDecl,
600+
function_body: &'v Block,
601+
_span: Span) {
602+
walk_fn_decl(visitor, function_declaration);
603+
walk_fn_kind(visitor, function_kind);
601604
visitor.visit_block(function_body)
602605
}
603606

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn bar<F>(f: F) -> usize where F: Fn([usize; 1]) -> usize { f([2]) }
12+
13+
fn main() {
14+
bar(|u| { u[0] });
15+
}

0 commit comments

Comments
 (0)