Skip to content

Commit ba63bba

Browse files
committed
---
yaml --- r: 139440 b: refs/heads/try2 c: 5da9e12 h: refs/heads/master v: v3
1 parent a22be01 commit ba63bba

File tree

9 files changed

+62
-14
lines changed

9 files changed

+62
-14
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: be57d745d2517305da4625891f08af8b3eb19042
8+
refs/heads/try2: 5da9e12778ddafb46e4a5013dd133af98f3dfb98
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/tutorial.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,7 @@ the compiler that unsafety does not leak outside of the unsafe block, and is
875875
used to create safe concepts on top of low-level code.
876876

877877
~~~~
878-
use core::libc::funcs::c95::stdlib::{calloc, free};
879-
use core::libc::types::os::arch::c95::size_t;
878+
use core::libc::{calloc, free, size_t};
880879
881880
fn main() {
882881
unsafe {
@@ -909,9 +908,7 @@ The unsafe code from above can be contained behind a safe API that prevents
909908
memory leaks or use-after-free:
910909

911910
~~~~
912-
use core::libc::funcs::c95::stdlib::{calloc, free};
913-
use core::libc::types::common::c95::c_void;
914-
use core::libc::types::os::arch::c95::size_t;
911+
use core::libc::{calloc, free, c_void, size_t};
915912
916913
struct Blob { priv ptr: *c_void }
917914
@@ -985,7 +982,9 @@ when it is collected.
985982

986983
If an object doesn't contain garbage-collected boxes, it consists of a single
987984
ownership tree and is given the `Owned` trait which allows it to be sent
988-
between tasks.
985+
between tasks. Custom destructors can only be implemented directly on types
986+
that are `Owned`, but garbage-collected boxes can still *contain* types with
987+
custom destructors.
989988

990989
# Boxes
991990

branches/try2/src/libcore/prelude.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ pub use ops::{Shl, Shr, Index};
2121
pub use option::{Option, Some, None};
2222
pub use result::{Result, Ok, Err};
2323

24+
/* Reexported functions */
25+
26+
pub use io::{print, println};
27+
2428
/* Reexported types and traits */
2529

2630
pub use clone::Clone;

branches/try2/src/libcore/rt/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
160160
type Registers = [uint, ..32];
161161

162162
#[cfg(target_arch = "arm")]
163-
fn new_regs() -> ~Registers { ~[0, .. 32] }
163+
fn new_regs() -> ~Registers { ~([0, .. 32]) }
164164

165165
#[cfg(target_arch = "arm")]
166166
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {
@@ -178,7 +178,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
178178
type Registers = [uint, ..32];
179179

180180
#[cfg(target_arch = "mips")]
181-
fn new_regs() -> ~Registers { ~[0, .. 32] }
181+
fn new_regs() -> ~Registers { ~([0, .. 32]) }
182182

183183
#[cfg(target_arch = "mips")]
184184
fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) {

branches/try2/src/librustc/middle/trans/consts.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
use core::prelude::*;
1212

1313
use back::abi;
14-
use lib::llvm::{llvm, ValueRef, TypeRef, Bool, True, False};
14+
use lib::llvm::{llvm, SetLinkage, InternalLinkage, PrivateLinkage,
15+
ValueRef, TypeRef, Bool, True, False};
1516
use metadata::csearch;
1617
use middle::const_eval;
1718
use middle::trans::adt;
@@ -104,6 +105,7 @@ fn const_addr_of(cx: @CrateContext, cv: ValueRef) -> ValueRef {
104105
};
105106
llvm::LLVMSetInitializer(gv, cv);
106107
llvm::LLVMSetGlobalConstant(gv, True);
108+
SetLinkage(gv, PrivateLinkage);
107109
gv
108110
}
109111
}
@@ -483,6 +485,7 @@ fn const_expr_unadjusted(cx: @CrateContext, e: @ast::expr) -> ValueRef {
483485
};
484486
llvm::LLVMSetInitializer(gv, cv);
485487
llvm::LLVMSetGlobalConstant(gv, True);
488+
SetLinkage(gv, PrivateLinkage);
486489
let p = const_ptrcast(cx, gv, llunitty);
487490
C_struct(~[p, sz])
488491
}

branches/try2/src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3107,11 +3107,15 @@ pub impl Parser {
31073107
// XXX: clownshoes
31083108
let ident = special_idents::clownshoes_extensions;
31093109

3110+
// Special case: if the next identifier that follows is '(', don't
3111+
// allow this to be parsed as a trait.
3112+
let could_be_trait = *self.token != token::LPAREN;
3113+
31103114
// Parse the trait.
31113115
let mut ty = self.parse_ty(false);
31123116

31133117
// Parse traits, if necessary.
3114-
let opt_trait = if self.eat_keyword(&~"for") {
3118+
let opt_trait = if could_be_trait && self.eat_keyword(&~"for") {
31153119
// New-style trait. Reinterpret the type as a trait.
31163120
let opt_trait_ref = match ty.node {
31173121
ty_path(path, node_id) => {

branches/try2/src/test/compile-fail/issue-4335.rs

Lines changed: 2 additions & 3 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
//
@@ -8,10 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// xfail-test
1211
fn id<T>(t: T) -> T { t }
1312

14-
fn f<T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR ???
13+
fn f<'r, T>(v: &'r T) -> &'r fn()->T { id::<&'r fn()->T>(|| *v) } //~ ERROR cannot infer an appropriate lifetime due to conflicting requirements
1514

1615
fn main() {
1716
let v = &5;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2013 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+
struct Node<'self, T> {
12+
val: T,
13+
next: Option<&'self Node<'self, T>>
14+
}
15+
16+
impl<'self, T> Node<'self, T> {
17+
fn get(&self) -> &'self T {
18+
match self.next {
19+
Some(ref next) => next.get(),
20+
None => &self.val
21+
}
22+
}
23+
}
24+
25+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2013 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 main() {
12+
let stdout = &io::stdout() as &io::WriterUtil;
13+
stdout.write_line("Hello!");
14+
}

0 commit comments

Comments
 (0)