Giacomo Stevanato
61bb1836f8
Optimize Iterator::is_sorted_by by using Iterator::all for internal iteration
2021-02-16 21:49:56 +01:00
Manish Goregaokar
a98b22c837
Add caveat to Path::display() about lossiness
2021-02-16 11:45:46 -08:00
Peter Todd
3a03cbc9dd
[Minor] Update discriminant_value docs
2021-02-16 08:16:31 -05:00
bjorn3
dfdadad228
Ignore Atomic*::fetch_{min,max} tests on ARM
2021-02-16 09:45:27 +01:00
bors
f1c47c79fe
Auto merge of #82058 - gilescope:to_digit_speedup, r=lcnr
...
no need to check assertion on fast path as will always hold.
V small change. Easy to review though!
2021-02-16 08:38:11 +00:00
Teddy Katz
cb653b100c
Document that assert!
format arguments are evaluated lazily
...
It can be useful to do some computation in `assert!` format arguments, in order to get better error messages. For example:
```rust
assert!(
some_condition,
"The state is invalid. Details: {}",
expensive_call_to_get_debugging_info(),
);
```
It seems like `assert!` only evaluates the format arguments if the assertion fails, which is useful but doesn't appear to be documented anywhere. This PR documents the behavior and adds some tests.
2021-02-16 00:55:46 -05:00
Lukas Kalbertodt
c675af82b4
Add internal collect_into_array[_unchecked]
to remove duplicate code
...
This does not suggest adding such a function to the public API. This is
just for the purpose of avoiding duplicate code. Many array methods
already contained the same kind of code and there are still many array
related methods to come (e.g. `Iterator::{chunks, map_windows, next_n,
...}`) which all basically need this functionality. Writing custom
`unsafe` code for each of those seems not like a good idea.
2021-02-15 17:52:33 +01:00
Jonas Schievink
c87ef218f9
Rollup merge of #82120 - sfackler:arguments-as-str, r=dtolnay
...
Stabilize Arguments::as_str
Closes #74442
2021-02-15 16:07:08 +01:00
Jonas Schievink
2030a54f9d
Rollup merge of #82119 - m-ou-se:typo, r=dtolnay
...
Fix typo in link to CreateSymbolicLinkW documentation.
2021-02-15 16:07:06 +01:00
Jonas Schievink
b0bd056bc9
Rollup merge of #82118 - lukaslueg:env_decl, r=m-ou-se
...
Add missing env!-decl variant
Resolves #82117
2021-02-15 16:07:05 +01:00
Jonas Schievink
7842b5d2ec
Rollup merge of #82063 - NULLx76:fix-minor-typo, r=jonas-schievink
...
Fixed minor typo in catch_unwind docs
Changed "a an exception" to "an exception" inside of the `std::panic::catch_unwind` docs.
2021-02-15 16:06:58 +01:00
Jonas Schievink
c7ebc590da
Rollup merge of #82060 - taiki-e:typo, r=m-ou-se
...
Fix typos in BTreeSet::{first, last} docs
map -> set
2021-02-15 16:06:56 +01:00
Jonas Schievink
bd0e8a5df3
Rollup merge of #81975 - Amanieu:seal2, r=m-ou-se
...
Seal the CommandExt, OsStrExt and OsStringExt traits
A crater run (https://github.com/rust-lang/rust/pull/81213#issuecomment-767651811 ) has shown that this does not break any existing code.
This also unblocks #77728 .
Based on #81213 .
r? ````@m-ou-se````
cc ````@lygstate````
2021-02-15 16:06:54 +01:00
Simon Sapin
cac71bf809
Use local path for already-imported function
...
This module has `use super::*;` at the top.
Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
2021-02-15 14:27:52 +01:00
Simon Sapin
cf000f0408
Pointer metadata: add tracking issue number
2021-02-15 14:27:51 +01:00
Simon Sapin
5ade3fe32c
Add a ThinBox library as a libcore test for pointer metadata APIs
2021-02-15 14:27:51 +01:00
Simon Sapin
21ceebf296
Fix intra-doc link to raw pointer method
...
CC https://github.com/rust-lang/rust/pull/80181
2021-02-15 14:27:50 +01:00
Simon Sapin
642486c2b2
Fix libcore unit tests in stage 0
2021-02-15 14:27:48 +01:00
Simon Sapin
3ea7f1504c
More doc-comments for pointer metadata APIs
2021-02-15 14:27:34 +01:00
Simon Sapin
787f4de6ab
Use new pointer metadata API inside libcore instead of manual transmutes
2021-02-15 14:27:34 +01:00
Simon Sapin
c0e3a1b096
Add to_raw_parts
methods to *const
, *mut
, and NonNull
...
These are not named `into_` because they do not consume their receiver
since raw pointers are `Copy`.
2021-02-15 14:27:33 +01:00
Simon Sapin
937d580a25
Add ptr::from_raw_parts
, ptr::from_raw_parts_mut
, and NonNull::from_raw_parts
...
The use of module-level functions instead of associated functions
on `<*const T>` or `<*mut T>` follows the precedent of
`ptr::slice_from_raw_parts` and `ptr::slice_from_raw_parts_mut`.
2021-02-15 14:27:31 +01:00
Simon Sapin
9ab83b9338
Add size_of
, align_of
, and layout
methods to DynMetadata
2021-02-15 14:27:17 +01:00
Simon Sapin
b1e15fa8a2
Parameterize DynMetadata
over its dyn SomeTrait
type
2021-02-15 14:27:16 +01:00
Simon Sapin
696b239f72
Add ptr::Pointee
trait (for all types) and ptr::metadata
function
...
RFC: https://github.com/rust-lang/rfcs/pull/2580
2021-02-15 14:27:12 +01:00
Squirrel
d2ba68b24e
Update methods.rs
...
Remove unused const
2021-02-15 07:39:15 +00:00
Squirrel
17e238d78e
Use wrapping sub
...
Co-authored-by: Mara <m-ou.se@m-ou.se>
2021-02-15 07:35:28 +00:00
Steven Fackler
4613b3764c
Stabilize Arguments::as_str
...
Closes #74442
2021-02-14 17:48:51 -05:00
Alphyr
a357d86b7c
Hide internals items in documentation
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-14 23:39:43 +01:00
Benoît du Garreau
546d062820
Apply suggestions
...
- Move `assert_failed` to core::panicking`
- Make `assert_failed` use an enum instead of a string
2021-02-14 23:39:42 +01:00
Benoît du Garreau
f138e260a0
Apply suggestion
2021-02-14 23:39:42 +01:00
Benoît du Garreau
52197d356c
Fix UI tests and merge assert_eq
and assert_ne
internal functions
2021-02-14 23:39:31 +01:00
lukaslueg
3d7fcfff76
Update library/core/src/macros/mod.rs
...
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-14 23:33:43 +01:00
Mara Bos
1aa965101c
Fix typo in link to CreateSymbolicLinkW documentation.
2021-02-14 23:16:45 +01:00
Mara Bos
053769dd53
Use #[rustc_inherit_overflow_checks]
instead of Add::add etc.
2021-02-14 23:06:36 +01:00
Benoît du Garreau
bbad2b2182
Improve assert_eq! and assert_ne!
...
It should improve compile times and reduce instruction cache use by moving the
panic formatting to a monomorphised function
2021-02-14 23:04:41 +01:00
Lukas Lueg
dee54244a6
Add missing env!-decl variant
...
Resolves #82117
2021-02-14 22:39:47 +01:00
Giles Cope
845c14db05
Simpler way to convert to digit
2021-02-14 17:06:16 +00:00
Dylan DPC
4e888bf403
Rollup merge of #81919 - ssomers:btree_cleanup_comments, r=Mark-Simulacrum
...
BTreeMap: fix internal comments
Salvaged from #81372
r? `@Mark-Simulacrum`
2021-02-14 16:54:49 +01:00
bjorn3
d1a541e342
Add tests for Atomic*::fetch_{min,max}
2021-02-14 11:31:33 +01:00
bors
b86674e7cc
Auto merge of #81956 - ssomers:btree_post_75200, r=Mark-Simulacrum
...
BTree: remove outdated traces of coercions
The introduction of `marker::ValMut` (#75200 ) meant iterators no longer see mutable keys but their code still pretends it does. And settle on the majority style `Some(unsafe {…})` over `unsafe { Some(…) }`.
r? `@Mark-Simulacrum`
2021-02-14 04:53:24 +00:00
bors
8e54a21139
Auto merge of #81238 - RalfJung:copy-intrinsics, r=m-ou-se
...
directly expose copy and copy_nonoverlapping intrinsics
This effectively un-does https://github.com/rust-lang/rust/pull/57997 . That should help with `ptr::read` codegen in debug builds (and any other of these low-level functions that bottoms out at `copy`/`copy_nonoverlapping`), where the wrapper function will not get inlined. See the discussion in https://github.com/rust-lang/rust/pull/80290 and https://github.com/rust-lang/rust/issues/81163 .
Cc `@bjorn3` `@therealprof`
2021-02-13 20:30:07 +00:00
Matthew Jasper
9bbd3e0f8e
Remove ProjectionTy::from_ref_and_name
2021-02-13 19:29:55 +00:00
bors
3c10a880ec
Auto merge of #81494 - cuviper:btree-node-init, r=Mark-Simulacrum
...
Initialize BTree nodes directly in the heap
We can avoid any stack-local nodes entirely by using `Box::new_uninit`, and since the nodes are mostly `MaybeUninit` fields, we only need a couple of actual writes before `assume_init`. This should help with the stack overflows in #81444 , and may also improve performance in general.
r? `@Mark-Simulacrum`
cc `@ssomers`
2021-02-13 17:29:22 +00:00
Victor Roest
ee9709fae6
Fixed minor typo in catch_unwind docs
...
Changed 'a an exception' to 'an exception'
2021-02-13 16:59:06 +01:00
Taiki Endo
dd9db236cd
Fix typos in BTreeSet::{first, last} docs
2021-02-13 22:49:46 +09:00
Giles Cope
b70428b9fb
no need to check assertion on fast path.
2021-02-13 12:25:56 +00:00
bors
3158857297
Auto merge of #81854 - the8472:specialize-clone-slice, r=Mark-Simulacrum
...
specialize slice::clone_from_slice() for T: Copy
2021-02-13 10:55:19 +00:00
Yuki Okushi
0ca5fd7ebc
Rollup merge of #82050 - hbina:fix/added-test-to-drain-empty-vec, r=dtolnay
...
Added tests to drain an empty vec
Discovered this kind of issue in an unrelated library.
The author copied the tests from here and AFAIK, there are no tests for this particular case.
https://github.com/LeonineKing1199/minivec/pull/19
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-02-13 16:36:52 +09:00
Yuki Okushi
2673026995
Rollup merge of #82041 - notriddle:shared-from-slice-docs, r=m-ou-se
...
Add docs for shared_from_slice From impls
The advantage of making these docs is mostly in pointing out that these
functions all make new allocations and copy/clone/move the source into them.
These docs are on the function, and not the `impl` block, to avoid showing
the "[+] show undocumented items" button.
CC #51430
2021-02-13 16:36:51 +09:00