Commit graph

1842 commits

Author SHA1 Message Date
Mara Bos
f383e4f1d9
Rollup merge of #78757 - camelid:crate-link-text, r=jyn514
Improve and clean up some intra-doc links
2020-11-05 10:30:02 +01:00
Mara Bos
86e6afafe1
Rollup merge of #78738 - sasurau4:test/move-range-test-to-library-core, r=jyn514
Move range in ui test to ops test in library/core

Helps with #76268

r? ````@matklad````
2020-11-05 10:29:56 +01:00
Mara Bos
29fad213b2
Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getmut, r=RalfJung
Simplify the implementation of `get_mut` (no unsafe)

Quick PR to reduce one use of `unsafe` pointed out in the previous PR

r? ````@RalfJung````
2020-11-05 10:29:54 +01:00
Mara Bos
43e1b58bcc
Rollup merge of #78716 - est31:array_traits, r=Dylan-DPC
Array trait impl comment/doc fixes

Two small doc/comment fixes regarding trait implementations on arrays.
2020-11-05 10:29:46 +01:00
Mara Bos
6d7098f543
Rollup merge of #78465 - est31:proc_macro_to_string, r=jyn514
Change as_str → to_string in proc_macro::Ident::span() docs

There is no `as_str` function on Ident any more.

Also change it to an intra doc link while we're at it.
2020-11-05 10:29:42 +01:00
Mara Bos
99229337a8
Rollup merge of #78425 - chansuke:move_nan, r=jyn514
Move f64::NAN ui tests into `library`

This is a partial fix of #76268.

r? ```@matklad```
2020-11-05 10:29:40 +01:00
Mara Bos
10d2843604
Rollup merge of #78093 - camelid:as-cleanup, r=jyn514
Clean up docs for 'as' keyword
2020-11-05 10:29:38 +01:00
Mara Bos
55f4b802fb
Rollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514
Move Vec UI tests to unit tests when possible

Helps with #76268.

I'm moving the tests using `Vec` or `VecDeque`.

````@rustbot```` modify labels: A-testsuite C-cleanup T-libs
2020-11-05 10:29:35 +01:00
chansuke
f9b139f9c4 Add mod nan for test 2020-11-05 12:57:18 +09:00
Camelid
677b2acb48 Add missing comma
'Note however,' -> 'Note, however,'
2020-11-04 18:57:54 -08:00
Camelid
bbdb1f0f66 Clean up some intra-doc links 2020-11-04 18:57:52 -08:00
Camelid
3084a55d54 Don't use crate in link text
`crate::` -> `core::`

It looks weird to have `crate::` in the link text and we use the actual
crate name everywhere else.

If anyone is curious, I used this Vim command to update all the links:

    %s/\(\s\)\[`crate::\(.*\)`\]/\1[`core::\2`](crate::\2)/g
2020-11-04 18:44:40 -08:00
Camelid
d8afe98eba Clean up docs for 'as' keyword 2020-11-04 16:05:55 -08:00
chansuke
97d5a1be3f Fix format 2020-11-05 08:40:04 +09:00
chansuke
5855fb7b79 Move f64::NAN ui tests into library 2020-11-05 08:32:07 +09:00
Daiki Ihara
232b9ba129 Move range in ui test to ops test in library/core 2020-11-05 00:00:44 +09:00
Daniel Henry-Mantilla
69e5729c58 Simplify the implementation of get_mut (no unsafe) 2020-11-04 14:54:22 +01:00
est31
93fa023111 Fix outdated comment next to array_impl_default
The comment has become outdated as the array_impl macro
has been removed.
2020-11-04 12:21:22 +01:00
est31
5801109ba9 Move Copy and Clone into the list of traits implemented for all sizes 2020-11-04 01:28:37 +01:00
Yuki Okushi
9d4cdbbfcd
Rollup merge of #78664 - pickfire:patch-4, r=jonas-schievink
Fix intrinsic size_of stable link

I noticed that it is pointing to the same link when I was reading
https://github.com/rust-lang/rust-clippy/issues/2997
2020-11-03 15:27:18 +09:00
Vadim Petrochenkov
19dbb02a89 Expand NtExpr tokens only in key-value attributes 2020-11-03 00:53:43 +03:00
Ivan Tham
c83c635751
Fix intrinsic size_of stable link
I noticed that it is pointing to the same link when I was reading
https://github.com/rust-lang/rust-clippy/issues/2997
2020-11-02 16:03:23 +08:00
Yuki Okushi
50d7716efb
Rollup merge of #78637 - mystor:atomic_ptr_bool, r=m-ou-se
Add fetch_update methods to AtomicBool and AtomicPtr

