David Wood
7dee5f824d
hir: introduce lang items for AST lowering
...
This commit adds new lang items which will be used in AST lowering once
`QPath::LangItem` is introduced.
Co-authored-by: Matthew Jasper <mjjasper1@gmail.com >
Signed-off-by: David Wood <david@davidtw.co >
2020-08-16 15:42:23 +01:00
bors
243c725c24
Auto merge of #75561 - kornelski:stringcol, r=Dylan-DPC
...
Doc: String isn't a collection
On forums one user was confused by this text, interpreting it as saying that `String` is a `Vec<char>` literally, rather than figuratively for the purpose of collect. I've reworded that paragraph.
2020-08-16 06:26:38 +00:00
bors
9d38dc22e5
Auto merge of #75553 - denisvasilik:intra-doc-links-convert, r=jyn514
...
Move to intra-doc links for /library/core/src/char/convert.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
2020-08-16 04:31:05 +00:00
bors
86bccb684d
Auto merge of #75541 - camelid:intra-doc-links-for-core-option, r=jyn514
...
Switch to intra-doc links in `core::option`
Part of #75080 .
I didn't change some of the links since they link into `std` and you can't link from `core` to `std` (#74481 ).
Also, at least one other link can't be switched to an intra-doc link because it's not supported yet (#74489 ).
2020-08-16 02:39:21 +00:00
Denis Vasilik
14b50ede7d
Link to primitive instead of module
2020-08-15 19:27:34 +02:00
Kornel Lesiński
d5cb5eb08b
Doc: String isn't a collection
2020-08-15 17:55:10 +01:00
Camelid
8227b3b0b2
Remove unnecessary intra-doc link
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com >
2020-08-15 09:52:35 -07:00
Camelid
b02c4049cb
Fix link
...
Intra-doc links don't work yet in this case: #74489
2020-08-15 09:31:14 -07:00
Denis Vasilik
ebcb99ef8f
Use intra-doc links
2020-08-15 01:12:47 +02:00
Camelid
b1c05c5c2b
Switch to intra-doc links in core::option
2020-08-14 16:11:43 -07:00
Tyler Mandry
ad8c5e1480
Rollup merge of #75214 - chansuke:fix-intra-doc-links, r=jyn514
...
Use intra-doc links in `mem::manually_drop` & `mem::maybe_uninit`
This is partial fixes for https://github.com/rust-lang/rust/issues/75080 .
2020-08-14 14:46:47 -07:00
Denis Vasilik
75c1e2dfbb
Use intra-doc links
2020-08-14 20:50:38 +02:00
chansuke
61866bc60c
Use intra-doc links in mem::manually_drop & mem::maybe_uninit
2020-08-15 02:33:39 +09:00
bors
55b9adfafa
Auto merge of #75157 - rodrimati1992:patch-1, r=oli-obk
...
Constified str::from_utf8_unchecked
This would be useful for const code to use an array to construct a string using guaranteed utf8 inputs, and then create a `&str` from it.
2020-08-14 14:08:05 +00:00
Jack Champagne
9b0f3d1266
Fix documentation error
2020-08-13 16:58:50 -04:00
rodrimati1992
18377082f1
Fixed transmute argument
2020-08-13 16:08:22 -03:00
rodrimati1992
1767c8bdf0
Replaced union with transmute
2020-08-13 15:56:23 -03:00
Ralf Jung
7aac3e0400
pin docs: add some forward references
2020-08-13 14:41:04 +02:00
kadmin
af32db21c8
Add drop check test & MaybeUninit::first_ptr_mut
...
Also in drop check test add hacky workaround for platforms that don't support
panic=unwind
2020-08-13 03:51:08 +00:00
kadmin
412417d807
Rm hiding feature gate & add 1 more example
...
Update order docs for `map`
2020-08-13 03:51:05 +00:00
kadmin
54b821ebc0
Add tracking issue #75243
...
Add note & example about iter order
Add doc changes
Update doc comments
2020-08-13 03:51:01 +00:00
kadmin
56a651ca15
Add recommend changes to array
...
Switch from indexing to zip, and also use `write` on `MaybeUninit`.
Add array_map feature to core/src/lib
Attempt to fix issue of no such feature
Update w/ pickfire's review
This changes a couple of names around, adds another small test of variable size,
and hides the rustdoc #![feature(..)].
Fmt doctest
Add suggestions from lcnr
2020-08-13 03:50:59 +00:00
kadmin
f6411e4c66
Add Array Impl Lang Item in various places
...
Add basic test
And also run fmt which is where the other changes are from
Fix mut issues
These only appear when running tests, so resolved by adding mut
Swap order of forget
Add pub and rm guard impl
Add explicit type to guard
Add safety note
Change guard type from T to S
It should never have been T, as it guards over [MaybeUninit<S>; N]
Also add feature to test
2020-08-13 03:50:57 +00:00
kadmin
d8718183b2
Create lang item array and add map fn
...
This creates the language item for arrays, and adds the map fn which is like map in options or
iterators. It currently allocates an extra array, unfortunately.
Added fixme for transmuting
Fix typo
Add drop guard
2020-08-13 03:50:54 +00:00
CDirkx
6b0d44e92a
Make some Ordering methods const
...
Constify the following methods of `core::cmp::Ordering`:
- `reverse`
- `then`
Possible because of #49146 (Allow `if` and `match` in constants).
2020-08-12 22:10:32 +02:00
Lukas Kalbertodt
db99f98c3e
Put panic code path from copy_from_slice into cold function
...
The previous `assert_eq` generated quite some code, which is especially
problematic when this call is inlined. This commit also slightly
improves the panic message from:
assertion failed: `(left == right)`
left: `3`,
right: `2`: destination and source slices have different lengths
...to:
source slice length (2) does not match destination slice length (3)
2020-08-12 21:12:21 +02:00
Laurence Tratt
55802e3bf3
Add Rust function pointers.
...
Co-authored-by: Ralf Jung <post@ralfj.de >
2020-08-12 15:38:18 +00:00
Laurence Tratt
8cb8955d57
Change notation.
...
Co-authored-by: Ralf Jung <post@ralfj.de >
2020-08-12 15:19:46 +00:00
Laurence Tratt
f3d7196cae
Be clearer about Some/None transmute.
2020-08-12 15:53:58 +01:00
Laurence Tratt
83f47aa11b
Be clear about the reverse transmute guarantees.
2020-08-12 15:47:37 +01:00
Laurence Tratt
f5118a525f
Clarify and add guarantee about transmute.
2020-08-12 15:36:55 +01:00
bors
ded20c98be
Auto merge of #75066 - poliorcetics:document-unsafety-in-core-slice, r=LukasKalbertodt
...
Document unsafety in library/core/src/slice/mod.rs
Restart where #73555 left off, helping with #66219 .
2020-08-12 14:18:15 +00:00
Laurence Tratt
73ada2d404
Explicitly document the size guarantees that Option makes.
...
Triggered by a discussion on wg-unsafe-code-guidelines about which layouts of
`Option<T>` one can guarantee are optimised to a single pointer.
2020-08-12 15:07:38 +01:00
Denis Vasilik
4c5896fbeb
Remove intra-doc link as it resolves without reference link
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com >
2020-08-12 08:28:55 +02:00
Denis Vasilik
c4923419c2
Revert broken link
2020-08-11 23:54:51 +02:00
Denis Vasilik
3c2eb18b9b
Use intra-doc links
2020-08-11 22:16:31 +02:00
Poliorcetics
a308e74e13
Add some texts to make the tidy check for unsafe documentation pass
2020-08-11 21:37:22 +02:00
Alexis Bourget
91ba92b6df
Change safety comment for usize with the one from LukasKalbertodt review
2020-08-11 21:23:00 +02:00
oliver-giersch
19c9674966
mentions provenance, changes argument type, adds must_use attr
2020-08-11 16:14:34 +02:00
Oliver Scherer
34c3c0dae5
Make <*const T>::is_null const fn
2020-08-11 11:45:47 +02:00
Ivan Tham
8ec348afdd
Remove branch in optimized is_ascii
...
Performs slightly better in short or medium bytes by eliminating
the last branch check on `byte_pos == len` and always check the
last byte as it is always at most one `usize`.
Benchmark, before `libcore`, after `libcore_new`. It improves
medium and short by 1ns but regresses unaligned_tail by 2ns,
either way we can get unaligned_tail have a tiny chance of 1/8
on a 64 bit machine. I don't think we should bet on that, the
probability is worse than dice.
test long::case00_libcore ... bench: 38 ns/iter (+/- 1) = 183947 MB/s
test long::case00_libcore_new ... bench: 38 ns/iter (+/- 1) = 183947 MB/s
test long::case01_iter_all ... bench: 227 ns/iter (+/- 6) = 30792 MB/s
test long::case02_align_to ... bench: 40 ns/iter (+/- 1) = 174750 MB/s
test long::case03_align_to_unrolled ... bench: 19 ns/iter (+/- 1) = 367894 MB/s
test medium::case00_libcore ... bench: 5 ns/iter (+/- 0) = 6400 MB/s
test medium::case00_libcore_new ... bench: 4 ns/iter (+/- 0) = 8000 MB/s
test medium::case01_iter_all ... bench: 20 ns/iter (+/- 1) = 1600 MB/s
test medium::case02_align_to ... bench: 6 ns/iter (+/- 0) = 5333 MB/s
test medium::case03_align_to_unrolled ... bench: 5 ns/iter (+/- 0) = 6400 MB/s
test short::case00_libcore ... bench: 7 ns/iter (+/- 0) = 1000 MB/s
test short::case00_libcore_new ... bench: 6 ns/iter (+/- 0) = 1166 MB/s
test short::case01_iter_all ... bench: 5 ns/iter (+/- 0) = 1400 MB/s
test short::case02_align_to ... bench: 5 ns/iter (+/- 0) = 1400 MB/s
test short::case03_align_to_unrolled ... bench: 5 ns/iter (+/- 1) = 1400 MB/s
test unaligned_both::case00_libcore ... bench: 4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case00_libcore_new ... bench: 4 ns/iter (+/- 0) = 7500 MB/s
test unaligned_both::case01_iter_all ... bench: 26 ns/iter (+/- 0) = 1153 MB/s
test unaligned_both::case02_align_to ... bench: 13 ns/iter (+/- 2) = 2307 MB/s
test unaligned_both::case03_align_to_unrolled ... bench: 11 ns/iter (+/- 0) = 2727 MB/s
test unaligned_head::case00_libcore ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case00_libcore_new ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_head::case01_iter_all ... bench: 19 ns/iter (+/- 1) = 1631 MB/s
test unaligned_head::case02_align_to ... bench: 10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_head::case03_align_to_unrolled ... bench: 14 ns/iter (+/- 0) = 2214 MB/s
test unaligned_tail::case00_libcore ... bench: 3 ns/iter (+/- 0) = 10333 MB/s
test unaligned_tail::case00_libcore_new ... bench: 5 ns/iter (+/- 0) = 6200 MB/s
test unaligned_tail::case01_iter_all ... bench: 19 ns/iter (+/- 0) = 1631 MB/s
test unaligned_tail::case02_align_to ... bench: 10 ns/iter (+/- 0) = 3100 MB/s
test unaligned_tail::case03_align_to_unrolled ... bench: 13 ns/iter (+/- 0) = 2384 MB/s
Rough (unfair) maths on improvements for fun: 1ns * 7/8 - 2ns * 1/8 = 0.625ns
Inspired by fish and zsh clever trick to highlight missing linefeeds (⏎)
and branchless implementation of binary_search in rust.
2020-08-11 14:40:39 +08:00
Dylan DPC
0a738d41b1
Rollup merge of #75379 - denisvasilik:intra-docs-links-core-cmp, r=Dylan-DPC
...
Use intra-doc links in /library/core/src/cmp.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issues:
* Links from `core` to `std` (#74481 ):
* [`Vec::sort_by_key`]
2020-08-11 01:56:47 +02:00
Dylan DPC
d00c70363f
Rollup merge of #75369 - denisvasilik:intra-doc-links-core-borrow, r=Manishearth
...
Move to intra-doc links in /library/core/src/borrow.rs
Helps with #75080 .
@rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
Known issues:
* Links from `core` to `std` (#74481 ):
* [`Box<T>`]
* [`Mutex<T>`]
* [`Rc<T>`]
* [`String`]
* [`HashMap<K, V>`]
2020-08-11 01:56:45 +02:00
Denis Vasilik
eea85814e1
Use intra-doc links
2020-08-10 23:16:01 +02:00
Denis Vasilik
f260462c32
Remove links that are in scope
2020-08-10 23:14:43 +02:00
Denis Vasilik
d7e7271085
Remove AsRef link as it is in the prelude
2020-08-10 20:29:20 +02:00
Yuki Okushi
64d71095c3
Rollup merge of #75348 - denisvasilik:intra-doc-links-core-time, r=jyn514
...
Move to intra-doc links in library/core/src/time.rs
Helps with #75080 .
2020-08-10 09:08:01 +09:00
Denis Vasilik
9e71c13f28
Add link for Duration
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com >
2020-08-09 23:26:42 +02:00
Denis Vasilik
ce244210b1
Remove liNone as it is in the prelude
2020-08-09 23:12:30 +02:00
Denis Vasilik
7dba693f0e
Use intra-doc links
2020-08-09 23:06:44 +02:00