Skip to content

Commit 9ccaf30

Browse files
committed
---
yaml --- r: 219483 b: refs/heads/snap-stage3 c: 8193133 h: refs/heads/master i: 219481: 0119301 219479: 25a1ba6 v: v3
1 parent 60f6354 commit 9ccaf30

File tree

9 files changed

+35
-109
lines changed

9 files changed

+35
-109
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: dedd4302d190f5a232e75e2b808a4b86ae323678
3+
refs/heads/snap-stage3: 8193133f3548390559936fdaf377f5ef951ffd29
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/src/doc/trpl/ffi.md

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -530,37 +530,3 @@ The `extern` makes this function adhere to the C calling convention, as
530530
discussed above in "[Foreign Calling
531531
Conventions](ffi.html#foreign-calling-conventions)". The `no_mangle`
532532
attribute turns off Rust's name mangling, so that it is easier to link to.
533-
534-
# FFI and panics
535-
536-
It’s important to be mindful of `panic!`s when working with FFI. This code,
537-
when called from C, will `abort`:
538-
539-
```rust
540-
#[no_mangle]
541-
pub extern fn oh_no() -> ! {
542-
panic!("Oops!");
543-
}
544-
# fn main() {}
545-
```
546-
547-
If you’re writing code that may panic, you should run it in another thread,
548-
so that the panic doesn’t bubble up to C:
549-
550-
```rust
551-
use std::thread;
552-
553-
#[no_mangle]
554-
pub extern fn oh_no() -> i32 {
555-
let h = thread::spawn(|| {
556-
panic!("Oops!");
557-
});
558-
559-
match h.join() {
560-
Ok(_) => 1,
561-
Err(_) => 0,
562-
}
563-
}
564-
# fn main() {}
565-
```
566-

branches/snap-stage3/src/libcore/num/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1372,13 +1372,14 @@ macro_rules! from_str_float_impl {
13721372
/// This function accepts strings such as
13731373
///
13741374
/// * '3.14'
1375+
/// * '+3.14', equivalent to '3.14'
13751376
/// * '-3.14'
13761377
/// * '2.5E10', or equivalently, '2.5e10'
13771378
/// * '2.5E-10'
13781379
/// * '.' (understood as 0)
13791380
/// * '5.'
13801381
/// * '.5', or, equivalently, '0.5'
1381-
/// * 'inf', '-inf', 'NaN'
1382+
/// * '+inf', 'inf', '-inf', 'NaN'
13821383
///
13831384
/// Leading and trailing whitespace represent an error.
13841385
///

branches/snap-stage3/src/liblibc/lib.rs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5493,17 +5493,17 @@ pub mod funcs {
54935493
pub fn dup2(src: c_int, dst: c_int) -> c_int;
54945494
#[link_name = "_execv"]
54955495
pub fn execv(prog: *const c_char,
5496-
argv: *const *const c_char) -> intptr_t;
5496+
argv: *mut *const c_char) -> intptr_t;
54975497
#[link_name = "_execve"]
5498-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5499-
envp: *const *const c_char)
5498+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5499+
envp: *mut *const c_char)
55005500
-> c_int;
55015501
#[link_name = "_execvp"]
55025502
pub fn execvp(c: *const c_char,
5503-
argv: *const *const c_char) -> c_int;
5503+
argv: *mut *const c_char) -> c_int;
55045504
#[link_name = "_execvpe"]
5505-
pub fn execvpe(c: *const c_char, argv: *const *const c_char,
5506-
envp: *const *const c_char) -> c_int;
5505+
pub fn execvpe(c: *const c_char, argv: *mut *const c_char,
5506+
envp: *mut *const c_char) -> c_int;
55075507
#[link_name = "_getcwd"]
55085508
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
55095509
#[link_name = "_getpid"]
@@ -5687,12 +5687,12 @@ pub mod funcs {
56875687
pub fn dup(fd: c_int) -> c_int;
56885688
pub fn dup2(src: c_int, dst: c_int) -> c_int;
56895689
pub fn execv(prog: *const c_char,
5690-
argv: *const *const c_char) -> c_int;
5691-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5692-
envp: *const *const c_char)
5690+
argv: *mut *const c_char) -> c_int;
5691+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5692+
envp: *mut *const c_char)
56935693
-> c_int;
56945694
pub fn execvp(c: *const c_char,
5695-
argv: *const *const c_char) -> c_int;
5695+
argv: *mut *const c_char) -> c_int;
56965696
pub fn fork() -> pid_t;
56975697
pub fn fpathconf(filedes: c_int, name: c_int) -> c_long;
56985698
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
@@ -5702,9 +5702,7 @@ pub mod funcs {
57025702
pub fn getgroups(ngroups_max: c_int, groups: *mut gid_t)
57035703
-> c_int;
57045704
pub fn getlogin() -> *mut c_char;
5705-
// GNU getopt(3) modifies its arguments despite the
5706-
// char * const [] prototype; see the manpage.
5707-
pub fn getopt(argc: c_int, argv: *mut *mut c_char,
5705+
pub fn getopt(argc: c_int, argv: *mut *const c_char,
57085706
optstr: *const c_char) -> c_int;
57095707
pub fn getpgrp() -> pid_t;
57105708
pub fn getpid() -> pid_t;
@@ -5754,19 +5752,19 @@ pub mod funcs {
57545752
pub fn dup(fd: c_int) -> c_int;
57555753
pub fn dup2(src: c_int, dst: c_int) -> c_int;
57565754
pub fn execv(prog: *const c_char,
5757-
argv: *const *const c_char) -> c_int;
5758-
pub fn execve(prog: *const c_char, argv: *const *const c_char,
5759-
envp: *const *const c_char)
5755+
argv: *mut *const c_char) -> c_int;
5756+
pub fn execve(prog: *const c_char, argv: *mut *const c_char,
5757+
envp: *mut *const c_char)
57605758
-> c_int;
57615759
pub fn execvp(c: *const c_char,
5762-
argv: *const *const c_char) -> c_int;
5760+
argv: *mut *const c_char) -> c_int;
57635761
pub fn fork() -> pid_t;
57645762
pub fn getcwd(buf: *mut c_char, size: size_t) -> *mut c_char;
57655763
pub fn getegid() -> gid_t;
57665764
pub fn geteuid() -> uid_t;
57675765
pub fn getgid() -> gid_t;
57685766
pub fn getlogin() -> *mut c_char;
5769-
pub fn getopt(argc: c_int, argv: *const *const c_char,
5767+
pub fn getopt(argc: c_int, argv: *mut *const c_char,
57705768
optstr: *const c_char) -> c_int;
57715769
pub fn getuid() -> uid_t;
57725770
pub fn getsid(pid: pid_t) -> pid_t;

branches/snap-stage3/src/libstd/io/error.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub struct Error {
3737
repr: Repr,
3838
}
3939

40+
#[derive(Debug)]
4041
enum Repr {
4142
Os(i32),
4243
Custom(Box<Custom>),
@@ -239,17 +240,6 @@ impl Error {
239240
}
240241
}
241242

242-
impl fmt::Debug for Repr {
243-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
244-
match self {
245-
&Repr::Os(ref code) =>
246-
fmt.debug_struct("Os").field("code", code)
247-
.field("message", &sys::os::error_string(*code)).finish(),
248-
&Repr::Custom(ref c) => fmt.debug_tuple("Custom").field(c).finish(),
249-
}
250-
}
251-
}
252-
253243
#[stable(feature = "rust1", since = "1.0.0")]
254244
impl fmt::Display for Error {
255245
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
@@ -292,16 +282,6 @@ mod test {
292282
use error;
293283
use error::Error as error_Error;
294284
use fmt;
295-
use sys::os::error_string;
296-
297-
#[test]
298-
fn test_debug_error() {
299-
let code = 6;
300-
let msg = error_string(code);
301-
let err = Error { repr: super::Repr::Os(code) };
302-
let expected = format!("Error {{ repr: Os {{ code: {:?}, message: {:?} }} }}", code, msg);
303-
assert_eq!(format!("{:?}", err), expected);
304-
}
305285

306286
#[test]
307287
fn test_downcasting() {

branches/snap-stage3/src/libstd/net/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ mod udp;
3030
mod parser;
3131
#[cfg(test)] mod test;
3232

33-
/// Possible values which can be passed to the `shutdown` method of `TcpStream`.
33+
/// Possible values which can be passed to the `shutdown` method of `TcpStream`
34+
/// and `UdpSocket`.
3435
#[derive(Copy, Clone, PartialEq, Debug)]
3536
#[stable(feature = "rust1", since = "1.0.0")]
3637
pub enum Shutdown {

branches/snap-stage3/src/libstd/panicking.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
3131
None => "Box<Any>",
3232
}
3333
};
34-
let mut err = match Stderr::new() {
35-
Ok(err) => err,
36-
_ => return,
37-
};
34+
let mut err = Stderr::new().ok();
3835
let thread = thread_info::current_thread();
3936
let name = thread.as_ref().and_then(|t| t.name()).unwrap_or("<unnamed>");
4037
let prev = LOCAL_STDERR.with(|s| s.borrow_mut().take());
41-
match prev {
42-
Some(mut stderr) => {
38+
match (prev, err.as_mut()) {
39+
(Some(mut stderr), _) => {
4340
// FIXME: what to do when the thread printing panics?
4441
let _ = writeln!(stderr,
4542
"thread '{}' panicked at '{}', {}:{}\n",
@@ -52,18 +49,22 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
5249
*slot.borrow_mut() = s.take();
5350
});
5451
}
55-
None => {
56-
let _ = writeln!(&mut err, "thread '{}' panicked at '{}', {}:{}",
52+
(None, Some(ref mut err)) => {
53+
let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}",
5754
name, msg, file, line);
5855
if backtrace::log_enabled() {
59-
let _ = backtrace::write(&mut err);
56+
let _ = backtrace::write(err);
6057
}
6158
}
59+
_ => {}
6260
}
6361

6462
// If this is a double panic, make sure that we printed a backtrace
6563
// for this panic.
66-
if unwind::panicking() && !backtrace::log_enabled() {
67-
let _ = backtrace::write(&mut err);
64+
match err {
65+
Some(ref mut err) if unwind::panicking() && !backtrace::log_enabled() => {
66+
let _ = backtrace::write(err);
67+
}
68+
_ => {}
6869
}
6970
}

branches/snap-stage3/src/libstd/sys/unix/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl Process {
313313
if !envp.is_null() {
314314
*sys::os::environ() = envp as *const _;
315315
}
316-
let _ = libc::execvp(*argv, argv);
316+
let _ = libc::execvp(*argv, argv as *mut _);
317317
fail(&mut output)
318318
}
319319

branches/snap-stage3/src/test/run-pass/issue-18809.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)