These methods were stabilized for the integer atomics in #71843, but the methods were not added for the non-integer atomics `AtomicBool` and `AtomicPtr`.
2020-11-02 14:14:41 +09:00
Yuki Okushi
fb7948e7c1
Rollup merge of #78627 - est31:total_cmp_no_superset, r=m-ou-se
Point out that total_cmp is no strict superset of partial comparison

Partial comparison and total_cmp are not equal. This helps
preventing the mistake of creating float wrappers that
base their Ord impl on total_cmp and their PartialOrd impl on
the PartialOrd impl of the float type. PartialOrd and Ord
[are required to agree with each other](https://doc.rust-lang.org/std/cmp/trait.Ord.html#how-can-i-implement-ord).
2020-11-02 14:14:38 +09:00
Yuki Okushi
7baf48ffc0
Rollup merge of #78620 - gabhijit:bitops_doc_fix, r=m-ou-se
Trivial fixes to bitwise operator documentation

Added fixes to documentation of `BitAnd`, `BitOr`, `BitXor` and
`BitAndAssign`, where the documentation for implementation on
`Vector<bool>` was using logical operators in place of the bitwise
operators.

r? @steveklabnik
Closes #78619
2020-11-02 14:14:36 +09:00
Yuki Okushi
0fdb371d5a
Rollup merge of #78606 - autarch:patch-1, r=m-ou-se
Clarify handling of final line ending in str::lines()

I found the description as it stands a bit confusing. I've added a bit more explanation to make it clear that a trailing line ending does not produce a final empty line.
2020-11-02 14:14:33 +09:00
Nika Layzell
00f32e6631 Add fetch_update methods to AtomicBool and AtomicPtr
These methods were stabilized for the integer atomics in #71843, but the methods
were not added for the non-integer atomics `AtomicBool` and `AtomicPtr`.
2020-11-01 13:57:45 -05:00
est31
a79059d42d Point out that total_cmp is no strict superset of partial comparison
Partial comparison and total_cmp are not equal. This helps
preventing the mistake of creating float wrappers that
base their Ord impl on total_cmp and their PartialOrd impl on
the PartialOrd impl of the float type. PartialOrd and Ord
are required to agree with each other.
2020-11-01 18:45:17 +01:00
Dave Rolsky
b2d7b3aa26 Remove incorrect statement about line ending content in lines doc change 2020-11-01 09:11:20 -06:00
Abhijit Gadgil
d422e2424f documentation examples fixes in rustfmt convention 2020-11-01 18:53:22 +05:30
Mara Bos
97678b8358
Rollup merge of #78621 - solson:inline, r=m-ou-se
Inline Default::default() for atomics

Functions like `AtomicUsize::default()` are not cross-crate inlineable before this PR ([see assembly output here](https://play.rust-lang.org/?version=stable&mode=release&edition=2018&gist=e353321766418f759c69fb141d3732f8)), which can lead to unexpected performance issues when initializing a large array using this function, e.g. as seen [here](d513996a85/src/histogram.rs (L53)) which should turn into a simple loop writing zeroes but doesn't.

r? @m-ou-se
2020-11-01 11:53:39 +01:00
Mara Bos
8ed31d2782
Rollup merge of #78602 - RalfJung:raw-ptr-aliasing-issues, r=m-ou-se
fix various aliasing issues in the standard library

This fixes various cases where the standard library either used raw pointers after they were already invalidated by using the original reference again, or created raw pointers for one element of a slice and used it to access neighboring elements.
2020-11-01 11:53:36 +01:00
Mara Bos
f281a76f83
Rollup merge of #78599 - panstromek:master, r=m-ou-se
Add note to process::arg[s] that args shouldn't be escaped or quoted

This came out of discussion on [forum](https://users.rust-lang.org/t/how-to-get-full-output-from-command/50626), where I recently asked a question and it turned out that the problem was redundant quotation:

```rust
 Command::new("rg")
        .arg("\"pattern\"") // this will look for "pattern" with quotes included
```

This is something that has bitten me few times already (in multiple languages actually), so It'd be grateful to have it in the docs, even though it's not sctrictly Rust specific problem. Other users also agreed.

This can be really annoying to debug, because in many cases (inluding mine), quotes can be legal part of the argument, so the command doesn't fail, it just behaves unexpectedly. Not everybody (including me) knows that quotes around arguments are part of the shell and not part of the called program. Coincidentally, somoene had the same problem [yesterday](https://www.reddit.com/r/rust/comments/jkxelc/going_crazy_over_running_a_curl_process_from_rust/) on reddit.

I am not a native speaker, so I welcome any corrections or better formulation, I don't expect this to be merged as is. I was also reminded that this is platform/shell specific behaviour, but I didn't find a good way to formulate that briefly, any ideas welcome.

 It's also my first PR here, so I am not sure I did everything correctly, I did this just from Github UI.
2020-11-01 11:53:34 +01:00
Mara Bos
25eac92987
Rollup merge of #78596 - pavlukivan:master, r=m-ou-se
Fix doc links to std::fmt

`std::format` and `core::write` macros' docs linked to `core::fmt` for format string reference, even though only `std::fmt` has format string documentation (and the link titles were `std::fmt`)
2020-11-01 11:53:33 +01:00
Mara Bos
835310e3cc
Rollup merge of #78073 - fusion-engineering-forks:inline, r=eddyb
Add #[inline] to some functions in core::str.

Almost all str functions already had #[inline].
2020-11-01 11:53:29 +01:00
Scott Olson
e5b1f69d63 Inline Default::default() for atomics 2020-11-01 04:38:41 +00:00
Abhijit Gadgil
7c88bcc3f6 Fixes incorrect paranthesis. 2020-11-01 09:08:19 +05:30
Abhijit Gadgil
66d68cdc6f Trivial fixes to bitwise operator documentation
Added fixes to documentation of `BitAnd`, `BitOr`, `BitXor` and
`BitAndAssign`, where the documentation for implementation on
`Vector<bool>` was using logical operators in place of the bitwise
operators.

r? @steveklabnik
cc #78619
2020-11-01 08:22:25 +05:30
Dave Rolsky
47279b33e0
Clarify handling of final line ending in str::lines()
I found the description as it stands a bit confusing. I've added a bit more explanation to make it clear that a trailing line ending does not produce a final empty line.
2020-10-31 11:34:32 -05:00
Matyáš Racek
db416b232c
Apply suggestions from code review
Co-authored-by: Mara Bos <m-ou.se@m-ou.se>
2020-10-31 17:28:44 +01:00
Ralf Jung
9749eb72af fix aliasing issues in SipHasher 2020-10-31 16:26:06 +01:00
Ralf Jung
607076e209 fix aliasing issue in binary_heap 2020-10-31 16:26:06 +01:00
Ralf Jung
9f630af930 fix aliasing issue in unix sleep function 2020-10-31 16:26:06 +01:00
Ralf Jung
ed96321e7e fix aliasing issues in u128 formatting code 2020-10-31 16:26:06 +01:00
Matyáš Racek
d417bbef95
Add note to process::arg[s] that args shouldn't be escaped or quoted 2020-10-31 14:40:36 +01:00
Ivan Pavluk
3baf6a4a74 Fix doc links to std::fmt
std::format and core::write macros' docs linked to core::fmt for format string reference, even though only std::fmt has format string documentation and the link titles were std::fmt.
2020-10-31 18:02:55 +07:00
Mara Bos
3601f9d40b
Rollup merge of #78581 - a1phyr:const_btree_more, r=dtolnay
Constantify more BTreeMap and BTreeSet functions

Just because we can:

- `BTreeMap::len`
- `BTreeMap::is_empty`
- `BTreeSet::len`
- `BTreeSet::is_empty`

Note that I put the `const` under `const_btree_new`, because I don't think their is a need to create another feature flag for that.

cc #71835
2020-10-31 09:49:39 +01:00
Mara Bos
4ebd5536b4
Rollup merge of #77099 - tspiteri:exp_m1-examples, r=m-ou-se
make exp_m1 and ln_1p examples more representative of use

With this PR, the examples for `exp_m1` would fail if `x.exp() - 1.0` is used instead of `x.exp_m1()`, and the examples for `ln_1p` would fail if `(x + 1.0).ln()` is used instead of `x.ln_1p()`.
2020-10-31 09:49:32 +01:00
Mara Bos
76b8b00b4f
Rollup merge of #74622 - fusion-engineering-forks:panic-box, r=KodrAus
Add std::panic::panic_any.

The discussion of #67984 lead to the conclusion that there should be a macro or function separate from `std::panic!()` for throwing arbitrary payloads, to make it possible to deprecate or disallow (in edition 2021) `std::panic!(arbitrary_payload)`.

Alternative names:

- `panic_with!(..)`
- ~~`start_unwind(..)`~~ (panicking doesn't always unwind)
- `throw!(..)`
- `panic_throwing!(..)`
- `panic_with_value(..)`
- `panic_value(..)`
- `panic_with(..)`
- `panic_box(..)`
- `panic(..)`

The equivalent (private, unstable) function in `libstd` is called `std::panicking::begin_panic`.

I suggest `panic_any`, because it allows for any (`Any + Send`) type.

_Tracking issue: #78500_
2020-10-31 09:49:28 +01:00
Benoît du Garreau
307cc11beb Constantify more BTreeMap and BTreeSet functions
- BTreeMap::len
- BTreeMap::is_empty
- BTreeSet::len
- BTreeSet::is_empty
2020-10-30 19:24:08 +01:00