Commit Graph

1319 Commits

Author SHA1 Message Date
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
Josh Stone fc150d17b5 Expand FlattenCompat folds
The former `chain`+`chain`+`fold` implementation looked nice from a
functional-programming perspective, but it introduced unnecessary layers
of abstraction on every `flat_map`/`flatten` fold. It's straightforward
to just fold each part in turn, and this makes it look like a simplified
version of the existing `try_fold` implementation.

For the `iter::bench_flat_map*` benchmarks, I get a large improvement in
`bench_flat_map_chain_sum`, from 1,598,473 ns/iter to 499,889 ns/iter,
and the rest are unchanged.
2021-02-15 11:52:28 -08: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
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 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 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
bjorn3 d1a541e342 Add tests for Atomic*::fetch_{min,max} 2021-02-14 11:31:33 +01: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.

![image](https://user-images.githubusercontent.com/1297598/106717890-94f43e80-6600-11eb-9428-2cd425823df9.png)
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
Lzu Tao 010e194d6e Specialize slice::fill for Copy type and u8/i8/bool 2021-02-08 11:32:18 +00:00
bors 4940dd483a Auto merge of #80962 - jhpratt:const_int_fn-stabilization, r=dtolnay
Stabilize remaining integer methods as `const fn`

This pull request stabilizes the following methods as `const fn`:

- `i*::checked_div`
- `i*::checked_div_euclid`
- `i*::checked_rem`
- `i*::checked_rem_euclid`
- `i*::div_euclid`
- `i*::overflowing_div`
- `i*::overflowing_div_euclid`
- `i*::overflowing_rem`
- `i*::overflowing_rem_euclid`
- `i*::rem_euclid`
- `i*::wrapping_div`
- `i*::wrapping_div_euclid`
- `i*::wrapping_rem`
- `i*::wrapping_rem_euclid`
- `u*::checked_div`
- `u*::checked_div_euclid`
- `u*::checked_rem`
- `u*::checked_rem_euclid`
- `u*::div_euclid`
- `u*::overflowing_div`
- `u*::overflowing_div_euclid`
- `u*::overflowing_rem`
- `u*::overflowing_rem_euclid`
- `u*::rem_euclid`
- `u*::wrapping_div`
- `u*::wrapping_div_euclid`
- `u*::wrapping_rem`
- `u*::wrapping_rem_euclid`

These can all be implemented on the current stable (1.49). There are two unstable details: const likely/unlikely and unchecked division/remainder. Both of these are for optimizations, and are in no way required to make the methods function; there is no exposure of these details publicly. Per comments below, it seems best practice is to stabilize the intrinsics. As such, `intrinsics::unchecked_div` and `intrinsics::unchecked_rem` have been stabilized as `const` as part of this pull request as well. The methods themselves remain unstable.

I believe part of the reason these were not stabilized previously was the behavior around division by 0 and modulo 0. After testing on nightly, the diagnostic for something like `const _: i8 = 5i8 % 0i8;` is similar to that of `const _: i8 = 5i8.rem_euclid(0i8);` (assuming the appropriate feature flag is enabled). As such, I believe these methods are ready to be stabilized as `const fn`.

This pull request represents the final methods mentioned in #53718. As such, this PR closes #53718.

`@rustbot` modify labels to +A-const-fn, +T-libs
2021-02-08 05:05:55 +00:00
Ibraheem Ahmed 1dac9a1d78 fix formatting of std::iter::Map 2021-02-07 21:16:25 -05:00
bors 9778068cbc Auto merge of #79078 - petrochenkov:derattr, r=Aaron1011
expand/resolve: Turn `#[derive]` into a regular macro attribute

This PR turns `#[derive]` into a regular attribute macro declared in libcore and defined in `rustc_builtin_macros`, like it was previously done with other "active" attributes in https://github.com/rust-lang/rust/pull/62086, https://github.com/rust-lang/rust/pull/62735 and other PRs.
This PR is also a continuation of #65252, #69870 and other PRs linked from them, which layed the ground for converting `#[derive]` specifically.

`#[derive]` still asks `rustc_resolve` to resolve paths inside `derive(...)`, and `rustc_expand` gets those resolution results through some backdoor (which I'll try to address later), but otherwise `#[derive]` is treated as any other macro attributes, which simplifies the resolution-expansion infra pretty significantly.

The change has several observable effects on language and library.
Some of the language changes are **feature-gated** by [`feature(macro_attributes_in_derive_output)`](https://github.com/rust-lang/rust/issues/81119).

#### Library

- `derive` is now available through standard library as `{core,std}::prelude::v1::derive`.

#### Language

- `derive` now goes through name resolution, so it can now be renamed - `use derive as my_derive; #[my_derive(Debug)] struct S;`.
- `derive` now goes through name resolution, so this resolution can fail in corner cases. Crater found one such regression, where import `use foo as derive` goes into a cycle with `#[derive(Something)]`.
- **[feature-gated]** `#[derive]` is now expanded as any other attributes in left-to-right order. This allows to remove the restriction on other macro attributes following `#[derive]` (https://github.com/rust-lang/reference/issues/566). The following macro attributes become a part of the derive's input (this is not a change, non-macro attributes following `#[derive]` were treated in the same way previously).
- `#[derive]` is now expanded as any other attributes in left-to-right order. This means two derive attributes `#[derive(Foo)] #[derive(Bar)]` are now expanded separately rather than together. It doesn't generally make difference, except for esoteric cases. For example `#[derive(Foo)]` can now produce an import bringing `Bar` into scope, but previously both `Foo` and `Bar` were required to be resolved before expanding any of them.
- **[feature-gated]** `#[derive()]` (with empty list in parentheses) actually becomes useful. For historical reasons `#[derive]` *fully configures* its input, eagerly evaluating `cfg` everywhere in its target, for example on fields.
Expansion infra doesn't do that for other attributes, but now when macro attributes attributes are allowed to be written after `#[derive]`, it means that derive can *fully configure* items for them.
    ```rust
	#[derive()]
	#[my_attr]
	struct S {
		#[cfg(FALSE)] // this field in removed by `#[derive()]` and not observed by `#[my_attr]`
		field: u8
	}
    ```
- `#[derive]` on some non-item targets is now prohibited. This was accidentally allowed as noop in the past, but was warned about since early 2018 (#50092), despite that crater found a few such cases in unmaintained crates.
- Derive helper attributes used before their introduction are now reported with a deprecation lint. This change is long overdue (since macro modularization, https://github.com/rust-lang/rust/issues/52226#issuecomment-422605033), but it was hard to do without fixing expansion order for derives. The deprecation is tracked by #79202.
```rust
    #[trait_helper] // warning: derive helper attribute is used before it is introduced
    #[derive(Trait)]
    struct S {}
```

Crater analysis: https://github.com/rust-lang/rust/pull/79078#issuecomment-731436821
2021-02-07 19:36:10 +00:00
Vadim Petrochenkov dbdbd30bf2 expand/resolve: Turn `#[derive]` into a regular macro attribute 2021-02-07 20:08:45 +03:00
Guillaume Gomez f706216251
Rollup merge of #81742 - sdroege:exact-size-iterator-correctness, r=kennytm
Add a note about the correctness and the effect on unsafe code to the `ExactSizeIterator` docs

As it is a safe trait it does not provide any guarantee that the
returned length is correct and as such unsafe code must not rely on it.

That's why `TrustedLen` exists.

Fixes https://github.com/rust-lang/rust/issues/81739
2021-02-07 14:45:51 +01:00
Scott McMurray 1b7309edd6 Expand the docs for ops::ControlFlow a bit
Since I was writing some examples for an RFC anyway.
2021-02-06 22:36:05 -08:00
Giles Cope f30c51abe8
Pulling out constant. 2021-02-06 20:35:21 +00:00
Giles Cope f165f49d22
Slight perf improvement on char::to_ascii_lowercase 2021-02-06 19:56:43 +00:00
Mara Bos 43b3adb4e2
Rollup merge of #81580 - rodrimati1992:patch-2, r=dtolnay
Document how `MaybeUninit<Struct>` can be initialized.
2021-02-06 00:14:09 +01:00
Mara Bos cc882fc3be
Rollup merge of #80011 - Stupremee:stabilize-peekable-next-if, r=dtolnay
Stabilize `peekable_next_if`

This PR stabilizes the `peekable_next_if` feature

Resolves #72480
2021-02-06 00:14:06 +01:00
David Tolnay ceda547c68
Bump peekable_next_if to rust 1.51.0 2021-02-05 14:25:21 -08:00
Mara Bos e077dffaec
Rollup merge of #81767 - exrook:layout-error-stability, r=Mark-Simulacrum
Update LayoutError/LayoutErr stability attributes

`LayoutError` ended up not making it into 1.49.0, updating the stability attributes to reflect that.

I also pushed `LayoutErr` deprecation back a release to allow 2 releases before the deprecation comes into effect.

This change should be backported to beta.
2021-02-05 12:26:07 +01:00
Mara Bos ff3c85fd65
Rollup merge of #81730 - RustyYato:object-safe-allocator, r=Amanieu
Make `Allocator` object-safe

This allows rust-lang/wg-allocators#83: polymorphic allocators
2021-02-05 12:26:05 +01:00
Jacob Hughes 0c3a7d8b85 Update LayoutError/LayoutErr stability attributes 2021-02-04 19:02:57 -05:00
Mara Bos 113e27fcfc
Rollup merge of #81727 - m-ou-se:unstabilize-bits, r=Mark-Simulacrum
Revert stabilizing integer::BITS.

We agreed in the libs meeting just now to revert stablization, since the [breakage](https://github.com/rust-lang/rust/issues/81654) is significant throughout the ecosystem, through `lexical-core`.

cc https://github.com/rust-lang/rust/issues/76904

Fixes https://github.com/rust-lang/rust/issues/81654
2021-02-04 21:10:42 +01:00
Mara Bos 87b269ab66
Rollup merge of #81645 - m-ou-se:panic-lint, r=estebank,flip1995
Add lint for `panic!(123)` which is not accepted in Rust 2021.

This extends the `panic_fmt` lint to warn for all cases where the first argument cannot be interpreted as a format string, as will happen in Rust 2021.

It suggests to add `"{}",` to format the message as a string. In the case of `std::panic!()`, it also suggests the recently stabilized
`std::panic::panic_any()` function as an alternative.

It renames the lint to `non_fmt_panic` to match the lint naming guidelines.

![image](https://user-images.githubusercontent.com/783247/106520928-675ea680-64d5-11eb-81f7-d8fa48b93a0b.png)

This is part of #80162.

r? ```@estebank```
2021-02-04 21:10:36 +01:00
Mara Bos 24e0940169 Stabilize feature(iterator_fold_self): Iterator::reduce 2021-02-04 11:31:11 +01:00
Mara Bos 26af55f5c6 Improve documentation of Iterator::{fold, reduce}. 2021-02-04 11:30:42 +01:00
Mara Bos 5c056ed2f5 Rename Iterator::fold_first to reduce. 2021-02-04 11:30:42 +01:00
Sebastian Dröge f436630ac8 Add a note about the correctness and the effect on unsafe code to the `ExactSizeIterator` docs
As it is a safe trait it does not provide any guarantee that the
returned length is correct and as such unsafe code must not rely on it.

That's why `TrustedLen` exists.

Fixes https://github.com/rust-lang/rust/issues/81739
2021-02-04 11:31:31 +02:00
Sebastian Dröge 86a4b27475 Increment `self.index` before calling `Iterator::self.a.__iterator_get_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-04 10:23:01 +02:00
RustyYato d06384ac29
make Allocator object-safe
add test to ensure object-safety
This allows for runtime polymorphic allocators
2021-02-03 20:46:16 -05:00
Mara Bos 753b0b0b80 Update panic!() documentation about non-string panics. 2021-02-03 23:15:51 +01:00
Mara Bos 89882388d9 Revert stabilizing integer::BITS. 2021-02-03 22:23:58 +01:00
Konrad Borowski 35450365ac Add "every" as a doc alias for "all". 2021-02-03 09:13:27 +01:00
Guillaume Gomez b7501620d3
Rollup merge of #81573 - ehuss:cell-links, r=jackh726
Add some links to the cell docs.

This adds a few links to the cell module docs to make it a little easier to navigate to the types and functions it references.
2021-02-03 08:41:24 +01:00
Guillaume Gomez 7330a9ce32
Rollup merge of #81144 - nhwn:typo-map-while, r=jackh726
Fixed formatting typo in map_while docs

changes `` ` None` `` to ``[`None`]`` for consistency
2021-02-03 08:41:22 +01:00
Jack Huey 7f2eeb10c7
Rollup merge of #81647 - m-ou-se:assert-2021-fix, r=petrochenkov
Fix bug with assert!() calling the wrong edition of panic!().

The span of `panic!` produced by the `assert` macro did not carry the right edition. This changes `assert` to call the right version.

Also adds tests for the 2021 edition of panic and assert, that would've caught this.
2021-02-02 16:01:46 -05:00
Jack Huey d3304c8ac3
Rollup merge of #81588 - xfix:delete-doc-alias, r=Mark-Simulacrum
Add doc aliases for "delete"

This patch adds doc aliases for "delete". The added aliases are supposed to reference usages `delete` in other programming languages.

- `HashMap::remove`, `BTreeMap::remove` -> `Map#delete` and `delete` keyword in JavaScript.

- `HashSet::remove`, `BTreeSet::remove` -> `Set#delete` in JavaScript.

- `mem::drop` -> `delete` keyword in C++.

- `fs::remove_file`, `fs::remove_dir`, `fs::remove_dir_all`-> `File#delete` in Java, `File#delete` and `Dir#delete` in Ruby.

Before this change, searching for "delete" in documentation returned no results.
2021-02-02 16:01:41 -05:00
bors b81f5811f9 Auto merge of #80843 - Mark-Simulacrum:fmt-bump, r=petrochenkov
Bump rustfmt version
2021-02-02 14:52:53 +00:00
Mark Rousskov d5b760ba62 Bump rustfmt version
Also switches on formatting of the mir build module
2021-02-02 09:09:52 -05:00
Jonas Schievink 86d0e6d257
Rollup merge of #81599 - sdroege:fuse-trusted-len, r=m-ou-se
Implement `TrustedLen` for `Fuse<I: TrustedLen>`

This looks like it was simply forgotten.
2021-02-02 12:15:01 +01:00
Mara Bos ed1de99b4f Fix bug with assert!() calling the wrong edition of panic!().
The span of `panic!` produced by the `assert` macro did not carry the
right edition. This changes `assert` to call the right version.
2021-02-01 23:23:27 +01:00
bors e0d9f79399 Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov
Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: c5273bdfb2 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
2021-02-01 10:25:31 +00:00
Sebastian Dröge 12b605af88 Implement `TrustedLen` for `iter::Fuse<I: TrustedLen>` 2021-02-01 09:47:23 +02:00
Sebastian Dröge 99893346e8 Add SAFETY comment for the `TrustedRandomAccess` impl of `iter::Fuse` 2021-02-01 09:47:22 +02:00
rodrimati1992 21c2343d3f
Update comment about leaking 2021-01-31 14:20:04 -03:00
Ashley Mannix 8940a2652e stabilize int_bits_const 2021-01-31 21:50:47 +10:00
Konrad Borowski 15701f7531 Add doc aliases for "delete"
This patch adds doc aliases for "delete". The added aliases are
supposed to reference usages `delete` in other programming
languages.

- `HashMap::remove`, `BTreeMap::remove` -> `Map#delete` and `delete`
  keyword in JavaScript.

- `HashSet::remove`, `BTreeSet::remove` -> `Set#delete` in JavaScript.

- `mem::drop` -> `delete` keyword in C++.

- `fs::remove_file`, `fs::remove_dir`, `fs::remove_dir_all`
  -> `File#delete` in Java, `File#delete` and `Dir#delete` in Ruby.

Before this change, searching for "delete" in documentation
returned no results.
2021-01-31 11:07:37 +01:00
rodrimati1992 aa83e2aa04
Update maybe_uninit.rs 2021-01-31 01:56:53 -03:00
rodrimati1992 0974026a5d
Removed trailing whitespace 2021-01-31 01:37:48 -03:00
rodrimati1992 c351107cdc
Document how `MaybeUninit<Struct>` can be initialized. 2021-01-31 01:21:06 -03:00
Jonas Schievink 709710564a
Rollup merge of #81562 - the8472:improve-inplaceiterable-docs, r=sfackler
Clarify that InPlaceIterable guarantees extend to all advancing iterator methods.

A documentation update that should answer a question that came up in [this zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Safety.20guarantees.20of.20InPlaceIterable/near/223743336)

CC `@SkiFire13`
2021-01-31 01:47:46 +01:00