summary refs log tree commit diff
path: root/src/libcore/macros.rs
AgeCommit message (Collapse)AuthorLines
2017-04-18Fix a few stability attributesOliver Middleton-5/+5
These show up in rustdoc so need to be correct.
2017-03-30Improve the docs for the write and writeln macrosSam Whited-38/+16
This change reduces duplication by linking the documentation for `writeln!` to `write!`. It also restructures the `write!` documentation to read in a more logical manner. Updates #29329, #29381
2017-03-13Remove function invokation parens from documentation links.Corey Farwell-2/+2
This was never established as a convention we should follow in the 'More API Documentation Conventions' RFC: https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md
2017-03-07Add missing urls in some macros docGuillaume Gomez-7/+16
2017-02-06improve error message when two-arg assert_eq! receives a trailing commaZack M. Davis-6/+6
Previously, `assert_eq!(left, right,)` (respectively, `assert_ne!(left, right,)`; note the trailing comma) would result in a confusing "requires at least a format string argument" error. In reality, a format string is optional, but the trailing comma puts us into the "match a token tree of zero or more tokens" branch of the macro (in order to support the optional format string), and passing the empty token tree into `format_args!` results in the confusing error. If instead we match a token tree of one or more tokens, we get a much more sensible "unexpected end of macro invocation" error. While we're here, fix up a stray space before a comma in the match guards. Resolves #39369.
2017-01-11Document the optional extra arguments to assert_eq!() / assert_ne!()Federico Mena Quintero-1/+12
And clarify that those arguments in assert!() are in fact formattable.
2016-12-19Allow `writeln!` without arguments, in symmetry with `println!`Tobias Bucher-1/+5
2016-11-12Fix invalid src urlGuillaume Gomez-2/+15
2016-11-09Rollup merge of #37472 - joshtriplett:doc-fmt-write-io-write, r=brsonEduard-Mihai Burtescu-0/+30
Document convention for using both fmt::Write and io::Write Using a trait's methods (like `Write::write_fmt` as used in `writeln!` and other macros) requires importing that trait directly (not just the module containing it). Both `fmt::Write` and `io::Write` provide compatible `Write::write_fmt` methods, and code can use `writeln!` and other macros on both an object implementing `fmt::Write` (such as a `String`) and an object implementing `io::Write` (such as `Stderr`). However, importing both `Write` traits produces an error due to the name conflict. The convention I've seen renames both of them on import, to `FmtWrite` and `IoWrite` respectively. Document that convention in the Rust documentation for `write!` and `writeln!`, with examples.
2016-11-02Rollup merge of #37473 - joshtriplett:doc-copyedit-write-writeln, r=alexcrichtonJonathan Turner-18/+20
Copyediting on documentation for write! and writeln! Fix various sentence fragments, missing articles, and other grammatical issues in the documentation for write! and writeln!. Also fix the links (and link names) for common return types. (Noticed when preparing https://github.com/rust-lang/rust/pull/37472 ; posted separately to avoid mixing the new documentation with copyedits to existing documentation.)
2016-11-01Rollup merge of #37316 - ollie27:docs_links, r=GuillaumeGomezGuillaume Gomez-3/+4
Fix a few links in the docs r? @steveklabnik
2016-10-29Copyediting on documentation for write! and writeln!Josh Triplett-18/+20
Fix various sentence fragments, missing articles, and other grammatical issues in the documentation for write! and writeln!. Also fix the links (and link names) for common return types.
2016-10-29Add documentation to write! and writeln! on using both io::Write and fmt::WriteJosh Triplett-0/+30
Various existing code does this, but the documentation doesn't explain how to do it.
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 doc change for include!Артём Павлов [Artyom Pavlov]-3/+1
2016-10-21libcore documentation for builtin macrosАртём Павлов [Artyom Pavlov]-0/+142
2016-10-21Fix a few links in the docsOliver Middleton-3/+4
2016-10-12Review changesNick Cameron-1/+1
2016-10-12Stabilise `?`Nick Cameron-0/+3
cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)
2016-09-21add assert_ne and debug_assert_ne macrosAshley Williams-0/+63
2016-09-01Document try!'s error conversion behaviourFlorian Gilcher-7/+26
2016-08-04Be more explicit about duck typingCengiz Can-20/+24
2016-08-04Use consistent spelling for word 'implementor'Cengiz Can-4/+4
2016-08-04Provide a cleaner documentation for 'write!'Cengiz Can-6/+31
2016-07-27Mention debug_assert! in assert! docPanashe M. Fundira-1/+2
2016-07-27Revert section about panic! in assert! docPanashe M. Fundira-3/+2
2016-07-27Correct minor typo in debug_assert docPanashe M. Fundira-1/+1
2016-07-27Update docs for assert! and debug_assert!Panashe M. Fundira-2/+20
2016-07-12doc: Mention that writeln! and println! always use LFMike Hommey-0/+2
Fixes #34697
2016-06-21Add message argument to `assert_eq` macroMitsunori Komatsu-1/+12
2016-05-18Remove unnecessary parens in macroSeo Sanghyeon-1/+1
2016-04-12Clarify try! doc exampleSzabolcs Berecz-1/+1
The original is correct, but a bit misleading.
2016-03-08doc: Fix a bunch of broken linksAlex Crichton-4/+4
A few categories: * Links into compiler docs were just all removed as we're not generating compiler docs. * Move up one more level to forcibly go to std docs to fix inlined documentation across the facade crates.
2015-12-29Correct the documentation of debug_assert_eqSteve Klabnik-3/+3
Also, make its panic description identical in wording to assert_eq. Fixes #30600
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-14/+38
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-12Auto merge of #29544 - Ryman:reduce_doc_warnings, r=steveklabnikbors-0/+2
Did this alphabetically, so I didn't see [how `std` was doing things](https://dxr.mozilla.org/rust/source/src/libstd/lib.rs#215) till I was nearly finished. If you prefer to add crate-level-whitelists like std instead of test-level, I can rebase with that strategy. A number of these commits can probably be dropped as the crates don't have much to test, and are deprecated. Let me know which if any to drop! (can also squash after review if desired) r? @steveklabnik
2015-11-12Auto merge of #29770 - ollie27:assert_eq_unsized, r=alexcrichtonbors-1/+1
`format_args!` doesn't support none Sized types so we should just pass it the references to `left_val` and `right_val`. The following works: ```rust assert!([1, 2, 3][..] == vec![1, 2, 3][..]) ``` So I would expect this to as well: ```rust assert_eq!([1, 2, 3][..], vec![1, 2, 3][..]) ``` But it fails with "error: the trait `core::marker::Sized` is not implemented for the type `[_]` [E0277]" I don't know if this change will have any nasty side effects I don't understand.
2015-11-12libcore: deny warnings in doctestsKevin Butler-0/+2
2015-11-12docs: Fix variable nameKohei Hasegawa-6/+6
2015-11-11Allow none Sized types in assert_eq!Oliver Middleton-1/+1
format_args! doesn't support none Sized types so we should just pass it the references to left_val and right_val. This fixes `assert_eq!([1, 2, 3][..], vec![1, 2, 3][..])` for example.
2015-10-28Mention in the docs, that `assert!` has a second version with a custom messageMarcell Pardavi-0/+5
I recently discovered that this is not mentioned in the docs, only in the examples, and it's not evident for people coming from C++ r? @steveklabnik
2015-10-13Correct spelling in docsAndrew Paseltiner-1/+1
2015-10-09Improve docs for write!/writeln! macrosSteve Klabnik-4/+30
2015-08-28Auto merge of #28038 - durka:grep-unstable-issue-refs, r=alexcrichtonbors-2/+4
After submitting #28031, I ran a [script](https://gist.github.com/durka/a5243440697c780f669b) on the rest of src/ and found some anomalies. In this PR are the fixes that I thought were obvious (but I might be wrong!). The others I've submitted in issue #28037.
2015-08-27Some extra examples for the unimplemented! macroSteve Klabnik-0/+45
2015-08-27fix some more unstable issue annotationsAlex Burka-2/+4
2015-07-30Use $crate in core::panic!Chris Morgan-2/+2
2015-06-17core: Split apart the global `core` featureAlex Crichton-0/+1
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
2015-06-06Remove many unneeded feature annotations in the docsSteve Klabnik-3/+2
When things get stabilized, they don't always have their docs updated to remove the gate.
2015-05-13Writer -> Write in macro docsSteve Klabnik-1/+1
Fixes #25355