Skip to content

Commit 9e75db6

Browse files
committed
---
yaml --- r: 205816 b: refs/heads/beta c: 1131bc0 h: refs/heads/master v: v3
1 parent 2fd8e13 commit 9e75db6

File tree

8 files changed

+80
-9
lines changed

8 files changed

+80
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2929
refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3030
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3131
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
32-
refs/heads/beta: 3860240b0e124f38483ea4bd070b61d362871ece
32+
refs/heads/beta: 1131bc0a0f9d4ce920f239dccbd0fcfe1c940548
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3535
refs/heads/tmp: 579e31929feff51dcaf8d444648eff8de735f91a

branches/beta/src/liblibc/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3296,6 +3296,8 @@ pub mod consts {
32963296
pub const F_GETFL : c_int = 3;
32973297
pub const F_SETFL : c_int = 4;
32983298

3299+
pub const O_ACCMODE : c_int = 3;
3300+
32993301
pub const SIGTRAP : c_int = 5;
33003302
pub const SIG_IGN: size_t = 1;
33013303

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ impl<'a> Annotator<'a> {
9595
let tag = attr.name();
9696
if tag == "unstable" || tag == "stable" || tag == "deprecated" {
9797
attr::mark_used(attr);
98-
self.sess.span_err(attr.span(),
99-
"stability attributes may not be used outside \
100-
of the standard library");
98+
self.sess.span_warn(attr.span(),
99+
"stability attributes are deprecated \
100+
and will soon become errors");
101101
}
102102
}
103103
f(self);

branches/beta/src/librustc_data_structures/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,11 @@
2222
#![unstable(feature = "rustc_private")]
2323
#![crate_type = "dylib"]
2424
#![crate_type = "rlib"]
25-
#![staged_api]
2625
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2726
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2827
html_root_url = "http://doc.rust-lang.org/nightly/")]
2928

30-
#![feature(rustc_private, staged_api)]
29+
#![feature(rustc_private)]
3130
#![cfg_attr(test, feature(test))]
3231

3332
#[macro_use] extern crate log;

branches/beta/src/libstd/fs.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
use core::prelude::*;
2121

22+
use fmt;
2223
use io::{self, Error, ErrorKind, SeekFrom, Seek, Read, Write};
2324
use path::{Path, PathBuf};
2425
use sys::fs2 as fs_imp;
@@ -305,6 +306,12 @@ impl FromInner<fs_imp::File> for File {
305306
}
306307
}
307308

309+
impl fmt::Debug for File {
310+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
311+
self.inner.fmt(f)
312+
}
313+
}
314+
308315
#[stable(feature = "rust1", since = "1.0.0")]
309316
impl Read for File {
310317
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {

branches/beta/src/libstd/sys/unix/fs2.rs

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use io::prelude::*;
1313
use os::unix::prelude::*;
1414

1515
use ffi::{CString, CStr, OsString, OsStr};
16+
use fmt;
1617
use io::{self, Error, SeekFrom};
1718
use libc::{self, c_int, size_t, off_t, c_char, mode_t};
1819
use mem;
@@ -294,6 +295,54 @@ impl FromInner<c_int> for File {
294295
}
295296
}
296297

298+
impl fmt::Debug for File {
299+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
300+
#[cfg(target_os = "linux")]
301+
fn get_path(fd: c_int) -> Option<PathBuf> {
302+
use string::ToString;
303+
let mut p = PathBuf::from("/proc/self/fd");
304+
p.push(&fd.to_string());
305+
readlink(&p).ok()
306+
}
307+
308+
#[cfg(not(target_os = "linux"))]
309+
fn get_path(_fd: c_int) -> Option<PathBuf> {
310+
// FIXME(#24570): implement this for other Unix platforms
311+
None
312+
}
313+
314+
#[cfg(target_os = "linux")]
315+
fn get_mode(fd: c_int) -> Option<(bool, bool)> {
316+
let mode = unsafe { libc::fcntl(fd, libc::F_GETFL) };
317+
if mode == -1 {
318+
return None;
319+
}
320+
match mode & libc::O_ACCMODE {
321+
libc::O_RDONLY => Some((true, false)),
322+
libc::O_RDWR => Some((true, true)),
323+
libc::O_WRONLY => Some((false, true)),
324+
_ => None
325+
}
326+
}
327+
328+
#[cfg(not(target_os = "linux"))]
329+
fn get_mode(_fd: c_int) -> Option<(bool, bool)> {
330+
// FIXME(#24570): implement this for other Unix platforms
331+
None
332+
}
333+
334+
let fd = self.0.raw();
335+
let mut b = f.debug_struct("File").field("fd", &fd);
336+
if let Some(path) = get_path(fd) {
337+
b = b.field("path", &path);
338+
}
339+
if let Some((read, write)) = get_mode(fd) {
340+
b = b.field("read", &read).field("write", &write);
341+
}
342+
b.finish()
343+
}
344+
}
345+
297346
pub fn mkdir(p: &Path) -> io::Result<()> {
298347
let p = try!(cstr(p));
299348
try!(cvt(unsafe { libc::mkdir(p.as_ptr(), 0o777) }));

branches/beta/src/libstd/sys/windows/fs2.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use os::windows::prelude::*;
1414

1515
use default::Default;
1616
use ffi::{OsString, AsOsStr};
17+
use fmt;
1718
use io::{self, Error, SeekFrom};
1819
use libc::{self, HANDLE};
1920
use mem;
@@ -271,6 +272,15 @@ impl FromInner<libc::HANDLE> for File {
271272
}
272273
}
273274

275+
impl fmt::Debug for File {
276+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
277+
// FIXME(#24570): add more info here (e.g. path, mode)
278+
f.debug_struct("File")
279+
.field("handle", &self.handle.raw())
280+
.finish()
281+
}
282+
}
283+
274284
pub fn to_utf16(s: &Path) -> Vec<u16> {
275285
s.as_os_str().encode_wide().chain(Some(0).into_iter()).collect()
276286
}

branches/beta/src/test/compile-fail/stability-attribute-non-staged.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#[unstable] //~ ERROR: stability attributes may not be used
12-
#[stable] //~ ERROR: stability attributes may not be used
13-
#[deprecated] //~ ERROR: stability attributes may not be used
11+
// These two generate an error to satisfy the compile-fail test
12+
#![deny(warnings)]
13+
#![feature(blah)] //~ ERROR
14+
15+
#[unstable] //~ WARNING: stability attributes are deprecated
16+
#[stable] //~ WARNING: stability attributes are deprecated
17+
#[deprecated] //~ WARNING: stability attributes are deprecated
1418
fn main() { }

0 commit comments

Comments
 (0)