Skip to content

Commit a4da312

Browse files
committed
---
yaml --- r: 93813 b: refs/heads/try c: 09ed791 h: refs/heads/master i: 93811: cbab89d v: v3
1 parent af9a88c commit a4da312

File tree

15 files changed

+547
-405
lines changed

15 files changed

+547
-405
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 861e6f5cd26b4a568d64d78ec85f3e67ab2eea7b
5+
refs/heads/try: 09ed7913e43cf0234a1bbe3f29dcd52c6a166961
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/tutorial.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1320,7 +1320,8 @@ let z = x; // this moves `x` into `z`, rather than creating a new owner
13201320

13211321
assert_eq!(*z.borrow(), [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
13221322

1323-
let mut a = Rc::new([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]); // the variable is mutable, but not the box
1323+
// the variable is mutable, but not the contents of the box
1324+
let mut a = Rc::new([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);
13241325
a = z;
13251326
~~~
13261327

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,9 @@ impl Visitor<()> for Context {
141141
},
142142
ast::ty_box(_) => {
143143
self.gate_feature("managed_boxes", t.span,
144-
"The managed box syntax will be replaced \
145-
by a library type, and a garbage \
146-
collector is not yet implemented. \
147-
Consider using the `std::rc::Rc` type \
148-
for reference counted pointers.");
144+
"The managed box syntax is being replaced by the `std::gc::Gc`
145+
and `std::rc::Rc` types. Equivalent functionality to managed
146+
trait objects will be implemented but is currently missing.");
149147
}
150148
_ => {}
151149
}

branches/try/src/librustc/middle/privacy.rs

Lines changed: 397 additions & 356 deletions
Large diffs are not rendered by default.

branches/try/src/librustc/middle/reachable.rs

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use middle::privacy;
2222
use std::hashmap::HashSet;
2323
use syntax::ast;
2424
use syntax::ast_map;
25-
use syntax::ast_util::{def_id_of_def, is_local, local_def};
25+
use syntax::ast_util::{def_id_of_def, is_local};
2626
use syntax::attr;
2727
use syntax::parse::token;
2828
use syntax::visit::Visitor;
@@ -310,47 +310,13 @@ impl ReachableContext {
310310
}
311311
}
312312

313-
// Implementations of exported structs/enums need to get
314-
// added to the worklist (as all their methods should be
315-
// accessible)
316-
ast::item_struct(*) | ast::item_enum(*) => {
317-
let def = local_def(item.id);
318-
let impls = match self.tcx.inherent_impls.find(&def) {
319-
Some(&impls) => impls,
320-
None => return
321-
};
322-
for imp in impls.iter() {
323-
if is_local(imp.did) {
324-
self.worklist.push(imp.did.node);
325-
}
326-
}
327-
}
328-
329-
// Propagate through this impl
330-
ast::item_impl(_, _, _, ref methods) => {
331-
for method in methods.iter() {
332-
self.worklist.push(method.id);
333-
}
334-
}
335-
336-
// Default methods of exported traits need to all be
337-
// accessible.
338-
ast::item_trait(_, _, ref methods) => {
339-
for method in methods.iter() {
340-
match *method {
341-
ast::required(*) => {}
342-
ast::provided(ref method) => {
343-
self.worklist.push(method.id);
344-
}
345-
}
346-
}
347-
}
348-
349313
// These are normal, nothing reachable about these
350314
// inherently and their children are already in the
351-
// worklist
315+
// worklist, as determined by the privacy pass
352316
ast::item_static(*) | ast::item_ty(*) |
353-
ast::item_mod(*) | ast::item_foreign_mod(*) => {}
317+
ast::item_mod(*) | ast::item_foreign_mod(*) |
318+
ast::item_impl(*) | ast::item_trait(*) |
319+
ast::item_struct(*) | ast::item_enum(*) => {}
354320

355321
_ => {
356322
self.tcx.sess.span_bug(item.span,

branches/try/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2759,6 +2759,7 @@ pub fn declare_intrinsics(llmod: ModuleRef) -> HashMap<&'static str, ValueRef> {
27592759
[i8p, Type::i8(), Type::i64(), Type::i32(), Type::i1()], Type::void());
27602760

27612761
ifn!(intrinsics, "llvm.trap", [], Type::void());
2762+
ifn!(intrinsics, "llvm.debugtrap", [], Type::void());
27622763
ifn!(intrinsics, "llvm.frameaddress", [Type::i32()], i8p);
27632764

27642765
ifn!(intrinsics, "llvm.powi.f32", [Type::f32(), Type::i32()], Type::f32());

branches/try/src/librustc/middle/trans/intrinsic.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
228228
Call(bcx, llfn, [], []);
229229
Unreachable(bcx);
230230
}
231+
"breakpoint" => {
232+
let llfn = bcx.ccx().intrinsics.get_copy(&("llvm.debugtrap"));
233+
Call(bcx, llfn, [], []);
234+
RetVoid(bcx);
235+
}
231236
"size_of" => {
232237
let tp_ty = substs.tys[0];
233238
let lltp_ty = type_of::type_of(ccx, tp_ty);

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3968,7 +3968,8 @@ pub fn check_intrinsic_type(ccx: @mut CrateCtxt, it: @ast::foreign_item) {
39683968

39693969
} else {
39703970
match name {
3971-
"abort" => (0, ~[], ty::mk_bot()),
3971+
"abort" => (0, ~[], ty::mk_bot()),
3972+
"breakpoint" => (0, ~[], ty::mk_nil()),
39723973
"size_of" |
39733974
"pref_align_of" | "min_align_of" => (1u, ~[], ty::mk_uint()),
39743975
"init" => (1u, ~[], param(ccx, 0u)),

branches/try/src/libstd/unstable/intrinsics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ extern "rust-intrinsic" {
176176
/// Abort the execution of the process.
177177
pub fn abort() -> !;
178178

179+
/// Execute a breakpoint trap, for inspection by a debugger.
180+
#[cfg(not(stage0))]
181+
pub fn breakpoint();
182+
179183
/// Atomic compare and exchange, sequentially consistent.
180184
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
181185
/// Atomic compare and exchange, acquire ordering.

branches/try/src/libstd/vec.rs

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3862,10 +3862,10 @@ mod bench {
38623862
}
38633863

38643864
#[bench]
3865-
fn add(b: &mut BenchHarness) {
3865+
fn add(bh: &mut BenchHarness) {
38663866
let xs: &[int] = [5, ..10];
38673867
let ys: &[int] = [5, ..10];
3868-
do b.iter() {
3868+
do bh.iter() {
38693869
xs + ys;
38703870
}
38713871
}
@@ -3885,4 +3885,72 @@ mod bench {
38853885
xss.connect_vec(&0);
38863886
}
38873887
}
3888+
3889+
#[bench]
3890+
fn push(bh: &mut BenchHarness) {
3891+
let mut vec: ~[uint] = ~[0u];
3892+
do bh.iter() {
3893+
vec.push(0);
3894+
}
3895+
}
3896+
3897+
#[bench]
3898+
fn starts_with_same_vector(bh: &mut BenchHarness) {
3899+
let vec: ~[uint] = vec::from_fn(100, |i| i);
3900+
do bh.iter() {
3901+
vec.starts_with(vec);
3902+
}
3903+
}
3904+
3905+
#[bench]
3906+
fn starts_with_single_element(bh: &mut BenchHarness) {
3907+
let vec: ~[uint] = ~[0u];
3908+
do bh.iter() {
3909+
vec.starts_with(vec);
3910+
}
3911+
}
3912+
3913+
#[bench]
3914+
fn starts_with_diff_one_element_at_end(bh: &mut BenchHarness) {
3915+
let vec: ~[uint] = vec::from_fn(100, |i| i);
3916+
let mut match_vec: ~[uint] = vec::from_fn(99, |i| i);
3917+
match_vec.push(0);
3918+
do bh.iter() {
3919+
vec.starts_with(match_vec);
3920+
}
3921+
}
3922+
3923+
#[bench]
3924+
fn ends_with_same_vector(bh: &mut BenchHarness) {
3925+
let vec: ~[uint] = vec::from_fn(100, |i| i);
3926+
do bh.iter() {
3927+
vec.ends_with(vec);
3928+
}
3929+
}
3930+
3931+
#[bench]
3932+
fn ends_with_single_element(bh: &mut BenchHarness) {
3933+
let vec: ~[uint] = ~[0u];
3934+
do bh.iter() {
3935+
vec.ends_with(vec);
3936+
}
3937+
}
3938+
3939+
#[bench]
3940+
fn ends_with_diff_one_element_at_beginning(bh: &mut BenchHarness) {
3941+
let vec: ~[uint] = vec::from_fn(100, |i| i);
3942+
let mut match_vec: ~[uint] = vec::from_fn(100, |i| i);
3943+
match_vec[0] = 200;
3944+
do bh.iter() {
3945+
vec.starts_with(match_vec);
3946+
}
3947+
}
3948+
3949+
#[bench]
3950+
fn contains_last_element(bh: &mut BenchHarness) {
3951+
let vec: ~[uint] = vec::from_fn(100, |i| i);
3952+
do bh.iter() {
3953+
vec.contains(&99u);
3954+
}
3955+
}
38883956
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
pub use bar = foo;
12+
13+
mod foo {
14+
pub fn frob() {}
15+
}

branches/try/src/test/compile-fail/lint-missing-doc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ pub trait C { //~ ERROR: missing documentation
5757
#[allow(missing_doc)] pub trait D {}
5858

5959
impl Foo {
60+
pub fn foo() {}
61+
fn bar() {}
62+
}
63+
64+
impl PubFoo {
6065
pub fn foo() {} //~ ERROR: missing documentation
6166
/// dox
6267
pub fn foo1() {}

branches/try/src/test/compile-fail/lint-unsafe-block.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,20 @@
1010

1111
#[allow(unused_unsafe)];
1212
#[deny(unsafe_block)];
13+
#[feature(macro_rules)];
1314

1415
unsafe fn allowed() {}
1516

1617
#[allow(unsafe_block)] fn also_allowed() { unsafe {} }
1718

19+
macro_rules! unsafe_in_macro {
20+
() => {
21+
unsafe {} //~ ERROR: usage of an `unsafe` block
22+
}
23+
}
24+
1825
fn main() {
1926
unsafe {} //~ ERROR: usage of an `unsafe` block
27+
28+
unsafe_in_macro!()
2029
}

branches/try/src/test/compile-fail/privacy1.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ mod bar {
3131
fn bar2(&self) {}
3232
}
3333

34+
trait B {
35+
fn foo() -> Self;
36+
}
37+
38+
impl B for int { fn foo() -> int { 3 } }
39+
3440
pub enum Enum {
3541
priv Priv,
3642
Pub
@@ -108,6 +114,10 @@ mod foo {
108114
::bar::baz::A.bar2(); //~ ERROR: struct `A` is inaccessible
109115
//~^ ERROR: method `bar2` is private
110116
//~^^ NOTE: module `baz` is private
117+
118+
let _: int =
119+
::bar::B::foo(); //~ ERROR: method `foo` is inaccessible
120+
//~^ NOTE: trait `B` is private
111121
::lol();
112122

113123
::bar::Priv; //~ ERROR: variant `Priv` is private
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
// xfail-fast
12+
// aux-build:privacy_reexport.rs
13+
14+
extern mod privacy_reexport;
15+
16+
fn main() {
17+
privacy_reexport::bar::frob();
18+
}

0 commit comments

Comments
 (0)