summary refs log tree commit diff
path: root/src/libstd/macros.rs
AgeCommit message (Collapse)AuthorLines
2017-11-19std: Add a new wasm32-unknown-unknown targetAlex Crichton-0/+36
This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". --- Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is still getting LLVM bugs fixed to get that working and will take some time. Relatively simple programs all seem to work though! --- It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-10-22fix stringify docs in stdAlex Burka-2/+2
2017-09-10Use rvalue promotion to 'static instead of static items.Eduard-Mihai Burtescu-15/+3
2017-08-31Update bootstrap compilerAlex Crichton-10/+0
This commit updates the bootstrap compiler and clears out a number of #[cfg(stage0)] annotations and related business
2017-08-29broken links resolvedAndy Gauge-1/+1
2017-08-29fix test failures in documentation changeAndrew Gauger-2/+2
2017-08-29API docs: macros. Part of #29329 Standard Library Documentation Checklist.Andy Gauge-21/+101
2017-08-12Add complete doc example for `include_str!`.Corey Farwell-1/+18
2017-08-12Add complete doc example for `include_bytes!`.Corey Farwell-1/+18
2017-08-12Demonstrate `include!` with Rust code, not just a string slice literal.Corey Farwell-6/+11
2017-08-08Avoid calling the column!() macro in panicest31-2/+14
2017-07-27Auto merge of #43477 - est31:master, r=alexcrichtonbors-1/+1
Switch to begin_panic again In https://github.com/rust-lang/rust/pull/42938 we made the compiler emit a call to begin_panic_new in order to pass column info to it. Now with stage0 updated (https://github.com/rust-lang/rust/pull/43320), we can safely change begin_panic and start emitting calls for it again.
2017-07-25Switch to begin_panic againest31-1/+1
In https://github.com/rust-lang/rust/pull/42938 we made the compiler emit a call to begin_panic_new in order to pass column info to it. Now with stage0 updated (https://github.com/rust-lang/rust/pull/43320), we can safely change begin_panic and start emitting calls for it again.
2017-07-25Stabilize the `compile_error_macro` featureAlex Crichton-1/+1
Stabilizes: * `compile_error!` as a macro defined by rustc Closes #40872
2017-07-12Rollup merge of #42670 - dns2utf8:panic_return_code, r=steveklabnikMark Simulacrum-0/+5
Add hint about the return code of panic! I hope the link works on all cases, since the `unreachable` doc is copied to `std::` as well.
2017-07-11Wrap long lineStefan Schindler-1/+2
2017-07-05Be more specific about the implications of the panic!Stefan Schindler-1/+1
2017-07-05Insert current implementation headerStefan Schindler-0/+2
2017-07-02Output line column info when panickingest31-5/+5
2017-06-23Removed as many "```ignore" as possible.kennytm-4/+4
Replaced by adding extra imports, adding hidden code (`# ...`), modifying examples to be runnable (sorry Homura), specifying non-Rust code, and converting to should_panic, no_run, or compile_fail. Remaining "```ignore"s received an explanation why they are being ignored.
2017-06-19Add compile_error!Wesley Wiser-0/+10
Related to #40872
2017-06-15Add hint about the return code of panic!Stefan Schindler-0/+2
2017-06-15Update older URLs pointing to the first edition of the BookWonwoo Choi-1/+1
`compiler-plugins.html` is moved into the Unstable Book. Explanation is slightly modified to match the change.
2017-05-20Correct some stability versionsOliver Middleton-2/+2
These were found by running tidy on stable versions of rust and finding features stabilised with the wrong version numbers.
2017-05-10Fix up stability annotations per feedback.Zack Weinberg-2/+2
2017-05-10Revise the eprint(ln)! feature.Zack Weinberg-7/+7
* Factor out the nigh-identical bodies of `_print` and `_eprint` to a helper function `print_to` (I was sorely tempted to call it `_doprnt`). * Update the issue number for the unstable `eprint` feature. * Add entries to the "unstable book" for `eprint` and `eprint_internal`. * Style corrections to the documentation.
2017-05-10Add `eprint!` and `eprintln!` macros to the prelude.Zack Weinberg-0/+45
These are exactly the same as `print!` and `println!` except that they write to stderr instead of stdout. Issue #39228.
2017-02-21Get linkchecker cleanSteve Klabnik-1/+1
This affects the book, some missed things in the reference, the grammar, and the standard library. Whew!
2017-01-19Rollup merge of #38457 - frewsxcv:include, r=GuillaumeGomezGuillaume Gomez-5/+20
Improvements to 'include' macro documentation. None
2016-12-21Fix 'unhygienically' typo.Corey Farwell-1/+1
2016-12-21Move parenthesized statement within sentence.Corey Farwell-2/+2
2016-12-21Add a more complete doc example for 'include' macro.Corey Farwell-2/+17
2016-12-19Allow `writeln!` without arguments, in symmetry with `println!`Tobias Bucher-1/+1
2016-10-27tidy/features: fix checking of lang featuresTamir Duberstein-1/+1
Removes the `STATUSES` static which duplicates truth from the pattern match in `collect_lang_features`. Fixes existing duplicates by renaming: - never_type{,_impls} on `impl`s on `!` - concat_idents{,_macro} on `macro_rules! concat_idents` Fixes #37013.
2016-10-21Small docstring changes for include_bytes and include_strАртём Павлов [Artyom Pavlov]-5/+9
2016-10-21Small doc change for include!Артём Павлов [Artyom Pavlov]-3/+4
2016-10-11Auto merge of #36825 - sbwtw:master, r=alexcrichtonbors-0/+2
add println!() macro with out any arguments lets add println!() to write "\n". like java https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html#println()
2016-10-02Auto merge of #36404 - christopherdumas:master, r=GuillaumeGomezbors-3/+10
Documentation change to macros.rs for `includes!` I'm not sure if this documentation is clear or extensive enough, but this is just to get started on the problem, fixes issue #36387.
2016-09-30add println!() macro with out any arguments石博文-0/+2
2016-09-16Add links between format_args! macro and std::fmt::Arguments structMark-Simulacrum-4/+10
2016-09-12Fixed issue #36387christopherdumas-3/+10
2016-07-12doc: Mention that writeln! and println! always use LFMike Hommey-1/+3
Fixes #34697
2016-06-21Mark concat_idents! unstableOliver Middleton-1/+1
This is mostly just a documentation fix as I don't think stability attributes have any effect on macros.
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