about summary refs log tree commit diff
path: root/src/libstd/macros.rs
AgeCommit message (Collapse)AuthorLines
2016-05-09rustc: Implement custom panic runtimesAlex Crichton-5/+5
This commit is an implementation of [RFC 1513] which allows applications to alter the behavior of panics at compile time. A new compiler flag, `-C panic`, is added and accepts the values `unwind` or `panic`, with the default being `unwind`. This model affects how code is generated for the local crate, skipping generation of landing pads with `-C panic=abort`. [RFC 1513]: https://github.com/rust-lang/rfcs/blob/master/text/1513-less-unwinding.md Panic implementations are then provided by crates tagged with `#![panic_runtime]` and lazily required by crates with `#![needs_panic_runtime]`. The panic strategy (`-C panic` value) of the panic runtime must match the final product, and if the panic strategy is not `abort` then the entire DAG must have the same panic strategy. With the `-C panic=abort` strategy, users can expect a stable method to disable generation of landing pads, improving optimization in niche scenarios, decreasing compile time, and decreasing output binary size. With the `-C panic=unwind` strategy users can expect the existing ability to isolate failure in Rust code from the outside world. Organizationally, this commit dismantles the `sys_common::unwind` module in favor of some bits moving part of it to `libpanic_unwind` and the rest into the `panicking` module in libstd. The custom panic runtime support is pretty similar to the custom allocator support with the only major difference being how the panic runtime is injected (takes the `-C panic` flag into account).
2016-03-07mk: Distribute fewer TARGET_CRATESAlex Crichton-12/+0
Right now everything in TARGET_CRATES is built by default for all non-fulldeps tests and is distributed by default for all target standard library packages. Currenly this includes a number of unstable crates which are rarely used such as `graphviz` and `rbml`> This commit trims down the set of `TARGET_CRATES`, moves a number of tests to `*-fulldeps` as a result, and trims down the dependencies of libtest so we can distribute fewer crates in the `rust-std` packages.
2016-02-11doc: concat_idents! macro: more on its limitations.NODA, Kai-3/+6
Signed-off-by: NODA, Kai <nodakai@gmail.com>
2016-01-19Use different numbers of `#`s when expanding documentation commentsBarosl Lee-0/+3
Any documentation comments that contain raw-string-looking sequences may pretty-print invalid code when expanding them, as the current logic always uses the `r"literal"` form, without appending any `#`s. This commit calculates the minimum number of `#`s required to wrap a comment correctly and appends `#`s appropriately. Fixes #27489.
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-40/+0
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-11-29tweak cfg! doc commentAlex Burka-3/+3
2015-11-26fix docs for compiler builtin macrosAlex Burka-3/+3
2015-11-18Add missing annotations and some testsVadim Petrochenkov-0/+14
2015-09-25Change the first line of the println macro docBen S-1/+1
This makes the first lines of the print! and println! macros different. Previously, they would show up exactly the same in the documentation for the macros in libstd [1], with nothing about how one of them also prints a newline. [1]: https://doc.rust-lang.org/stable/std/#macros
2015-09-19added panic docs for print\! and println\! macrosllogiq-0/+8
2015-09-07Clarify that `include_bytes!` returns a reference to an array, not just a sliceJake Goulding-2/+2
This can be shown with the example code ```rust fn main() { let () = include_bytes!("/etc/hosts"); } Which will have the error: expected `&[u8; 195]`, found `()`
2015-08-28Auto merge of #28047 - steveklabnik:doc_print, r=alexcrichtonbors-0/+20
2015-08-27Add some examples for the print! macroSteve Klabnik-0/+20
2015-08-27fix some more unstable issue annotationsAlex Burka-1/+1
2015-08-17std: Clean up primitive integer modulesAlex Crichton-0/+9
All of the modules in the standard library were just straight reexports of those in libcore, so remove all the "macro modules" from the standard library and just reexport what's in core directly.
2015-07-27Show appropriate feature flags in docsSteve Klabnik-1/+2
2015-06-26std: clean up duplicated attrs and comment on panicRicho Healey-22/+0
2015-06-19Fix docs for column/lineSteve Klabnik-2/+2
Fixes #26424
2015-06-17std: Split the `std_misc` featureAlex Crichton-4/+2
2015-06-03Indent 4 spaces instead of 2Carol Nichols-2/+2
2015-06-03Return Ok(()) instead of Ok()Carol Nichols-2/+2
2015-06-03Use write_all instead of write_lineCarol Nichols-2/+2
2015-06-03Add prelude to get WriteCarol Nichols-0/+1
2015-06-03Improve `try!` docs to make clearer it returns `Result`.Carol Nichols-1/+27
The API documentation is not explicit enough that because `try!` returns `Err` early for you, you can only use it in functions that return `Result`. The book mentions this, but if you come across `try!` outside of the book and look it up in the docs, this restriction on the return type of the function is not particularly clear.
2015-05-09Squeeze the last bits of `task`s in documentation in favor of `thread`Barosl Lee-9/+9
An automated script was run against the `.rs` and `.md` files, subsituting every occurrence of `task` with `thread`. In the `.rs` files, only the texts in the comment blocks were affected.
2015-05-05Auto merge of #25101 - alexcrichton:fix-flaky-windows-test, r=nikomatsakisbors-2/+4
This test has deadlocked on Windows once or twice now and we've had lots of problems in the past of threads panicking when the process is being shut down. One of the two threads in this test is guaranteed to panic because of the `.unwrap()` on the `send` calls, so just call `recv` on both receivers after the test executes to ensure that both threads are dying/dead.
2015-05-04std: Join threads in select! doctestAlex Crichton-2/+4
This test has deadlocked on Windows once or twice now and we've had lots of problems in the past of threads panicking when the process is being shut down. One of the two threads in this test is guaranteed to panic because of the `.unwrap()` on the `send` calls, so just call `recv` on both receivers after the test executes to ensure that both threads are dying/dead.
2015-05-04Fix spelling errors in documentation.Joseph Crail-1/+1
2015-04-28Register new snapshotsTamir Duberstein-25/+0
2015-04-11Change the rt::unwind line argument type from usize to u32.Ryan Prichard-1/+48
2015-04-08std: Destabilize the internals of panic!Alex Crichton-0/+1
Now that we have a `#[allow_internal_unstable]` attribute for macros there's no need for these two `begin_unwind` functions to be stable. Right now the `panic!` interface is the only one we wish to stabilize, so remove the stability markers from these functions. While this is a breaking change, it is highly unlikely to break any actual code. It is recommended to use the `panic!` macro instead if it breaks explicit calls into `std::rt`. [breaking-change] cc #24208
2015-03-31rollup merge of #23879: seanmonstar/del-from-errorAlex Crichton-1/+1
Conflicts: src/libcore/error.rs
2015-03-30convert: remove FromError, use From<E> insteadSean McArthur-1/+1
This removes the FromError trait, since it can now be expressed using the new convert::Into trait. All implementations of FromError<E> where changed to From<E>, and `try!` was changed to use From::from instead. Because this removes FromError, it is a breaking change, but fixing it simply requires changing the words `FromError` to `From`, and `from_error` to `from`. [breaking-change]
2015-03-30std: Add a note about the print! macro and output bufferingRicho Healey-0/+4
2015-03-26syntax: Remove support for #[should_fail]Alex Crichton-1/+1
This attribute has been deprecated in favor of #[should_panic]. This also updates rustdoc to no longer accept the `should_fail` directive and instead renames it to `should_panic`.
2015-03-23rollup merge of #23598: brson/gateAlex Crichton-0/+1
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
2015-03-23Add #![feature] attributes to doctestsBrian Anderson-0/+1
2015-03-22Remove bad reference to std::ioSteve Klabnik-2/+1
Closes #23540
2015-03-19Document include!Steve Klabnik-0/+14
Fixes #22309
2015-03-17Rollup merge of #23329 - jbcrail:rm-syntax-highlight, r=sanxiynManish Goregaokar-5/+5
As suggested by @steveklabnik in #23254, I removed the redundant Rust syntax highlighting from the documentation.
2015-03-15Use new io in print and println macrosesSimonas Kazlauskas-6/+9
2015-03-13Remove explicit syntax highlight from docs.Joseph Crail-5/+5
2015-03-11Example -> ExamplesSteve Klabnik-14/+14
This brings comments in line with https://github.com/rust-lang/rfcs/blob/master/text/0505-api-comment-conventions.md#using-markdown
2015-02-21Resolve includeme.fragment conflict.Brian Brooks-2/+2
2015-02-17Register new snapshotsAlex Crichton-17/+0
2015-02-17Fallout from stabilizationAaron Turon-3/+3
2015-02-07Don't use std:: paths in syntax extensions when compiling a #![no_std] crateKeegan McAllister-0/+1
Fixes #16803. Fixes #14342. Fixes half of #21827 -- slice syntax is still broken.
2015-01-30Remove all `i` suffixesTobias Bucher-3/+3
2015-01-27Merge remote-tracking branch 'rust-lang/master'Brian Anderson-4/+4
Conflicts: src/libcore/cell.rs src/librustc_driver/test.rs src/libstd/old_io/net/tcp.rs src/libstd/old_io/process.rs
2015-01-26Fallout of io => old_ioAlex Crichton-4/+4