about summary refs log tree commit diff
path: root/src/libcore/macros.rs
AgeCommit message (Collapse)AuthorLines
2019-03-02Bootstrap compiler update for 1.35 releaseMark Rousskov-4/+2
2019-02-14make Centril happyRalf Jung-1/+1
2019-02-14split MaybeUninit into several features, expand docs a bitRalf Jung-2/+2
2019-02-13Rollup merge of #57815 - dotdash:asserts, r=sfacklerMazdak Farrokhzad-4/+16
Speed up the fast path for assert_eq! and assert_ne! Currently, the panic!() calls directly borrow the value bindings. This causes those bindings to always be initialized, i.e. they're initialized even before the values are even compared. This causes noticeable overhead in what should be a really cheap operation. By performing a reborrow of the value in the call to panic!(), we allow LLVM to optimize that code, so that the extra borrow only happens in the error case. We could achieve the same result by dereferencing the values passed to panic!(), as the format machinery borrows them anyway, but this causes assertions to fail to compile if one of the values is unsized, i.e. it would be a breaking change.
2019-02-12Auto merge of #58341 - alexreg:cosmetic-2-doc-comments, r=steveklabnikbors-3/+3
Cosmetic improvements to doc comments This has been factored out from https://github.com/rust-lang/rust/pull/58036 to only include changes to documentation comments (throughout the rustc codebase). r? @steveklabnik Once you're happy with this, maybe we could get it through with r=1, so it doesn't constantly get invalidated? (I'm not sure this will be an issue, but just in case...) Anyway, thanks for your advice so far!
2019-02-11Require a list of features to allow in `allow_internal_unstable`Oliver Scherer-2/+4
2019-02-10libs: doc commentsAlexander Regueiro-2/+2
2019-02-10tests: doc commentsAlexander Regueiro-1/+1
2019-02-03some type-level docs for MaybeUninit; rename into_inner -> into_initializedRalf Jung-2/+2
2019-01-28add macro for creating uninitialized arrayRalf Jung-0/+17
2019-01-21Speed up the fast path for assert_eq! and assert_ne!Björn Steinbrink-4/+16
Currently, the panic!() calls directly borrow the value bindings. This causes those bindings to always be initialized, i.e. they're initialized even before the values are even compared. This causes noticeable overhead in what should be a really cheap operation. By performing a reborrow of the value in the call to panic!(), we allow LLVM to optimize that code, so that the extra borrow only happens in the error case. We could achieve the same result by dereferencing the values passed to panic!(), as the format machinery borrows them anyway, but this causes assertions to fail to compile if one of the values is unsized, i.e. it would be a breaking change.
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-03link to raw identifiersMark Mansi-1/+3
2018-12-03Explain raw identifer syntaxMark Mansi-0/+2
2018-12-01remove some uses of try!Mark Mansi-5/+5
2018-11-09Fix docstring spelling mistakesDaniel Alley-4/+3
2018-09-05Spacing changes made to the exampleSiva Prasad-11/+10
2018-09-05Added a missing backtick to no stdMagnumOpus21-1/+1
2018-09-05Made the requested changes for Note: and no_std within backticksMagnumOpus21-2/+2
2018-09-05Prefixed no_run to the no_std write macroMagnumOpus21-1/+1
2018-09-05Formatting errors rectifiedMagnumOpus21-2/+7
2018-09-05Refined the exampleMagnumOpus21-22/+10
2018-09-05Updated libcore/macro.rs to note write macro can work in no_std setupsMagnumOpus21-0/+28
2018-08-31use cfg(rustdoc) instead of cfg(dox) in std and friendsQuietMisdreavus-1/+1
2018-08-10Don't accept none str literals for the format string in writelnOliver Middleton-5/+3
2018-07-21Avoid using `#[macro_export]` for documenting builtin macrosVadim Petrochenkov-32/+17
2018-05-03update concat_idents doc stubsMichael Lamparski-2/+2
2018-04-24Rollup merge of #49906 - kennytm:stable-unreachable, r=sfacklerkennytm-4/+4
Stabilize `std::hint::unreachable_unchecked`. Closes #43751.
2018-04-21add more aliasesGuillaume Gomez-0/+1
2018-04-16Stabilize core::hint::unreachable_unchecked.kennytm-4/+4
Closes #43751.
2018-04-05Bump the bootstrap compiler to 1.26.0 betaAlex Crichton-65/+0
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language features!
2018-03-07Make `assert` macro a built-in procedural macroShotaro Yamada-0/+15
2018-02-28Auto merge of #48056 - ExpHP:macro-commas, r=dtolnaybors-7/+35
Comprehensively support trailing commas in std/core macros I carefully organized the changes into four commits: * Test cases * Fixes for `macro_rules!` macros * Fixes for builtin macros * Docs for builtins **I can easily scale this back to just the first two commits for now if such is desired.** ### Breaking (?) changes * This fixes #48042, which is a breaking change that I hope people can agree is just a bugfix for an extremely dark corner case. * To fix five of the builtins, this changes `syntax::ext::base::get_single_str_from_tts` to accept a trailing comma, and revises the documentation so that this aspect is not surprising. **I made this change under the (hopefully correct) understanding that `libsyntax` is private rustc implementation detail.** After reviewing all call sites (which were, you guessed it, *precisely those five macros*), I believe the revised semantics are closer to the intended spirit of the function. ### Changes which may require concensus Up until now, it could be argued that some or all the following macros did not conceptually take a comma-separated list, because they only took one argument: * **`cfg(unix,)`** (most notable since cfg! is unique in taking a meta tag) * **`include{,_bytes,_str}("file.rs",)`** (in item form this might be written as "`include!{"file.rs",}`" which is even slightly more odd) * **`compile_error("message",);`** * **`option_env!("PATH",)`** * **`try!(Ok(()),)`** So I think these particular changes may require some sort of consensus. **All of the fixes for builtins are included this list, so if we want to defer these decisions to later then I can scale this PR back to just the first two commits.** ### Other notes/general requests for comment * Do we have a big checklist somewhere of "things to do when adding macros?" My hope is for `run-pass/macro-comma-support.rs` to remain comprehensive. * Originally I wanted the tests to also comprehensively forbid double trailing commas. However, this didn't work out too well: [see this gist and the giant FIXME in it](https://gist.github.com/ExpHP/6fc40e82f3d73267c4e590a9a94966f1#file-compile-fail_macro-comma-support-rs-L33-L50) * I did not touch `select!`. It appears to me to be a complete mess, and its trailing comma mishaps are only the tip of the iceberg. * There are [some compile-fail test cases](https://github.com/ExpHP/rust/blob/5fa97c35da2f0ee/src/test/compile-fail/macro-comma-behavior.rs#L49-L52) that didn't seem to work (rustc emits errors, but compile-fail doesn't acknowledge them), so they are disabled. Any clues? (Possibly related: These happen to be precisely the set of errors which are tagged by rustc as "this error originates in a macro outside of the current crate".) --- Fixes #48042 Closes #46241
2018-02-10fix typos in src/{bootstrap,ci,etc,lib{backtrace,core,fmt_macros}}Matthias Krüger-1/+1
2018-02-07update the builtin macro doc stubsMichael Lamparski-5/+20
2018-02-07libcore/libstd: fix commas in macro_rules! macrosMichael Lamparski-2/+15
BREAKING CHANGE: (or perhaps, *bugfix*) In #![no_std] applications, the following calls to `panic!` used to behave differently; they now behave the same. Old behavior: panic!("{{"); // panics with "{{" panic!("{{",); // panics with "{" New behavior: panic!("{{"); // panics with "{{" panic!("{{",); // panics with "{{" This only affects calls to `panic!` (and by proxy `assert` and `debug_assert`) with a single string literal followed by a trailing comma, and only in `#![no_std]` applications.
2018-01-04Make examples equivalentaheart-0/+1
The example with the ? operator was missing file.write_all
2017-12-07Rollup merge of #46416 - liigo:cfg-macro, r=steveklabnikGuillaume Gomez-1/+1
doc: macro `cfg!` evaluating at compile-time
2017-12-04Give compile_error macro examplesHavvy-2/+2
2017-12-01doc: macro `cfg!` evaluating at compile-timeLiigo Zhuang-1/+1
2017-11-26Update libcore macro stubs like libstdMichael Lamparski-6/+14
2017-11-20Fix some docs summary nitsMarco A L Barbosa-1/+1
2017-11-09Allow a trailing comma in assert_eq/ne macroKonrad Borowski-0/+6
2017-10-22fix stringify docsAlex Burka-2/+2
2017-09-10Use rvalue promotion to 'static instead of static items.Eduard-Mihai Burtescu-10/+3
2017-09-02Merge branch 'master' of git://github.com/rust-lang/rustMarkMcCaskey-10/+0
2017-08-31Merge branch 'master' into masterMark-12/+35
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-30update unimplemented! docsMarkMcCaskey-2/+5
2017-08-29API docs: macros. Part of #29329 Standard Library Documentation Checklist.Andy Gauge-14/+42