Skip to content

Commit 0fd4e22

Browse files
committed
---
yaml --- r: 134121 b: refs/heads/master c: d80cd3d h: refs/heads/master i: 134119: 62b0554 v: v3
1 parent 1b45b58 commit 0fd4e22

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+175
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5376b1c79870c80d0081540c72ae060d3ed5d1f5
2+
refs/heads/master: d80cd3d9bc46c326b67fe48497c9ae7b322179ba
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 437179ed8bf7f7672f84b19265df1ce569e70490
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d

trunk/src/doc/intro.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,7 @@ Here's some code:
300300
use std::sync::Arc;
301301
302302
fn main() {
303-
let numbers = vec![1i, 2i, 3i];
304-
let numbers = Arc::new(numbers);
303+
let numbers = Arc::new(vec![1i, 2i, 3i]);
305304
306305
for num in range(0u, 3) {
307306
let (tx, rx) = channel();
@@ -346,8 +345,7 @@ and modify it to mutate the shared state:
346345
use std::sync::{Arc, Mutex};
347346
348347
fn main() {
349-
let numbers = vec![1i, 2i, 3i];
350-
let numbers_lock = Arc::new(Mutex::new(numbers));
348+
let numbers_lock = Arc::new(Mutex::new(vec![1i, 2i, 3i]));
351349
352350
for num in range(0u, 3) {
353351
let (tx, rx) = channel();

trunk/src/libcore/any.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub enum Void { }
9494
pub trait Any: AnyPrivate {}
9595

9696
/// An inner trait to ensure that only this module can call `get_type_id()`.
97-
trait AnyPrivate {
97+
pub trait AnyPrivate {
9898
/// Get the `TypeId` of `self`
9999
fn get_type_id(&self) -> TypeId;
100100
}

trunk/src/libcore/clone.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ the `clone` method.
2525

2626
/// A common trait for cloning an object.
2727
pub trait Clone {
28-
/// Returns a copy of the value. The contents of owned pointers
29-
/// are copied to maintain uniqueness, while the contents of
30-
/// managed pointers are not copied.
28+
/// Returns a copy of the value.
3129
fn clone(&self) -> Self;
3230

3331
/// Perform copy-assignment from `source`.

trunk/src/libcore/iter.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2178,7 +2178,6 @@ pub type Iterate<'a, T> = Unfold<'a, T, IterateState<'a, T>>;
21782178

21792179
/// Creates a new iterator that produces an infinite sequence of
21802180
/// repeated applications of the given function `f`.
2181-
#[allow(visible_private_types)]
21822181
pub fn iterate<'a, T: Clone>(seed: T, f: |T|: 'a -> T) -> Iterate<'a, T> {
21832182
Unfold::new((f, Some(seed), true), |st| {
21842183
let &(ref mut f, ref mut val, ref mut first) = st;

trunk/src/libdebug/repr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ macro_rules! try( ($me:expr, $e:expr) => (
3232

3333
/// Representations
3434
35-
trait Repr {
35+
pub trait Repr {
3636
fn write_repr(&self, writer: &mut io::Writer) -> io::IoResult<()>;
3737
}
3838

trunk/src/libgreen/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218

219219
// NB this does *not* include globs, please keep it that way.
220220
#![feature(macro_rules, phase, default_type_params)]
221-
#![allow(visible_private_types, deprecated)]
221+
#![allow(deprecated)]
222222

223223
#[cfg(test)] #[phase(plugin, link)] extern crate log;
224224
#[cfg(test)] extern crate rustuv;
@@ -385,7 +385,7 @@ pub struct SchedPool {
385385
/// keep track of how many tasks are currently running in the pool and then
386386
/// sending on a channel once the entire pool has been drained of all tasks.
387387
#[deriving(Clone)]
388-
struct TaskState {
388+
pub struct TaskState {
389389
cnt: Arc<AtomicUint>,
390390
done: Sender<()>,
391391
}

trunk/src/libnative/io/timer_unix.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@ pub struct Timer {
6666
inner: Option<Box<Inner>>,
6767
}
6868

69-
struct Inner {
69+
pub struct Inner {
7070
cb: Option<Box<rtio::Callback + Send>>,
7171
interval: u64,
7272
repeat: bool,
7373
target: u64,
7474
id: uint,
7575
}
7676

77-
#[allow(visible_private_types)]
7877
pub enum Req {
7978
// Add a new timer to the helper thread.
8079
NewTimer(Box<Inner>),

trunk/src/libregex/compile.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// Enable this to squash warnings due to exporting pieces of the representation
1212
// for use with the regex! macro. See lib.rs for explanation.
13-
#![allow(visible_private_types)]
1413

1514
use std::cmp;
1615
use parse;

trunk/src/libregex/re.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ pub fn is_match(regex: &str, text: &str) -> Result<bool, parse::Error> {
102102
/// More details about the `regex!` macro can be found in the `regex` crate
103103
/// documentation.
104104
#[deriving(Clone)]
105-
#[allow(visible_private_types)]
106105
pub enum Regex {
107106
// The representation of `Regex` is exported to support the `regex!`
108107
// syntax extension. Do not rely on it.
@@ -516,7 +515,6 @@ impl Regex {
516515
}
517516

518517
#[doc(hidden)]
519-
#[allow(visible_private_types)]
520518
#[experimental]
521519
pub fn names_iter<'a>(&'a self) -> NamesIter<'a> {
522520
match *self {
@@ -534,7 +532,7 @@ impl Regex {
534532

535533
}
536534

537-
enum NamesIter<'a> {
535+
pub enum NamesIter<'a> {
538536
NamesIterNative(::std::slice::Items<'a, Option<&'static str>>),
539537
NamesIterDynamic(::std::slice::Items<'a, Option<String>>)
540538
}

trunk/src/librustc/driver/driver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,8 @@ pub fn phase_6_link_output(sess: &Session,
560560
trans: &CrateTranslation,
561561
outputs: &OutputFilenames) {
562562
let old_path = os::getenv("PATH").unwrap_or_else(||String::new());
563-
let mut new_path = sess.host_filesearch().get_tools_search_paths();
564-
new_path.push_all_move(os::split_paths(old_path.as_slice()));
563+
let mut new_path = os::split_paths(old_path.as_slice());
564+
new_path.push_all_move(sess.host_filesearch().get_tools_search_paths());
565565
os::setenv("PATH", os::join_paths(new_path.as_slice()).unwrap());
566566

567567
time(sess.time_passes(), "linking", (), |_|

trunk/src/librustc/lint/builtin.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,9 +1601,6 @@ declare_lint!(pub DEAD_ASSIGNMENT, Warn,
16011601
declare_lint!(pub DEAD_CODE, Warn,
16021602
"detect piece of code that will never be used")
16031603

1604-
declare_lint!(pub VISIBLE_PRIVATE_TYPES, Warn,
1605-
"detect use of private types in exported type signatures")
1606-
16071604
declare_lint!(pub UNREACHABLE_CODE, Warn,
16081605
"detects unreachable code")
16091606

@@ -1636,7 +1633,6 @@ impl LintPass for HardwiredLints {
16361633
UNUSED_VARIABLE,
16371634
DEAD_ASSIGNMENT,
16381635
DEAD_CODE,
1639-
VISIBLE_PRIVATE_TYPES,
16401636
UNREACHABLE_CODE,
16411637
WARNINGS,
16421638
UNKNOWN_FEATURES,

trunk/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ pub fn deref_kind(tcx: &ty::ctxt, t: ty::t) -> deref_kind {
224224
}
225225
}
226226

227-
trait ast_node {
227+
pub trait ast_node {
228228
fn id(&self) -> ast::NodeId;
229229
fn span(&self) -> Span;
230230
}

trunk/src/librustc/middle/privacy.rs

Lines changed: 52 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::mem::replace;
1616

1717
use metadata::csearch;
1818
use middle::def;
19-
use lint;
2019
use middle::resolve;
2120
use middle::ty;
2221
use middle::typeck::{MethodCall, MethodMap, MethodOrigin, MethodParam, MethodTypeParam};
@@ -1289,19 +1288,38 @@ impl<'a, 'tcx> VisiblePrivateTypesVisitor<'a, 'tcx> {
12891288
};
12901289
// A path can only be private if:
12911290
// it's in this crate...
1292-
is_local(did) &&
1293-
// ... it's not exported (obviously) ...
1294-
!self.exported_items.contains(&did.node) &&
1295-
// .. and it corresponds to a type in the AST (this returns None for
1296-
// type parameters)
1297-
self.tcx.map.find(did.node).is_some()
1291+
if !is_local(did) {
1292+
return false
1293+
}
1294+
// .. and it corresponds to a private type in the AST (this returns
1295+
// None for type parameters)
1296+
match self.tcx.map.find(did.node) {
1297+
Some(ast_map::NodeItem(ref item)) => item.vis != ast::Public,
1298+
Some(_) | None => false,
1299+
}
12981300
}
12991301

13001302
fn trait_is_public(&self, trait_id: ast::NodeId) -> bool {
13011303
// FIXME: this would preferably be using `exported_items`, but all
13021304
// traits are exported currently (see `EmbargoVisitor.exported_trait`)
13031305
self.public_items.contains(&trait_id)
13041306
}
1307+
1308+
fn check_ty_param_bound(&self,
1309+
span: Span,
1310+
ty_param_bound: &ast::TyParamBound) {
1311+
match *ty_param_bound {
1312+
ast::TraitTyParamBound(ref trait_ref) => {
1313+
if !self.tcx.sess.features.borrow().visible_private_types &&
1314+
self.path_is_private_type(trait_ref.ref_id) {
1315+
self.tcx.sess.span_err(span,
1316+
"private type in exported type \
1317+
parameter bound");
1318+
}
1319+
}
1320+
_ => {}
1321+
}
1322+
}
13051323
}
13061324

13071325
impl<'a, 'b, 'tcx, 'v> Visitor<'v> for CheckTypeForPrivatenessVisitor<'a, 'b, 'tcx> {
@@ -1338,7 +1356,15 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
13381356
// namespace (the contents have their own privacies).
13391357
ast::ItemForeignMod(_) => {}
13401358

1341-
ast::ItemTrait(..) if !self.trait_is_public(item.id) => return,
1359+
ast::ItemTrait(_, _, ref bounds, _) => {
1360+
if !self.trait_is_public(item.id) {
1361+
return
1362+
}
1363+
1364+
for bound in bounds.iter() {
1365+
self.check_ty_param_bound(item.span, bound)
1366+
}
1367+
}
13421368

13431369
// impls need some special handling to try to offer useful
13441370
// error messages without (too many) false positives
@@ -1471,6 +1497,19 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
14711497
visit::walk_item(self, item);
14721498
}
14731499

1500+
fn visit_generics(&mut self, generics: &ast::Generics) {
1501+
for ty_param in generics.ty_params.iter() {
1502+
for bound in ty_param.bounds.iter() {
1503+
self.check_ty_param_bound(ty_param.span, bound)
1504+
}
1505+
}
1506+
for predicate in generics.where_clause.predicates.iter() {
1507+
for bound in predicate.bounds.iter() {
1508+
self.check_ty_param_bound(predicate.span, bound)
1509+
}
1510+
}
1511+
}
1512+
14741513
fn visit_foreign_item(&mut self, item: &ast::ForeignItem) {
14751514
if self.exported_items.contains(&item.id) {
14761515
visit::walk_foreign_item(self, item)
@@ -1488,12 +1527,11 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> {
14881527
fn visit_ty(&mut self, t: &ast::Ty) {
14891528
match t.node {
14901529
ast::TyPath(ref p, _, path_id) => {
1491-
if self.path_is_private_type(path_id) {
1492-
self.tcx.sess.add_lint(
1493-
lint::builtin::VISIBLE_PRIVATE_TYPES,
1494-
path_id, p.span,
1495-
"private type in exported type \
1496-
signature".to_string());
1530+
if !self.tcx.sess.features.borrow().visible_private_types &&
1531+
self.path_is_private_type(path_id) {
1532+
self.tcx.sess.span_err(p.span,
1533+
"private type in exported type \
1534+
signature");
14971535
}
14981536
}
14991537
_ => {}

trunk/src/librustc/middle/typeck/infer/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1646,7 +1646,7 @@ impl<'a, 'tcx> ErrorReportingHelpers for InferCtxt<'a, 'tcx> {
16461646
}
16471647
}
16481648

1649-
trait Resolvable {
1649+
pub trait Resolvable {
16501650
fn resolve(&self, infcx: &InferCtxt) -> Self;
16511651
fn contains_error(&self) -> bool;
16521652
}

trunk/src/librustc_llvm/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub enum AttributeSet {
153153
FunctionIndex = !0
154154
}
155155

156-
trait AttrHelper {
156+
pub trait AttrHelper {
157157
fn apply_llfn(&self, idx: c_uint, llfn: ValueRef);
158158
fn apply_callsite(&self, idx: c_uint, callsite: ValueRef);
159159
}

trunk/src/librustrt/local.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ pub trait Local<Borrowed> {
2626
unsafe fn try_unsafe_borrow() -> Option<*mut Self>;
2727
}
2828

29-
#[allow(visible_private_types)]
3029
impl Local<local_ptr::Borrowed<Task>> for Task {
3130
#[inline]
3231
fn put(value: Box<Task>) { unsafe { local_ptr::put(value) } }

trunk/src/librustrt/local_ptr.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,6 @@ pub mod native {
374374

375375
#[inline]
376376
#[cfg(not(test))]
377-
#[allow(visible_private_types)]
378377
pub fn maybe_tls_key() -> Option<tls::Key> {
379378
unsafe {
380379
// NB: This is a little racy because, while the key is

trunk/src/librustrt/unwind.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ fn rust_exception_class() -> uw::_Unwind_Exception_Class {
237237

238238
#[cfg(not(target_arch = "arm"), not(windows, target_arch = "x86_64"), not(test))]
239239
#[doc(hidden)]
240-
#[allow(visible_private_types)]
241240
pub mod eabi {
242241
use libunwind as uw;
243242
use libc::c_int;
@@ -291,7 +290,6 @@ pub mod eabi {
291290

292291
#[cfg(target_os = "ios", target_arch = "arm", not(test))]
293292
#[doc(hidden)]
294-
#[allow(visible_private_types)]
295293
pub mod eabi {
296294
use libunwind as uw;
297295
use libc::c_int;
@@ -347,7 +345,6 @@ pub mod eabi {
347345
// but otherwise works the same.
348346
#[cfg(target_arch = "arm", not(target_os = "ios"), not(test))]
349347
#[doc(hidden)]
350-
#[allow(visible_private_types)]
351348
pub mod eabi {
352349
use libunwind as uw;
353350
use libc::c_int;
@@ -397,21 +394,20 @@ pub mod eabi {
397394

398395
#[cfg(windows, target_arch = "x86_64", not(test))]
399396
#[doc(hidden)]
400-
#[allow(visible_private_types)]
401397
#[allow(non_camel_case_types, non_snake_case)]
402398
pub mod eabi {
403399
use libunwind as uw;
404400
use libc::{c_void, c_int};
405401

406402
#[repr(C)]
407-
struct EXCEPTION_RECORD;
403+
pub struct EXCEPTION_RECORD;
408404
#[repr(C)]
409-
struct CONTEXT;
405+
pub struct CONTEXT;
410406
#[repr(C)]
411-
struct DISPATCHER_CONTEXT;
407+
pub struct DISPATCHER_CONTEXT;
412408

413409
#[repr(C)]
414-
enum EXCEPTION_DISPOSITION {
410+
pub enum EXCEPTION_DISPOSITION {
415411
ExceptionContinueExecution,
416412
ExceptionContinueSearch,
417413
ExceptionNestedException,

trunk/src/librustuv/addrinfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use net;
1919
use super::{Loop, UvError, Request, wait_until_woken_after, wakeup};
2020
use uvll;
2121

22-
struct Addrinfo {
22+
pub struct Addrinfo {
2323
handle: *const libc::addrinfo,
2424
}
2525

trunk/src/librustuv/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ via `close` and `delete` methods.
4646

4747
#![feature(macro_rules, unsafe_destructor)]
4848
#![deny(unused_result, unused_must_use)]
49-
#![allow(visible_private_types)]
5049

5150
#![reexport_test_harness_main = "test_main"]
5251

0 commit comments

Comments
 (0)