Tomasz Miąsko
dc3304c341
Turn may_have_side_effect into an associated constant
...
The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess`
trait. It describes if obtaining an iterator element may have side effects. It
is currently implemented as an associated function.
Turn `may_have_side_effect` into an associated constant. This makes the
value immediately available to the optimizer.
2021-02-15 17:36:29 +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
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
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
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
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
33d8b04568
Move const def nearer usage.
2021-02-14 18:23:30 +00:00
Giles Cope
845c14db05
Simpler way to convert to digit
2021-02-14 17:06:16 +00:00
Camelid
c1df9f1b6b
Add basic usage example
2021-02-13 21:25:41 -08: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
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
dylni
5d519eaa6e
Rename Range::ensure_subset_of to slice::range
2021-02-12 22:01:04 -05:00
dylni
cb647f3e8e
Fix possible soundness issue in ensure_subset_of
2021-02-12 22:01:04 -05:00
dylni
9d29793614
Improve design of assert_len
2021-02-12 22:01:04 -05:00
Dylan DPC
0cfba2fd09
Rollup merge of #81741 - sdroege:zip-trusted-random-access-specialization-panic-safety, r=KodrAus
...
Increment `self.index` before calling `Iterator::self.a.__iterator_ge…
…`t_unchecked` in `Zip` `TrustedRandomAccess` specialization
Otherwise if `Iterator::self.a.__iterator_get_unchecked` panics the
index would not have been incremented yet and another call to
`Iterator::next` would read from the same index again, which is not
allowed according to the API contract of `TrustedRandomAccess` for
`!Clone`.
Fixes https://github.com/rust-lang/rust/issues/81740
2021-02-12 22:53:32 +01:00
Dylan DPC
8280abc57b
Rollup merge of #81012 - VillSnow:stabilize_partition_point, r=matklad
...
Stabilize the partition_point feature
Stabilize the partition_point feature.
Tracking Issue: #73831
First PR: #73577
2021-02-12 22:53:28 +01:00
Giles Cope
daa55acdb0
Slightly more explicit
2021-02-12 13:42:42 +00:00
VillSnow
afdc8c7918
stabilize partition_point
2021-02-12 21:57:17 +09:00
VillSnow
de21cdf792
update documents
2021-02-12 21:57:17 +09:00
Yuki Okushi
0b6876cbe7
Rollup merge of #79983 - petar-dambovaliev:master, r=Dylan-DPC
...
fix indefinite article in cell.rs
2021-02-12 19:32:06 +09:00
Casey Rodarmor
66f4883308
[librustdoc] Reform lang string token splitting
...
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to
preserve backwards compatibility with pandoc-style langstrings, strip a
surrounding `{}`, and remove leading `.`s from each token.
Prior to this change, doctest lang strings were split on all
non-alphanumeric characters except `-` or `_`, which limited future
extensions to doctest lang string tokens, for example using `=` for
key-value tokens.
This is a breaking change, although it is not expected to be disruptive,
because lang strings using separators other than `,` and ` ` are not
very common
2021-02-12 00:02:52 -08:00
Jacob Pratt
c28f2a8bee
Stabilize str_split_once
2021-02-09 23:17:11 -05:00
Yuki Okushi
bf0c2d5382
Rollup merge of #81904 - jhpratt:const_int_fn-stabilization, r=jyn514
...
Bump stabilization version for const int methods
These methods missed the beta cutoff. See #80962 for details.
`@rustbot` modify labels to +A-const-fn, +A-intrinsics
r? `@m-ou-se`
2021-02-10 12:24:23 +09:00
Dylan DPC
a63085dc5e
Rollup merge of #81849 - scottmcm:control-flow-comments, r=Mark-Simulacrum
...
Expand the docs for ops::ControlFlow a bit
Since I was writing some examples for an RFC anyway.
And I almost made the mistake of reordering the variants, so added a note and a test about that.
2021-02-09 02:39:59 +01:00
Dylan DPC
52bc54efff
Rollup merge of #81697 - xfix:every-doc-alias, r=Mark-Simulacrum
...
Add "every" as a doc alias for "all".
This matches [Array#every](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every ) in JavaScript.
Oddly enough, `core::iter::Iterator::all` appears twice. This appears to be a rustdoc bug which I decided to fill in as #81696 .

2021-02-09 02:39:51 +01:00
Jacob Pratt
1b32a7a4cf
Bump stabilization version for const int methods
...
These methods missed the beta cutoff
2021-02-08 19:26:01 -05:00
The8472
130fb243bd
specialize slice::clone_from_slice() for T: Copy
2021-02-09 00:37:37 +01:00
Mara Bos
98aec1582b
Rollup merge of #81840 - ibraheemdev:patch-1, r=dtolnay
...
fix formatting of std::iter::Map
2021-02-08 19:28:22 +01:00
Giles Cope
cadcf5ed99
Unify way to flip 6th bit. (Same assembly generated)
2021-02-08 12:21:36 +00:00
Jad Ghalayini
f847ff1511
Added #[repr(transparent)] to core::cmp::Reverse
2021-02-08 12:07:59 +00:00
Lzu Tao
010e194d6e
Specialize slice::fill for Copy type and u8/i8/bool
2021-02-08 11:32:18 +00:00