about summary refs log tree commit diff
path: root/src/libstd/sys
AgeCommit message (Collapse)AuthorLines
2015-03-18Fix private module loophole in the 'private type in public item' checkNick Cameron-4/+4
2015-03-17Auto merge of #23330 - alexcrichton:thread-sleep, r=aturonbors-221/+178
This function is the current replacement for `std::old_io::timer` which will soon be deprecated. This function is unstable and has its own feature gate as it does not yet have an RFC nor has it existed for very long.
2015-03-17std: Implement `thread::sleep`Alex Crichton-1/+31
This function is the current replacement for `std::old_io::timer` which will soon be deprecated. This function is unstable and has its own feature gate as it does not yet have an RFC nor has it existed for very long.
2015-03-17Auto merge of #23104 - japaric:inherent, r=nikomatsakisbors-0/+14
- Allow inherent implementations on `char`, `str`, `[T]`, `*const T`, `*mut T` and all the numeric primitives. - copy `unicode::char::CharExt` methods into `impl char` - remove `unicode::char::CharExt`, its re-export `std::char::CharExt` and `CharExt` from the prelude - copy `collections::str::StrExt` methods into `impl str` - remove `collections::str::StrExt` its re-export `std::str::StrExt`, and `StrExt` from the prelude - copy `collections::slice::SliceExt` methods into `impl<T> [T]` - remove `collections::slice::SliceExt` its re-export `std::slice::SliceExt`, and `SliceExt` from the prelude - copy `core::ptr::PtrExt` methods into `impl<T> *const T` - remove `core::ptr::PtrExt` its re-export `std::ptr::PtrExt`, and `PtrExt` from the prelude - copy `core::ptr::PtrExt` and `core::ptr::MutPtrExt` methods into `impl<T> *mut T` - remove `core::ptr::MutPtrExt` its re-export `std::ptr::MutPtrExt`, and `MutPtrExt` from the prelude - copy `core::num::Int` and `core::num::SignedInt` methods into `impl i{8,16,32,64,size}` - copy `core::num::Int` and `core::num::UnsignedInt` methods into `impl u{8,16,32,64,size}` - remove `core::num::UnsignedInt` and its re-export `std::num::UnsignedInt` - move `collections` tests into its own crate: `collectionstest` - copy `core::num::Float` methods into `impl f{32,64}` Because this PR removes several traits, this is a [breaking-change], however functionality remains unchanged and breakage due to unresolved imports should be minimal. If you encounter an error due to an unresolved import, simply remove the import: ``` diff fn main() { - use std::num::UnsignedInt; //~ error: unresolved import `std::num::UnsignedInt`. - println!("{}", 8_usize.is_power_of_two()); } ``` --- cc #16862 [preview docs](http://japaric.github.io/inherent/std/index.html) [unicode::char](http://japaric.github.io/inherent/unicode/primitive.char.html) [collections::str](http://japaric.github.io/inherent/collections/primitive.str.html) [std::f32](http://japaric.github.io/inherent/std/primitive.f32.html)
2015-03-16preemptively fix windows compilation errorsJorge Aparicio-0/+1
2015-03-16impl<T> [T]Jorge Aparicio-0/+13
2015-03-17Auto merge of #23352 - alexcrichton:stabilize-net, r=aturonbors-24/+24
This commit performs a stabilization pass over the std::net module, incorporating the changes from RFC 923. Specifically, the following actions were taken: Stable functionality: * `net` (the name) * `Shutdown` * `Shutdown::{Read, Write, Both}` * `lookup_host` * `LookupHost` * `SocketAddr` * `SocketAddr::{V4, V6}` * `SocketAddr::port` * `SocketAddrV4` * `SocketAddrV4::{new, ip, port}` * `SocketAddrV6` * `SocketAddrV4::{new, ip, port, flowinfo, scope_id}` * Common trait impls for socket addr structures * `ToSocketAddrs` * `ToSocketAddrs::Iter` * `ToSocketAddrs::to_socket_addrs` * `ToSocketAddrs for {SocketAddr*, (Ipv*Addr, u16), str, (str, u16)}` * `Ipv4Addr` * `Ipv4Addr::{new, octets, to_ipv6_compatible, to_ipv6_mapped}` * `Ipv6Addr` * `Ipv6Addr::{new, segments, to_ipv4}` * `TcpStream` * `TcpStream::connect` * `TcpStream::{peer_addr, local_addr, shutdown, try_clone}` * `{Read,Write} for {TcpStream, &TcpStream}` * `TcpListener` * `TcpListener::bind` * `TcpListener::{local_addr, try_clone, accept, incoming}` * `Incoming` * `UdpSocket` * `UdpSocket::bind` * `UdpSocket::{recv_from, send_to, local_addr, try_clone}` Unstable functionality: * Extra methods on `Ipv{4,6}Addr` for various methods of inspecting the address and determining qualities of it. * Extra methods on `TcpStream` to configure various protocol options. * Extra methods on `UdpSocket` to configure various protocol options. Deprecated functionality: * The `socket_addr` method has been renamed to `local_addr` This commit is a breaking change due to the restructuring of the `SocketAddr` type as well as the renaming of the `socket_addr` method. Migration should be fairly straightforward, however, after accounting for the new level of abstraction in `SocketAddr` (protocol distinction at the socket address level, not the IP address). [breaking-change]
2015-03-16Auto merge of #23347 - aturon:stab-misc, r=alexcrichtonbors-1/+1
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change] r? @alexcrichton
2015-03-16Auto merge of #23396 - semarie:remove-sized-bounds, r=sfacklerbors-2/+2
cc @alexcrichton
2015-03-15Auto merge of #23353 - alexcrichton:stabilize-os, r=aturonbors-316/+390
This commit starts to organize the `std::os::$platform` modules and in the process stabilizes some of the functionality contained within. The organization of these modules will reflect the organization of the standard library itself with extension traits for primitives in the same corresponding module. The OS-specific modules will grow more functionality over time including concrete types that are not extending functionality of other structures, and these will either go into the closest module in `std::os::$platform` or they will grow a new module in the hierarchy. The following items are now stable: * `os::{unix, windows}` * `unix::ffi` * `unix::ffi::OsStrExt` * `unix::ffi::OsStrExt::{from_bytes, as_bytes, to_cstring}` * `unix::ffi::OsString` * `unix::ffi::OsStringExt::{from_vec, into_vec}` * `unix::process` * `unix::process::CommandExt` * `unix::process::CommandExt::{uid, gid}` * `unix::process::ExitStatusExt` * `unix::process::ExitStatusExt::signal` * `unix::prelude` * `windows::ffi` * `windows::ffi::OsStringExt` * `windows::ffi::OsStringExt::from_wide` * `windows::ffi::OsStrExt` * `windows::ffi::OsStrExt::encode_wide` * `windows::prelude` The following items remain unstable: * `unix::io` * `unix::io::{Fd, AsRawFd}` * `unix::fs::{PermissionsExt, OpenOptionsExt}` * `windows::io` * `windows::io::{Handle, AsRawHandle}` * `windows::io::{Socket, AsRawSocket}` * `windows::fs` * `windows::fs::OpenOptionsExt` Due to the reorgnization of the platform extension modules, this commit is a breaking change. Most imports can be fixed by adding the relevant libstd module in the `use` path (such as `ffi` or `fs`). [breaking-change]
2015-03-15std: Clean up the sys::thread modulesAlex Crichton-221/+148
This module had become a #[cfg] jungle, try to bring at least a small semblance of order to it!
2015-03-15unbreak freebsd/openbsd/bitrig build after #23316Sébastien Marie-2/+2
2015-03-15std: Stabilize portions of `std::os::$platform`Alex Crichton-316/+390
This commit starts to organize the `std::os::$platform` modules and in the process stabilizes some of the functionality contained within. The organization of these modules will reflect the organization of the standard library itself with extension traits for primitives in the same corresponding module. The OS-specific modules will grow more functionality over time including concrete types that are not extending functionality of other structures, and these will either go into the closest module in `std::os::$platform` or they will grow a new module in the hierarchy. The following items are now stable: * `os::{unix, windows}` * `unix::ffi` * `unix::ffi::OsStrExt` * `unix::ffi::OsStrExt::{from_bytes, as_bytes, to_cstring}` * `unix::ffi::OsString` * `unix::ffi::OsStringExt::{from_vec, into_vec}` * `unix::process` * `unix::process::CommandExt` * `unix::process::CommandExt::{uid, gid}` * `unix::process::ExitStatusExt` * `unix::process::ExitStatusExt::signal` * `unix::prelude` * `windows::ffi` * `windows::ffi::OsStringExt` * `windows::ffi::OsStringExt::from_wide` * `windows::ffi::OsStrExt` * `windows::ffi::OsStrExt::encode_wide` * `windows::prelude` The following items remain unstable: * `unix::io` * `unix::io::{Fd, AsRawFd}` * `unix::fs::{PermissionsExt, OpenOptionsExt}` * `windows::io` * `windows::io::{Handle, AsRawHandle}` * `windows::io::{Socket, AsRawSocket}` * `windows::fs` * `windows::fs::OpenOptionsExt` Due to the reorgnization of the platform extension modules, this commit is a breaking change. Most imports can be fixed by adding the relevant libstd module in the `use` path (such as `ffi` or `fs`). [breaking-change]
2015-03-15Auto merge of #23372 - tamird:fix-ios-compilation, r=alexcrichtonbors-13/+3
r? @alexcrichton cc @vhbit
2015-03-15Implement `winsize()` for {ios,dragonfly}Tamir Duberstein-12/+2
`sys/ttycom.h` in both: `#define TIOCGWINSZ _IOR('t', 104, struct winsize) /* get window size */`
2015-03-15Fallout of c933d44f7bb9Tamir Duberstein-1/+1
2015-03-14std: Remove ?Sized bounds from many I/O functionsAlex Crichton-1/+1
It is a frequent pattern among I/O functions to take `P: AsPath + ?Sized` or `AsOsStr` instead of `AsPath`. Most of these functions do not need to take ownership of their argument, but for libraries in general it's much more ergonomic to not deal with `?Sized` at all and simply require an argument `P` instead of `&P`. This change is aimed at removing unsightly `?Sized` bounds while retaining the same level of usability as before. All affected functions now take ownership of their arguments instead of taking them by reference, but due to the forwarding implementations of `AsOsStr` and `AsPath` all code should continue to work as it did before. This is strictly speaking a breaking change due to the signatures of these functions changing, but normal idiomatic usage of these APIs should not break in practice. [breaking-change]
2015-03-14Auto merge of #23333 - oli-obk:slice_from_raw_parts, r=alexcrichtonbors-9/+9
at least that's what the docs say: http://doc.rust-lang.org/std/slice/fn.from_raw_parts.html A few situations got prettier. In some situations the mutability of the resulting and source pointers differed (and was cast away by transmute), the mutability matches now.
2015-03-13std: Stabilize the `net` moduleAlex Crichton-24/+24
This commit performs a stabilization pass over the std::net module, incorporating the changes from RFC 923. Specifically, the following actions were taken: Stable functionality: * `net` (the name) * `Shutdown` * `Shutdown::{Read, Write, Both}` * `lookup_host` * `LookupHost` * `SocketAddr` * `SocketAddr::{V4, V6}` * `SocketAddr::port` * `SocketAddrV4` * `SocketAddrV4::{new, ip, port}` * `SocketAddrV6` * `SocketAddrV4::{new, ip, port, flowinfo, scope_id}` * Common trait impls for socket addr structures * `ToSocketAddrs` * `ToSocketAddrs::Iter` * `ToSocketAddrs::to_socket_addrs` * `ToSocketAddrs for {SocketAddr*, (Ipv*Addr, u16), str, (str, u16)}` * `Ipv4Addr` * `Ipv4Addr::{new, octets, to_ipv6_compatible, to_ipv6_mapped}` * `Ipv6Addr` * `Ipv6Addr::{new, segments, to_ipv4}` * `TcpStream` * `TcpStream::connect` * `TcpStream::{peer_addr, local_addr, shutdown, try_clone}` * `{Read,Write} for {TcpStream, &TcpStream}` * `TcpListener` * `TcpListener::bind` * `TcpListener::{local_addr, try_clone, accept, incoming}` * `Incoming` * `UdpSocket` * `UdpSocket::bind` * `UdpSocket::{recv_from, send_to, local_addr, try_clone}` Unstable functionality: * Extra methods on `Ipv{4,6}Addr` for various methods of inspecting the address and determining qualities of it. * Extra methods on `TcpStream` to configure various protocol options. * Extra methods on `UdpSocket` to configure various protocol options. Deprecated functionality: * The `socket_addr` method has been renamed to `local_addr` This commit is a breaking change due to the restructuring of the `SocketAddr` type as well as the renaming of the `socket_addr` method. Migration should be fairly straightforward, however, after accounting for the new level of abstraction in `SocketAddr` (protocol distinction at the socket address level, not the IP address). [breaking-change]
2015-03-13Deprecate range, range_step, count, distributionsAaron Turon-1/+1
This commit deprecates the `count`, `range` and `range_step` functions in `iter`, in favor of range notation. To recover all existing functionality, a new `step_by` adapter is provided directly on `ops::Range` and `ops::RangeFrom`. [breaking-change]
2015-03-13Fallout of std::old_io deprecationAlex Crichton-47/+113
2015-03-13slice::from_raw_parts is preferred over transmuting a fresh raw::SliceOliver Schneider-9/+9
2015-03-13Auto merge of #23229 - aturon:stab-path, r=alexcrichtonbors-4/+17
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` method is now `without_file` and succeeds if, and only if, `file_name` is `Some(_)`. That means, in particular, that it fails for a path like `foo/../`. This change affects `pop` as well. In addition, the `old_path` module is now deprecated. [breaking-change] r? @alexcrichton
2015-03-12Stabilize std::pathAaron Turon-4/+17
This commit stabilizes essentially all of the new `std::path` API. The API itself is changed in a couple of ways (which brings it in closer alignment with the RFC): * `.` components are now normalized away, unless they appear at the start of a path. This in turn effects the semantics of e.g. asking for the file name of `foo/` or `foo/.`, both of which yield `Some("foo")` now. This semantics is what the original RFC specified, and is also desirable given early experience rolling out the new API. * The `parent` function now succeeds if, and only if, the path has at least one non-root/prefix component. This change affects `pop` as well. * The `Prefix` component now involves a separate `PrefixComponent` struct, to better allow for keeping both parsed and unparsed prefix data. In addition, the `old_path` module is now deprecated. Closes #23264 [breaking-change]
2015-03-12std: Remove #[allow] directives in sys modulesAlex Crichton-161/+76
These were suppressing lots of interesting warnings! Turns out there was also quite a bit of dead code.
2015-03-11Example -> ExamplesSteve Klabnik-4/+4
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-03-09Rename #[should_fail] to #[should_panic]Steven Fackler-5/+5
2015-03-06rollup merge of #22813: alexcrichton/deprecate-netAlex Crichton-0/+20
The `std::net` primitives should be ready for use now and as a result the old ones are now deprecated and slated for removal. Most TCP/UDP functionality is now available through `std::net` but the `std::old_io::net::pipe` module is removed entirely from the standard library. Unix socket funtionality can be found in sfackler's [`unix_socket`][unix] crate and there is currently no replacement for named pipes on Windows. [unix]: https://crates.io/crates/unix_socket [breaking-change]
2015-03-06std: Deprecate the std::old_io::net primitivesAlex Crichton-0/+20
The `std::net` primitives should be ready for use now and as a result the old ones are now deprecated and slated for removal. Most TCP/UDP functionality is now available through `std::net` but the `std::old_io::net::pipe` module is removed entirely from the standard library. Unix socket funtionality can be found in sfackler's [`unix_socket`][unix] crate and there is currently no replacement for named pipes on Windows. [unix]: https://crates.io/crates/unix_socket [breaking-change]
2015-03-06Rollup merge of #23079 - alexcrichton:deprecate-process, r=aturonManish Goregaokar-0/+4
This module is now superseded by the `std::process` module. This module still has some room to expand to get quite back up to parity with the `old_io` version, and there is a [tracking issue][issue] for feature requests as well as known room for expansion. [issue]: https://github.com/rust-lang/rfcs/issues/941 [breaking-change]
2015-03-06Rollup merge of #22899 - huonw:macro-stability, r=alexcrichtonManish Goregaokar-5/+1
Unstable items used in a macro expansion will now always trigger stability warnings, *unless* the unstable items are directly inside a macro marked with `#[allow_internal_unstable]`. IOW, the compiler warns unless the span of the unstable item is a subspan of the definition of a macro marked with that attribute. E.g. #[allow_internal_unstable] macro_rules! foo { ($e: expr) => {{ $e; unstable(); // no warning only_called_by_foo!(); }} } macro_rules! only_called_by_foo { () => { unstable() } // warning } foo!(unstable()) // warning The unstable inside `foo` is fine, due to the attribute. But the `unstable` inside `only_called_by_foo` is not, since that macro doesn't have the attribute, and the `unstable` passed into `foo` is also not fine since it isn't contained in the macro itself (that is, even though it is only used directly in the macro). In the process this makes the stability tracking much more precise, e.g. previously `println!(\"{}\", unstable())` got no warning, but now it does. As such, this is a bug fix that may cause [breaking-change]s. The attribute is definitely feature gated, since it explicitly allows side-stepping the feature gating system. --- This updates `thread_local!` macro to use the attribute, since it uses unstable features internally (initialising a struct with unstable fields).
2015-03-05std: Deprecate the old_io::process moduleAlex Crichton-0/+4
This module is now superseded by the `std::process` module. This module still has some room to expand to get quite back up to parity with the `old_io` version, and there is a [tracking issue][issue] for feature requests as well as known room for expansion. [issue]: https://github.com/rust-lang/rfcs/issues/941 [breaking-change]
2015-03-06Use `#[allow_internal_unstable]` for `thread_local!`Huon Wilson-5/+1
This destabilises all the implementation details of `thread_local!`, since they do not *need* to be stable with the new attribute.
2015-03-05Remove integer suffixes where the types in compiled code are identical.Eduard Burtescu-3/+3
2015-03-04std: Deprecate std::old_io::fsAlex Crichton-1/+3
This commit deprecates the majority of std::old_io::fs in favor of std::fs and its new functionality. Some functions remain non-deprecated but are now behind a feature gate called `old_fs`. These functions will be deprecated once suitable replacements have been implemented. The compiler has been migrated to new `std::fs` and `std::path` APIs where appropriate as part of this change.
2015-03-03Auto merge of #22532 - pnkfelix:arith-overflow, r=pnkfelix,eddybbors-1/+1
Rebase and follow-through on work done by @cmr and @aatch. Implements most of rust-lang/rfcs#560. Errors encountered from the checks during building were fixed. The checks for division, remainder and bit-shifting have not been implemented yet. See also PR #20795 cc @Aatch ; cc @nikomatsakis
2015-03-03Rollup merge of #22956 - ejjeong:aarch64-linux-android, r=alexcrichtonManish Goregaokar-1/+1
aarch64-linux-android build has been broken since #22839. Aarch64 android has _Unwind_GetIPInfo, so re-define this only for arm32 android. r? @alexcrichton
2015-03-03Rollup merge of #22876 - Florob:const, r=nikomatsakisManish Goregaokar-3/+3
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-03Rollup merge of #22943 - ipetkov:lint-recursion, r=alexcrichtonManish Goregaokar-8/+9
* The lint visitor's visit_ty method did not recurse, and had a reference to the now closed #10894 * The newly enabled recursion has only affected the `deprectated` lint which now detects uses of deprecated items in trait impls and function return types * Renamed some references to `CowString` and `CowVec` to `Cow<str>` and `Cow<[T]>`, respectively, which appear outside of the crate which defines them * Replaced a few instances of `InvariantType<T>` with `PhantomData<Cell<T>>` * Disabled the `deprecated` lint in several places that reference/implement traits on deprecated items which will get cleaned up in the future * Unfortunately, this means that if a library declares `#![deny(deprecated)]` and marks anything as deprecated, it will have to disable the lint for any uses of said item, e.g. any impl the now deprecated item For any library that denies deprecated items but has deprecated items of its own, this is a [breaking-change] I had originally intended for the lint to ignore uses of deprecated items that are declared in the same crate, but this goes against some previous test cases that expect the lint to capture *all* uses of deprecated items, so I maintained the previous approach to avoid changing the expected behavior of the lint. Tested locally on OS X, so hopefully there aren't any deprecated item uses behind a `cfg` that I may have missed.
2015-03-03Fix backtrace tests for LinuxManish Goregaokar-1/+1
2015-03-02core: Audit num module for int/uintBrian Anderson-2/+2
* count_ones/zeros, trailing_ones/zeros return u32, not usize * rotate_left/right take u32, not usize * RADIX, MANTISSA_DIGITS, DIGITS, BITS, BYTES are u32, not usize Doesn't touch pow because there's another PR for it. [breaking-change]
2015-03-02Enable recursion for visit_ty in lint visitorIvan Petkov-8/+9
* The lint visitor's visit_ty method did not recurse, and had a reference to the now closed #10894 * The newly enabled recursion has only affected the `deprectated` lint which now detects uses of deprecated items in trait impls and function return types * Renamed some references to `CowString` and `CowVec` to `Cow<str>` and `Cow<[T]>`, respectively, which appear outside of the crate which defines them * Replaced a few instances of `InvariantType<T>` with `PhantomData<Cell<T>>` * Disabled the `deprecated` lint in several places that reference/implement traits on deprecated items which will get cleaned up in the future * Disabled the `exceeding_bitshifts` lint for compile-fail/huge-array-simple test so it doesn't shadow the expected error on 32bit systems * Unfortunately, this means that if a library declares `#![deny(deprecated)]` and marks anything as deprecated, it will have to disable the lint for any uses of said item, e.g. any impl the now deprecated item For any library that denies deprecated items but has deprecated items of its own, this is a [breaking-change]
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-3/+3
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-03-02Auto merge of #22797 - alexcrichton:io-stdio, r=aturonbors-2/+224
This is an implementation of RFC 899 and adds stdio functionality to the new `std::io` module. Details of the API can be found on the RFC, but from a high level: * `io::{stdin, stdout, stderr}` constructors are now available. There are also `*_raw` variants for unbuffered and unlocked access. * All handles are globally shared (excluding raw variants). * The stderr handle is no longer buffered. * All handles can be explicitly locked (excluding the raw variants). The `print!` and `println!` machinery has not yet been hooked up to these streams just yet. The `std::fmt::output` module has also not yet been implemented as part of this commit.
2015-03-02Fix broken aarch64 buildEunji Jeong-1/+1
2015-02-28std: Implement stdio for `std::io`Alex Crichton-2/+224
This is an implementation of RFC 899 and adds stdio functionality to the new `std::io` module. Details of the API can be found on the RFC, but from a high level: * `io::{stdin, stdout, stderr}` constructors are now available. There are also `*_raw` variants for unbuffered and unlocked access. * All handles are globally shared (excluding raw variants). * The stderr handle is no longer buffered. * All handles can be explicitly locked (excluding the raw variants). The `print!` and `println!` machinery has not yet been hooked up to these streams just yet. The `std::fmt::output` module has also not yet been implemented as part of this commit.
2015-02-28openbsd: adjust page guard addressSébastien Marie-1/+1
some commits in OpenBSD base have corrected a problem of stack position. Now, we can adjust more accurately the page guard in rust.
2015-02-28Rollup merge of #22884 - japaric:obsolete, r=alexcrichtonManish Goregaokar-2/+2
This is leftover from #21843 If you still have `|&:| {}` closures in your code, simply remove the `&:` part. [breaking-change]
2015-02-28Auto merge of #22839 - lifthrasiir:better-backtrace, r=alexcrichtonbors-10/+107
Fixes #20978 for supported platforms (i.e. non-Android POSIX). This uses `backtrace_pcinfo` to inspect the DWARF debug info and list the file and line pairs for given stack frame. Such pair is not unique due to the presence of inlined functions and the updated routine correctly handles this case. The code is modelled after libbacktrace's `backtrace_full` routine. There is one known issue with this approach. Macros, when invoked, take over the current frame and shadows the file and line pair which has invoked a macro. In particular, this makes many panicking macros a bit harder to inspect. This really is a debuginfo problem, and the backtrace routine should print them correctly with a correct debuginfo. Some example trace: ``` thread '<main>' panicked at 'explicit panic', /home/arachneng/Works/git/rust/src/test/run-pass/backtrace-debuginfo.rs:74 stack backtrace: 1: 0xd964702f - sys::backtrace::write::h32d93fffb64131b2yxC 2: 0xd9670202 - panicking::on_panic::h3a4fcb37b873aefeooM 3: 0xd95b396a - rt::unwind::begin_unwind_inner::h576b3df5f626902dJ2L 4: 0xd9eb88df - rt::unwind::begin_unwind::h16852273847167740350 5: 0xd9eb8afb - aux::callback::h15056955655605709172 at /home/arachneng/Works/git/rust/<std macros>:3 at src/test/run-pass/backtrace-debuginfo-aux.rs:15 6: 0xd9eb8caa - outer::h2cf96412459fceb6ema at src/test/run-pass/backtrace-debuginfo.rs:73 at src/test/run-pass/backtrace-debuginfo.rs:88 7: 0xd9ebab24 - main::h3f701287441442edasa at src/test/run-pass/backtrace-debuginfo.rs:134 8: 0xd96daba8 - rust_try_inner 9: 0xd96dab95 - rust_try 10: 0xd9671af4 - rt::lang_start::h7da0de9529b4c394liM 11: 0xd8f3aec4 - __libc_start_main 12: 0xd9eb8148 - <unknown> 13: 0xffffffff - <unknown> ```
2015-02-27remove leftover annotationsJorge Aparicio-2/+2