Skip to content

Commit 0fff271

Browse files
committed
---
yaml --- r: 72678 b: refs/heads/dist-snap c: cb918e1 h: refs/heads/master v: v3
1 parent eaa593f commit 0fff271

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: b50030718cf28f2a5a81857a26b57442734fe854
10-
refs/heads/dist-snap: 8f2d71ac009e1f93c14266ecebb1c105a0a907e3
10+
refs/heads/dist-snap: cb918e1a831782d6072a0b93dd57614cb9c2d961
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/tutorial-ffi.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ wrapping `malloc` and `free`:
150150

151151
~~~~
152152
use core::libc::{c_void, size_t, malloc, free};
153-
use core::unstable::intrinsics;
153+
154+
#[abi = "rust-intrinsic"]
155+
extern "rust-intrinsic" mod rusti {
156+
fn init<T>() -> T;
157+
}
154158
155159
// a wrapper around the handle returned by the foreign code
156160
pub struct Unique<T> {
@@ -162,8 +166,7 @@ pub impl<'self, T: Owned> Unique<T> {
162166
unsafe {
163167
let ptr = malloc(core::sys::size_of::<T>() as size_t) as *mut T;
164168
assert!(!ptr::is_null(ptr));
165-
// `*ptr` is uninitialized, and `*ptr = value` would attempt to destroy it
166-
intrinsics::move_val_init(&mut *ptr, value);
169+
*ptr = value;
167170
Unique{ptr: ptr}
168171
}
169172
}
@@ -183,7 +186,7 @@ pub impl<'self, T: Owned> Unique<T> {
183186
impl<T: Owned> Drop for Unique<T> {
184187
fn finalize(&self) {
185188
unsafe {
186-
let mut x = intrinsics::init(); // dummy value to swap in
189+
let mut x = rusti::init(); // dummy value to swap in
187190
x <-> *self.ptr; // moving the object out is needed to call the destructor
188191
free(self.ptr as *c_void)
189192
}

branches/dist-snap/src/libsyntax/parse/parser.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,13 @@ pub impl Parser {
23832383
can_be_enum_or_struct = false
23842384
}
23852385

2386-
if is_plain_ident(&*self.token) && !can_be_enum_or_struct {
2386+
if self.look_ahead(1) == token::DOTDOT {
2387+
let start = self.parse_expr_res(RESTRICT_NO_BAR_OP);
2388+
self.eat(&token::DOTDOT);
2389+
let end = self.parse_expr_res(RESTRICT_NO_BAR_OP);
2390+
pat = pat_range(start, end);
2391+
}
2392+
else if is_plain_ident(&*self.token) && !can_be_enum_or_struct {
23872393
let name = self.parse_path_without_tps();
23882394
let sub;
23892395
if self.eat(&token::AT) {
@@ -2392,7 +2398,7 @@ pub impl Parser {
23922398
} else {
23932399
// or just foo
23942400
sub = None;
2395-
};
2401+
}
23962402
pat = pat_ident(binding_mode, name, sub);
23972403
} else {
23982404
// parse an enum pat
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
static s: int = 1;
2+
static e: int = 42;
3+
4+
fn main() {
5+
match 7 {
6+
s..e => (),
7+
_ => (),
8+
}
9+
}
10+

0 commit comments

Comments
 (0)